Preston Ernst
/
mirror_actuator_VT
-data logging revision
sw_fifo.hpp@1:25a2b47ca291, 2021-08-05 (annotated)
- Committer:
- ernstpre
- Date:
- Thu Aug 05 08:27:51 2021 +0000
- Revision:
- 1:25a2b47ca291
No changes, just redownloading for final check for documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ernstpre | 1:25a2b47ca291 | 1 | #define FIFO_BUFFER_SIZE 128 // software buffer size (in bytes) |
ernstpre | 1:25a2b47ca291 | 2 | |
ernstpre | 1:25a2b47ca291 | 3 | // UART data transmit function |
ernstpre | 1:25a2b47ca291 | 4 | // - checks if there's room in the transmit sw buffer |
ernstpre | 1:25a2b47ca291 | 5 | // - if there's room, it transfers data byte to sw buffer |
ernstpre | 1:25a2b47ca291 | 6 | // - automatically handles "uart_tx_buffer_full_flag" |
ernstpre | 1:25a2b47ca291 | 7 | // - sets the overflow flag upon software buffer overflow (doesn't overwrite existing data) |
ernstpre | 1:25a2b47ca291 | 8 | // - if this is the first data byte in the buffer, it enables the "hw buffer empty" interrupt |
ernstpre | 1:25a2b47ca291 | 9 | void uart_send_byte(uint8_t byte); |
ernstpre | 1:25a2b47ca291 | 10 | |
ernstpre | 1:25a2b47ca291 | 11 | |
ernstpre | 1:25a2b47ca291 | 12 | // UART data receive function |
ernstpre | 1:25a2b47ca291 | 13 | // - checks if data exists in the receive sw buffer |
ernstpre | 1:25a2b47ca291 | 14 | // - if data exists, it returns the oldest element contained in the buffer |
ernstpre | 1:25a2b47ca291 | 15 | // - automatically handles "uart_rx_buffer_full_flag" |
ernstpre | 1:25a2b47ca291 | 16 | // - if no data exists, it clears the uart_rx_flag |
ernstpre | 1:25a2b47ca291 | 17 | uint8_t uart_get_byte(void); |
ernstpre | 1:25a2b47ca291 | 18 | |
ernstpre | 1:25a2b47ca291 | 19 | volatile extern uint8_t uart_rx_fifo_not_empty_flag; // this flag is automatically set and cleared by the software buffer |
ernstpre | 1:25a2b47ca291 | 20 | volatile extern uint8_t uart_rx_fifo_full_flag; // this flag is automatically set and cleared by the software buffer |
ernstpre | 1:25a2b47ca291 | 21 | volatile extern uint8_t uart_rx_fifo_ovf_flag; // this flag is not automatically cleared by the software buffer |
ernstpre | 1:25a2b47ca291 | 22 | volatile extern uint8_t uart_tx_fifo_full_flag; // this flag is automatically set and cleared by the software buffer |
ernstpre | 1:25a2b47ca291 | 23 | volatile extern uint8_t uart_tx_fifo_ovf_flag; // this flag is not automatically cleared by the software buffer |
ernstpre | 1:25a2b47ca291 | 24 | volatile extern uint8_t uart_tx_fifo_not_empty_flag; // this flag is automatically set and cleared by the software buffer |