| 428 | } |
| 429 | |
| 430 | int UartEsp32::read() FL_NOEXCEPT { |
| 431 | if (!mBuffered) { |
| 432 | return -1; // Driver not installed, cannot read |
| 433 | } |
| 434 | |
| 435 | uart_port_t port = static_cast<uart_port_t>(mPortInt); |
| 436 | u8 c = 0; |
| 437 | int len = uart_read_bytes(port, &c, 1, 0); // timeout=0 (non-blocking) |
| 438 | |
| 439 | if (len == 1) { |
| 440 | return static_cast<int>(c); // Success: return byte as unsigned |
| 441 | } else { |
| 442 | return -1; // No data available or error |
| 443 | } |
| 444 | } |
| 445 | |
| 446 | bool UartEsp32::flush(u32 timeoutMs) FL_NOEXCEPT { |
| 447 | if (!mBuffered) { |
no outgoing calls
no test coverage detected