| 287 | } |
| 288 | |
| 289 | void uart_buffer_append(char c) |
| 290 | { |
| 291 | uart_buffer[uart_buffer_tail++] = c; |
| 292 | uart_buffer_items++; |
| 293 | |
| 294 | // Wrap-around of tail pointer |
| 295 | if ( uart_buffer_tail >= uart_buffer_size ) |
| 296 | { |
| 297 | uart_buffer_tail = 0; |
| 298 | } |
| 299 | |
| 300 | // Make sure the head pointer also moves if circular buffer is overwritten |
| 301 | if ( uart_buffer_head == uart_buffer_tail ) |
| 302 | { |
| 303 | uart_buffer_head++; |
| 304 | } |
| 305 | |
| 306 | // Wrap-around of head pointer |
| 307 | if ( uart_buffer_head >= uart_buffer_size ) |
| 308 | { |
| 309 | uart_buffer_head = 0; |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | // Get the next character, or -1 if nothing received |
| 314 | int uart_serial_getchar() |
no outgoing calls
no test coverage detected
searching dependent graphs…