| 94 | } |
| 95 | |
| 96 | void HardwareSerial::invokeCallbacks() |
| 97 | { |
| 98 | (void)smg_uart_disable_interrupts(); |
| 99 | auto status = callbackStatus; |
| 100 | callbackStatus = 0; |
| 101 | callbackQueued = false; |
| 102 | smg_uart_restore_interrupts(); |
| 103 | |
| 104 | // Transmit complete ? |
| 105 | if((status & UART_STATUS_TXFIFO_EMPTY) != 0 && transmitComplete) { |
| 106 | transmitComplete(*this); |
| 107 | } |
| 108 | |
| 109 | // RX FIFO Full or RX FIFO Timeout or RX Overflow ? |
| 110 | if(status & (UART_STATUS_RXFIFO_FULL | UART_STATUS_RXFIFO_TOUT | UART_STATUS_RXFIFO_OVF)) { |
| 111 | auto receivedChar = smg_uart_peek_last_char(uart); |
| 112 | if(HWSDelegate) { |
| 113 | HWSDelegate(*this, receivedChar, smg_uart_rx_available(uart)); |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | unsigned HardwareSerial::getStatus() |
| 119 | { |
no test coverage detected