48 #ifndef NRF_VT_UART_H__ 49 #define NRF_VT_UART_H__ 52 #include <hal/nrf_uart.h> 54 #ifndef NRF_VT_REPLACE_NRFX_DRIVER 55 #define NRF_VT_REPLACE_NRFX_DRIVER 1 58 #if NRF_VT_REPLACE_NRFX_DRIVER 59 #include "nrfx_uart.h" 60 #include "nrfx_uarte.h" 62 #define nrf_vt_uart_t nrfx_uart_t 64 #define NRF_VT_UART_EVT_TX_DONE NRFX_UART_EVT_TX_DONE 65 #define NRF_VT_UART_EVT_RX_DONE NRFX_UART_EVT_RX_DONE 66 #define NRF_VT_UART_EVT_ERROR NRFX_UART_EVT_ERROR 68 #define nrf_vt_uart_evt_type_t nrfx_uart_evt_type_t 69 #define nrf_vt_uart_config_t nrfx_uart_config_t 70 #define nrf_vt_uart_xfer_evt_t nrfx_uart_xfer_evt_t 71 #define nrf_vt_uart_error_evt_t nrfx_uart_error_evt_t 72 #define nrf_vt_uart_event_t nrfx_uart_event_t 73 #define nrf_vt_uart_event_handler_t nrfx_uart_event_handler_t 75 #define nrf_vt_uart_init nrfx_uart_init 76 #define nrf_vt_uart_uninit nrfx_uart_uninit 77 #define nrf_vt_uart_tx nrfx_uart_tx 78 #define nrf_vt_uart_tx_in_progress nrfx_uart_tx_in_progress 79 #define nrf_vt_uart_tx_abort nrfx_uart_tx_abort 80 #define nrf_vt_uart_rx nrfx_uart_rx 81 #define nrf_vt_uart_rx_ready nrfx_uart_rx_ready 82 #define nrf_vt_uart_rx_enable nrfx_uart_rx_enable 83 #define nrf_vt_uart_rx_disable nrfx_uart_rx_disable 84 #define nrf_vt_uart_rx_abort nrfx_uart_rx_abort 85 #define nrf_vt_uart_errorsrc_get nrfx_uart_errorsrc_get 104 NRF_UART_Type * p_reg;
105 uint8_t drv_inst_idx;
113 NRF_VT_UART_EVT_TX_DONE,
114 NRF_VT_UART_EVT_RX_DONE,
115 NRF_VT_UART_EVT_ERROR,
116 } nrf_vt_uart_evt_type_t;
128 nrf_uart_hwfc_t hwfc;
129 nrf_uart_parity_t parity;
131 uint8_t interrupt_priority;
132 } nrf_vt_uart_config_t;
137 #define NRF_VT_UART_DEFAULT_CONFIG \ 139 .pseltxd = NRF_UART_PSEL_DISCONNECTED, \ 140 .pselrxd = NRF_UART_PSEL_DISCONNECTED, \ 141 .pselcts = NRF_UART_PSEL_DISCONNECTED, \ 142 .pselrts = NRF_UART_PSEL_DISCONNECTED, \ 144 .hwfc = (nrf_uart_hwfc_t)NRFX_UART_DEFAULT_CONFIG_HWFC, \ 145 .parity = (nrf_uart_parity_t)NRFX_UART_DEFAULT_CONFIG_PARITY, \ 146 .baudrate = (nrf_uart_baudrate_t)NRFX_UART_DEFAULT_CONFIG_BAUDRATE, \ 147 .interrupt_priority = NRFX_UART_DEFAULT_CONFIG_IRQ_PRIORITY, \ 157 } nrf_vt_uart_xfer_evt_t;
164 nrf_vt_uart_xfer_evt_t rxtx;
166 } nrf_vt_uart_error_evt_t;
173 nrf_vt_uart_evt_type_t type;
176 nrf_vt_uart_xfer_evt_t rxtx;
177 nrf_vt_uart_error_evt_t error;
179 } nrf_vt_uart_event_t;
188 typedef void (*nrf_vt_uart_event_handler_t)(nrf_vt_uart_event_t
const * p_event,
208 nrfx_err_t nrf_vt_uart_init(nrf_vt_uart_t
const * p_instance,
209 nrf_vt_uart_config_t
const * p_config,
210 nrf_vt_uart_event_handler_t event_handler);
216 void nrf_vt_uart_uninit(nrf_vt_uart_t
const * p_instance);
236 nrfx_err_t nrf_vt_uart_tx(nrf_vt_uart_t
const * p_instance,
237 uint8_t
const * p_data,
248 bool nrf_vt_uart_tx_in_progress(nrf_vt_uart_t
const * p_instance);
258 void nrf_vt_uart_tx_abort(nrf_vt_uart_t
const * p_instance);
285 nrfx_err_t nrf_vt_uart_rx(nrf_vt_uart_t
const * p_instance,
299 bool nrf_vt_uart_rx_ready(nrf_vt_uart_t
const * p_instance);
310 void nrf_vt_uart_rx_enable(nrf_vt_uart_t
const * p_instance);
320 void nrf_vt_uart_rx_disable(nrf_vt_uart_t
const * p_instance);
330 void nrf_vt_uart_rx_abort(nrf_vt_uart_t
const * p_instance);
341 uint32_t nrf_vt_uart_errorsrc_get(nrf_vt_uart_t
const * p_instance);
343 #endif // NRF_VT_REPLACE_NRFX_DRIVER 347 #endif // NRF_VT_UART_H__