forked from mirrors/qmk_userspace
Update UART driver API (#14839)
* Add uart_puts() and uart_gets() * Add some docs * Rework API * Formatting * Update docs/uart_driver.md Co-authored-by: Sergey Vlasov <sigprof@gmail.com> * Simplify a uart_write() loop * Update platforms/avr/drivers/uart.c Co-authored-by: Joel Challis <git@zvecr.com> Co-authored-by: Sergey Vlasov <sigprof@gmail.com> Co-authored-by: Joel Challis <git@zvecr.com>
This commit is contained in:
parent
7e86c37962
commit
04b51e381e
8 changed files with 72 additions and 25 deletions
|
@ -39,12 +39,16 @@ void uart_init(uint32_t baud) {
|
|||
}
|
||||
}
|
||||
|
||||
void uart_putchar(uint8_t c) { sdPut(&SERIAL_DRIVER, c); }
|
||||
void uart_write(uint8_t data) { sdPut(&SERIAL_DRIVER, c); }
|
||||
|
||||
uint8_t uart_getchar(void) {
|
||||
uint8_t uart_read(void) {
|
||||
msg_t res = sdGet(&SERIAL_DRIVER);
|
||||
|
||||
return (uint8_t)res;
|
||||
}
|
||||
|
||||
void uart_transmit(const uint8_t *data, uint16_t length) { sdWrite(&SERIAL_DRIVER, data, length); }
|
||||
|
||||
void uart_receive(uint8_t *data, uint16_t length) { sdRead(&SERIAL_DRIVER, data, length); }
|
||||
|
||||
bool uart_available(void) { return !sdGetWouldBlock(&SERIAL_DRIVER); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue