thread for handling UART receive We use events indexed by serial_num to trigger a more rapid send for unbuffered_write uarts, and run at 1kHz for general UART handling */
| 160 | unbuffered_write uarts, and run at 1kHz for general UART handling |
| 161 | */ |
| 162 | void UARTDriver::uart_rx_thread(void* arg) |
| 163 | { |
| 164 | while (uart_rx_thread_ctx == nullptr) { |
| 165 | hal.scheduler->delay_microseconds(1000); |
| 166 | } |
| 167 | |
| 168 | while (true) { |
| 169 | hal.scheduler->delay_microseconds(1000); |
| 170 | |
| 171 | for (uint8_t i=0; i<UART_MAX_DRIVERS; i++) { |
| 172 | if (serial_drivers[i] == nullptr) { |
| 173 | continue; |
| 174 | } |
| 175 | if (serial_drivers[i]->_rx_initialised) { |
| 176 | serial_drivers[i]->_rx_timer_tick(); |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | /* |
| 183 | initialise UART RX thread |
nothing calls this directly
no test coverage detected