drivers/periph/uart: add periph_uart_rx_start feature
This commit is contained in:
parent
e9579cb21f
commit
9194440ead
@ -98,13 +98,24 @@ typedef unsigned int uart_t;
|
|||||||
*/
|
*/
|
||||||
typedef void(*uart_rx_cb_t)(void *arg, uint8_t data);
|
typedef void(*uart_rx_cb_t)(void *arg, uint8_t data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Signature for receive start condition interrupt callback
|
||||||
|
*
|
||||||
|
* @param[in] arg context to the callback (optional)
|
||||||
|
*/
|
||||||
|
typedef void(*uart_rxstart_cb_t)(void *arg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Interrupt context for a UART device
|
* @brief Interrupt context for a UART device
|
||||||
*/
|
*/
|
||||||
#ifndef HAVE_UART_ISR_CTX_T
|
#ifndef HAVE_UART_ISR_CTX_T
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uart_rx_cb_t rx_cb; /**< data received interrupt callback */
|
uart_rx_cb_t rx_cb; /**< data received interrupt callback */
|
||||||
void *arg; /**< argument to both callback routines */
|
void *arg; /**< argument to data received callback */
|
||||||
|
#ifdef MODULE_PERIPH_UART_RXSTART_IRQ
|
||||||
|
uart_rxstart_cb_t rxs_cb; /**< start condition received interrupt callback */
|
||||||
|
void *rxs_arg; /**< argument to start condition received callback */
|
||||||
|
#endif
|
||||||
} uart_isr_ctx_t;
|
} uart_isr_ctx_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -243,6 +254,45 @@ gpio_t uart_pin_tx(uart_t uart);
|
|||||||
#endif /* DOXYGEN */
|
#endif /* DOXYGEN */
|
||||||
#endif /* MODULE_PERIPH_UART_RECONFIGURE */
|
#endif /* MODULE_PERIPH_UART_RECONFIGURE */
|
||||||
|
|
||||||
|
#if defined(MODULE_PERIPH_UART_RXSTART_IRQ) || DOXYGEN
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configure the function that will be called when a start condition
|
||||||
|
* is detected.
|
||||||
|
*
|
||||||
|
* This will not enable / disable the generation of the RX start
|
||||||
|
* interrupt.
|
||||||
|
*
|
||||||
|
* @note You have to add the module `periph_uart_rxstart_irq` to your project
|
||||||
|
* to enable this function
|
||||||
|
*
|
||||||
|
* @param[in] uart The device to configure
|
||||||
|
* @param[in] cb The function called when a start condition is detected
|
||||||
|
* @param[in] arg Optional function argument
|
||||||
|
*/
|
||||||
|
void uart_rxstart_irq_configure(uart_t uart, uart_rxstart_cb_t cb, void *arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable the RX start interrupt.
|
||||||
|
*
|
||||||
|
* @note You have to add the module `periph_uart_rxstart_irq` to your project
|
||||||
|
* to enable this function
|
||||||
|
*
|
||||||
|
* @param[in] uart The device to configure
|
||||||
|
*/
|
||||||
|
void uart_rxstart_irq_enable(uart_t uart);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disable the RX start interrupt.
|
||||||
|
*
|
||||||
|
* @note You have to add the module `periph_uart_rxstart_irq` to your project
|
||||||
|
* to enable this function
|
||||||
|
*
|
||||||
|
* @param[in] uart The device to configure
|
||||||
|
*/
|
||||||
|
void uart_rxstart_irq_disable(uart_t uart);
|
||||||
|
#endif /* MODULE_PERIPH_UART_RXSTART_IRQ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Setup parity, data and stop bits for a given UART device
|
* @brief Setup parity, data and stop bits for a given UART device
|
||||||
*
|
*
|
||||||
|
|||||||
@ -32,6 +32,10 @@ config MODULE_PERIPH_UART_NONBLOCKING
|
|||||||
bool "Non-blocking support"
|
bool "Non-blocking support"
|
||||||
depends on HAS_PERIPH_UART_NONBLOCKING
|
depends on HAS_PERIPH_UART_NONBLOCKING
|
||||||
|
|
||||||
|
config MODULE_PERIPH_UART_RXSTART_IRQ
|
||||||
|
bool "Enable Start Condition Interrupt"
|
||||||
|
depends on HAS_PERIPH_UART_RXSTART_IRQ
|
||||||
|
|
||||||
config MODULE_PERIPH_INIT_UART_MODECFG
|
config MODULE_PERIPH_INIT_UART_MODECFG
|
||||||
bool
|
bool
|
||||||
depends on MODULE_PERIPH_UART_MODECFG
|
depends on MODULE_PERIPH_UART_MODECFG
|
||||||
|
|||||||
@ -333,6 +333,11 @@ config HAS_PERIPH_UART_RECONFIGURE
|
|||||||
help
|
help
|
||||||
Indicates that the UART pins can be re-configured as GPIOs.
|
Indicates that the UART pins can be re-configured as GPIOs.
|
||||||
|
|
||||||
|
config HAS_PERIPH_UART_RXSTART_IRQ
|
||||||
|
bool
|
||||||
|
help
|
||||||
|
Indicates that the UART has an Interrupt for Start Condition detected.
|
||||||
|
|
||||||
config HAS_PERIPH_USBDEV
|
config HAS_PERIPH_USBDEV
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user