Simple driver for receiving from the EDBG Virtual COM Port via SERCOM USART.
This makes use of the SAM Serial USART (SERCOM USART) Driver, but configures a custom interrupt handler for the SERCOM instead of using the driver's own handler. The purpose of this driver is to avoid the overhead of the SERCOM USART driver's callback functionality, allowing the received data to be handled directly for increased throughput / reduced overhead.
Both USART receiver and transmitter are enabled, but only the receive interrupt is enabled since the intended use of the transmitter is to echo back the received characters.
The custom interrupt handler can, e.g., be a stripped down version of the SERCOM USART callback driver's interrupt handler (_usart_interrupt_handler()).
Functions | |
static void | cdc_rx_init (struct usart_module *const usart, sercom_handler_t cdc_rx_handler) |
Initialize USART for reception from EDBG Virtual COM Port. More... | |
|
inlinestatic |
Initialize USART for reception from EDBG Virtual COM Port.
This function initializes the specified SERCOM USART driver instance for use with the Embedded Debugger (EDBG) Virtual COM Port. Both transmitter and receiver are enabled, but only the receive interrupt is enabled.
A custom handler function for the receive interrupt must must be supplied. See the SERCOM USART callback driver's handler for an implementation template: _usart_interrupt_handler().
usart | Address of USART instance to use. |
cdc_rx_handler | Address of receive interrupt handler. |
References _sercom_get_sercom_inst_index(), _sercom_set_handler(), usart_config::mux_setting, usart_config::pinmux_pad0, usart_config::pinmux_pad1, usart_config::pinmux_pad2, usart_config::pinmux_pad3, STATUS_OK, usart_enable(), usart_enable_transceiver(), usart_get_config_defaults(), usart_init(), USART_TRANSCEIVER_RX, and USART_TRANSCEIVER_TX.