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:
volatile uint8_t tail
Index to first available character in buffer.
uint8_t uart_get_from_circ_buf(tcirc_buf *cbuf)
This will get a character from the buffer requested.
uint8_t uart_circ_buf_has_char(tcirc_buf *cbuf)
This will check for a character in the requested buffer.
void lcd_symbol_clr(lcd_symbol_t symbol)
This will clear any symbol on the Raven LCD.
int lcd_puts(const char *s)
This will put a string of characters out to the LCD.
void uart_add_to_circ_buf(tcirc_buf *cbuf, uint8_t ch)
This will add a new character to the circular buffer.
void uart_init_circ_buf(tcirc_buf *cbuf)
This will intialize the circular buffer head and tail of tcirc_buf struct.
void uart_init(const unsigned int uart_num, uint32_t module_clk_hz, const uint32_t baud)
Initialize UART.
void uart_send_byte(uint8_t byte)
Send one byte over the uart.
uint8_t uip_ntohex(uint8_t val)
This will convert a nibble to a hex value.
#define SOF_CHAR
Start-of-frame character.
void uart_serial_send_frame(uint8_t cmd, uint8_t payload_length, uint8_t *payload)
This function builds and sends a binary command frame to the ATmega1284p.
void uart_timeout_msg(uint8_t x)
This displays a time out message to the user based on the parameter reason x.
void itohex(uint8_t val, char *str)
Convert integer to hex value.
void uart_serial_rcv_frame(uint8_t wait_for_ack)
This will receive a frame from the ATmega1284p and parse the incoming data.
void beep(void)
Emits a beep from the Raven's buzzer.
Handles the control of the USART for communication with the ATmega1284p for sending commands...
volatile uint8_t head
Index to last available character in buffer.
void dectoascii(uint8_t val, char *str)
This function will convert decimal to ascii.
void lcd_single_print_dig(uint8_t numb, uint8_t pos)
This will add the passed in number to any of the four locations of the four digit segment display on ...
void lcd_symbol_set(lcd_symbol_t symbol)
This will enable any of the symbols on the Raven LCD.
This is the main file for the Raven LCD application.
tcirc_buf rxbuf
The RX circular buffer, for storing characters from serial port.
void uart_deinit(void)
Turn off UART for sleep mode.
This file implements a beep function to emit a beep sound from Raven's speaker. ...
#define EOF_CHAR
End-of-frame character.
Circular buffer structure.
void uart_clear_rx_buf(void)
This will clear the RX buffer.
uint8_t uart_get_char_rx(void)
This will wait for a new character from the ATmega1284p and timeout if no new character is received...
uint8_t buf[BUFSIZE]
The actual buffer used for storing characters.
This file operates the menu flow chart described in the readme notes.