Mbed OS Reference
Loading...
Searching...
No Matches
Asynchronous Serial Hardware Abstraction Layer

Functions

int serial_tx_asynch (serial_t *obj, const void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint)
 Begin asynchronous TX transfer. More...
 
void serial_rx_asynch (serial_t *obj, void *rx, size_t rx_length, uint8_t rx_width, uint32_t handler, uint32_t event, uint8_t char_match, DMAUsage hint)
 Begin asynchronous RX transfer (enable interrupt for data collecting) The used buffer is specified in the serial object - rx_buff. More...
 
uint8_t serial_tx_active (serial_t *obj)
 Attempts to determine if the serial peripheral is already in use for TX. More...
 
uint8_t serial_rx_active (serial_t *obj)
 Attempts to determine if the serial peripheral is already in use for RX. More...
 
int serial_irq_handler_asynch (serial_t *obj)
 The asynchronous TX and RX handler. More...
 
void serial_tx_abort_asynch (serial_t *obj)
 Abort the ongoing TX transaction. More...
 
void serial_rx_abort_asynch (serial_t *obj)
 Abort the ongoing RX transaction. More...
 

Detailed Description

Function Documentation

◆ serial_tx_asynch()

int serial_tx_asynch ( serial_t obj,
const void *  tx,
size_t  tx_length,
uint8_t  tx_width,
uint32_t  handler,
uint32_t  event,
DMAUsage  hint 
)

Begin asynchronous TX transfer.

The used buffer is specified in the serial object, tx_buff

Parameters
objThe serial object
txThe transmit buffer
tx_lengthThe number of bytes to transmit
tx_widthDeprecated argument
handlerThe serial handler
eventThe logical OR of events to be registered
hintA suggestion for how to use DMA with this transfer
Returns
Returns number of data transfered, otherwise returns 0

◆ serial_rx_asynch()

void serial_rx_asynch ( serial_t obj,
void *  rx,
size_t  rx_length,
uint8_t  rx_width,
uint32_t  handler,
uint32_t  event,
uint8_t  char_match,
DMAUsage  hint 
)

Begin asynchronous RX transfer (enable interrupt for data collecting) The used buffer is specified in the serial object - rx_buff.

Parameters
objThe serial object
rxThe receive buffer
rx_lengthThe number of bytes to receive
rx_widthDeprecated argument
handlerThe serial handler
eventThe logical OR of events to be registered
char_matchA character in range 0-254 to be matched
hintA suggestion for how to use DMA with this transfer

◆ serial_tx_active()

uint8_t serial_tx_active ( serial_t obj)

Attempts to determine if the serial peripheral is already in use for TX.

Parameters
objThe serial object
Returns
Non-zero if the RX transaction is ongoing, 0 otherwise

◆ serial_rx_active()

uint8_t serial_rx_active ( serial_t obj)

Attempts to determine if the serial peripheral is already in use for RX.

Parameters
objThe serial object
Returns
Non-zero if the RX transaction is ongoing, 0 otherwise

◆ serial_irq_handler_asynch()

int serial_irq_handler_asynch ( serial_t obj)

The asynchronous TX and RX handler.

Parameters
objThe serial object
Returns
Returns event flags if an RX transfer termination condition was met; otherwise returns 0

◆ serial_tx_abort_asynch()

void serial_tx_abort_asynch ( serial_t obj)

Abort the ongoing TX transaction.

It disables the enabled interupt for TX and flushes the TX hardware buffer if TX FIFO is used

Parameters
objThe serial object

◆ serial_rx_abort_asynch()

void serial_rx_abort_asynch ( serial_t obj)

Abort the ongoing RX transaction.

It disables the enabled interrupt for RX and flushes the RX hardware buffer if RX FIFO is used

Parameters
objThe serial object