53 #define TIMEOUT (0xff)
83 uint8_t newhead = cbuf->
head;
85 if (newhead >= BUFSIZE){
88 if (newhead == cbuf->
tail){
111 uint8_t newtail = cbuf->
tail;
112 uint8_t retval = cbuf->
buf[newtail];
115 if (newtail >= BUFSIZE){
119 cbuf->
tail = newtail;
163 return val +
'A' - 10;
198 uint32_t timex = 5000000;
201 while (!rx_char_ready()){
222 PRR &= ~(1 << PRUSART0);
226 UBRR0 = BAUD_RATE_38400;
229 UCSR0C = ( 3 << UCSZ00);
232 UCSR0B = (1 << RXEN0)|(1 << TXEN0)|(1 << RXCIE0);
247 PRR |= (1 << PRUSART0);
261 while(!(UCSR0A & (1 << UDRE0)))
266 UCSR0A |=(1 << TXC0);
303 for (i=0;i<=payload_length-1;i++){
320 char str[20] =
"TO ";
345 volatile uint8_t length;
346 volatile uint8_t cmd;
347 volatile uint8_t payload[20];
350 if (!wait_for_ack && !rx_char_ready()){
380 if (length >
sizeof(payload)){
393 for (i=0;i<length;i++){
415 ping_response = payload[0];
417 if(ping_response == 1){
420 else if(ping_response == 2){
423 else if(ping_response == 3){
426 else if(ping_response == 4){
430 timeout_flag =
false;
437 case REPORT_TEXT_MSG:
440 for (i=0;i<
sizeof(top_menu_text);i++) top_menu_text[i]=0;
441 memcpy(&top_menu_text,(
char *)payload,
sizeof(top_menu_text)-1);
444 case REPORT_PING_BEEP: