Modules | |
Serial hal tests | |
The Serial HAL tests ensure driver conformance to defined behavior. | |
Functions | |
void | serial_init (serial_t *obj, PinName tx, PinName rx) |
Initialize the serial peripheral. More... | |
void | serial_init_direct (serial_t *obj, const serial_pinmap_t *pinmap) |
Initialize the serial peripheral. More... | |
void | serial_free (serial_t *obj) |
Release the serial peripheral, not currently invoked. More... | |
void | serial_baud (serial_t *obj, int baudrate) |
Configure the baud rate. More... | |
void | serial_format (serial_t *obj, int data_bits, SerialParity parity, int stop_bits) |
Configure the format. More... | |
void | serial_irq_handler (serial_t *obj, uart_irq_handler handler, uint32_t id) |
The serial interrupt handler registration. More... | |
void | serial_irq_set (serial_t *obj, SerialIrq irq, uint32_t enable) |
Configure serial interrupt. More... | |
int | serial_getc (serial_t *obj) |
Get character. More... | |
void | serial_putc (serial_t *obj, int c) |
Send a character. More... | |
int | serial_readable (serial_t *obj) |
Check if the serial peripheral is readable. More... | |
int | serial_writable (serial_t *obj) |
Check if the serial peripheral is writable. More... | |
void | serial_clear (serial_t *obj) |
Clear the serial peripheral. More... | |
void | serial_break_set (serial_t *obj) |
Set the break. More... | |
void | serial_break_clear (serial_t *obj) |
Clear the break. More... | |
void | serial_pinout_tx (PinName tx) |
Configure the TX pin for UART function. More... | |
void | serial_set_flow_control (serial_t *obj, FlowControl type, PinName rxflow, PinName txflow) |
Configure the serial for the flow control. More... | |
void | serial_set_flow_control_direct (serial_t *obj, FlowControl type, const serial_fc_pinmap_t *pinmap) |
Configure the serial for the flow control. More... | |
const PinMap * | serial_tx_pinmap (void) |
Get the pins that support Serial TX. More... | |
const PinMap * | serial_rx_pinmap (void) |
Get the pins that support Serial RX. More... | |
const PinMap * | serial_cts_pinmap (void) |
Get the pins that support Serial CTS. More... | |
const PinMap * | serial_rts_pinmap (void) |
Get the pins that support Serial RTS. More... | |
RxIrq
is enabled by serial_irq_set, serial_irq_handler will be invoked whenever Receive Data Register Full IRQ is generated.TxIrq
is enabled by serial_irq_set, serial_irq_handler will be invoked whenever Transmit Data Register Empty IRQ is generated.tx_length
bytes from the tx
to the bus.DMAUsage
hint to select the appropriate async algorithm.rx_length
bytes to the rx
buffer.DMAUsage
hint to select the appropriate async algorithm.char_match
is ignored.char_match
is present in the received data.serial_t
without serial_free.serial_t
.obj
to any function.handler
to serial_irq_handler, serial_tx_asynch, serial_rx_asynch.void serial_baud | ( | serial_t * | obj, |
int | baudrate | ||
) |
Configure the baud rate.
obj | The serial object |
baudrate | The baud rate to be configured |
void serial_break_clear | ( | serial_t * | obj | ) |
Clear the break.
obj | The serial object |
void serial_break_set | ( | serial_t * | obj | ) |
Set the break.
obj | The serial object |
void serial_clear | ( | serial_t * | obj | ) |
Clear the serial peripheral.
obj | The serial object |
const PinMap* serial_cts_pinmap | ( | void | ) |
void serial_format | ( | serial_t * | obj, |
int | data_bits, | ||
SerialParity | parity, | ||
int | stop_bits | ||
) |
Configure the format.
Set the number of bits, parity and the number of stop bits
obj | The serial object |
data_bits | The number of data bits |
parity | The parity |
stop_bits | The number of stop bits |
void serial_free | ( | serial_t * | obj | ) |
Release the serial peripheral, not currently invoked.
It requires further resource management.
obj | The serial object |
int serial_getc | ( | serial_t * | obj | ) |
Get character.
This is a blocking call, waiting for a character
obj | The serial object |
void serial_init | ( | serial_t * | obj, |
PinName | tx, | ||
PinName | rx | ||
) |
Initialize the serial peripheral.
It sets the default parameters for serial peripheral, and configures its specifieds pins.
obj | The serial object |
tx | The TX pin name |
rx | The RX pin name |
void serial_init_direct | ( | serial_t * | obj, |
const serial_pinmap_t * | pinmap | ||
) |
Initialize the serial peripheral.
It sets the default parameters for serial peripheral, and configures its specifieds pins.
obj | The serial object |
pinmap | pointer to structure which holds static pinmap |
void serial_irq_handler | ( | serial_t * | obj, |
uart_irq_handler | handler, | ||
uint32_t | id | ||
) |
The serial interrupt handler registration.
obj | The serial object |
handler | The interrupt handler which will be invoked when the interrupt fires |
id | The SerialBase object |
Configure serial interrupt.
This function is used for word-approach
obj | The serial object |
irq | The serial IRQ type (RX or TX) |
enable | Set to non-zero to enable events, or zero to disable them |
void serial_pinout_tx | ( | PinName | tx | ) |
Configure the TX pin for UART function.
tx | The pin name used for TX |
void serial_putc | ( | serial_t * | obj, |
int | c | ||
) |
Send a character.
This is a blocking call, waiting for a peripheral to be available for writing
obj | The serial object |
c | The character to be sent |
int serial_readable | ( | serial_t * | obj | ) |
Check if the serial peripheral is readable.
obj | The serial object |
const PinMap* serial_rts_pinmap | ( | void | ) |
const PinMap* serial_rx_pinmap | ( | void | ) |
void serial_set_flow_control | ( | serial_t * | obj, |
FlowControl | type, | ||
PinName | rxflow, | ||
PinName | txflow | ||
) |
Configure the serial for the flow control.
It sets flow control in the hardware if a serial peripheral supports it, otherwise software emulation is used.
obj | The serial object |
type | The type of the flow control. Look at the available FlowControl types. |
rxflow | The TX pin name |
txflow | The RX pin name |
void serial_set_flow_control_direct | ( | serial_t * | obj, |
FlowControl | type, | ||
const serial_fc_pinmap_t * | pinmap | ||
) |
Configure the serial for the flow control.
It sets flow control in the hardware if a serial peripheral supports it, otherwise software emulation is used.
obj | The serial object |
type | The type of the flow control. Look at the available FlowControl types. |
pinmap | Pointer to structure which holds static pinmap |
const PinMap* serial_tx_pinmap | ( | void | ) |
int serial_writable | ( | serial_t * | obj | ) |
Check if the serial peripheral is writable.
obj | The serial object |