diff options
author | Damien George <damien.p.george@gmail.com> | 2014-10-11 17:57:10 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-10-21 22:15:20 +0100 |
commit | 481d714bd56e0173668b249760e9cea8fce9b04f (patch) | |
tree | 4a1e9458676177d05b18e7d50966469bf44e1ec1 /stmhal/uart.h | |
parent | 20f59e182e1ca5874a94ce939f8a81af6c3dd71a (diff) | |
download | micropython-481d714bd56e0173668b249760e9cea8fce9b04f.tar.gz micropython-481d714bd56e0173668b249760e9cea8fce9b04f.zip |
stmhal: Overhaul UART class to use read/write, and improve it.v1.3.4
UART object now uses a stream-like interface: read, readall, readline,
readinto, readchar, write, writechar.
Timeouts are configured when the UART object is initialised, using
timeout and timeout_char keyword args.
The object includes optional read buffering, using interrupts. You can set
the buffer size dynamically using read_buf_len keyword arg. A size of 0
disables buffering.
Diffstat (limited to 'stmhal/uart.h')
-rw-r--r-- | stmhal/uart.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/stmhal/uart.h b/stmhal/uart.h index 7499473c16..eb77214151 100644 --- a/stmhal/uart.h +++ b/stmhal/uart.h @@ -45,9 +45,11 @@ typedef enum { typedef struct _pyb_uart_obj_t pyb_uart_obj_t; extern const mp_obj_type_t pyb_uart_type; -bool uart_init(pyb_uart_obj_t *uart_obj, uint32_t baudrate); +void uart_init0(void); +void uart_deinit(void); +void uart_irq_handler(mp_uint_t uart_id); + bool uart_rx_any(pyb_uart_obj_t *uart_obj); int uart_rx_char(pyb_uart_obj_t *uart_obj); void uart_tx_strn(pyb_uart_obj_t *uart_obj, const char *str, uint len); void uart_tx_strn_cooked(pyb_uart_obj_t *uart_obj, const char *str, uint len); - |