![]() |
Morse Micro IoT SDK
2.9.7
|
This provides an abstraction layer for a UART.
This is used by MM-IoT-SDK example applications.
This is a very simple API and leaves UART configuration to the HAL.
Typedefs | |
| typedef void(* | mmhal_uart_rx_cb_t) (const uint8_t *data, size_t length, void *arg) |
| Function type for UART RX callback. More... | |
Enumerations | |
| enum | mmhal_uart_deep_sleep_mode { MMHAL_UART_DEEP_SLEEP_DISABLED , MMHAL_UART_DEEP_SLEEP_ONE_SHOT } |
| Enumeration of deep sleep modes for the UART HAL. More... | |
Functions | |
| void | mmhal_uart_init (mmhal_uart_rx_cb_t rx_cb, void *rx_cb_arg) |
| Initialize the UART HAL and perform any setup necessary. More... | |
| void | mmhal_uart_deinit (void) |
| Deinitialize the UART HAL, and disable the UART. | |
| void | mmhal_uart_tx (const uint8_t *data, size_t length) |
| Transmit data on the UART. More... | |
| bool | mmhal_uart_set_deep_sleep_mode (enum mmhal_uart_deep_sleep_mode mode) |
| Set the deep sleep mode for the UART. More... | |
| typedef void(* mmhal_uart_rx_cb_t) (const uint8_t *data, size_t length, void *arg) |
Function type for UART RX callback.
| data | The received data. |
| length | Length of the received data. |
| arg | Opaque argument (as passed in to mmhal_uart_init()). |
Definition at line 45 of file mmhal_uart.h.
Enumeration of deep sleep modes for the UART HAL.
| Enumerator | |
|---|---|
| MMHAL_UART_DEEP_SLEEP_DISABLED | Deep sleep mode is disabled. |
| MMHAL_UART_DEEP_SLEEP_ONE_SHOT | Enable deep sleep until activity occurs on data-link transport. |
Definition at line 71 of file mmhal_uart.h.
| void mmhal_uart_init | ( | mmhal_uart_rx_cb_t | rx_cb, |
| void * | rx_cb_arg | ||
| ) |
Initialize the UART HAL and perform any setup necessary.
| rx_cb | Optional callback to be invoked on receive (may be NULL). |
| rx_cb_arg | Optional opaque argument to be passed to the RX callback. May be NULL. |
| bool mmhal_uart_set_deep_sleep_mode | ( | enum mmhal_uart_deep_sleep_mode | mode | ) |
Set the deep sleep mode for the UART.
See mmhal_uart_deep_sleep_mode for possible deep sleep modes. Note that a given platform may not support all modes.
| mode | The deep sleep mode to set. |
| void mmhal_uart_tx | ( | const uint8_t * | data, |
| size_t | length | ||
| ) |
Transmit data on the UART.
This will block until all data is buffered for transmit (but may return before transmission has completed).
| data | Data to transmit. |
| length | Length of data. |