Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: STM32L452_Nucleo_ticker
Fork of mbed-dev by
Functions | |
| void | serial_init (serial_t *obj, PinName tx, PinName rx) |
| Initialize the serial peripheral. | |
| void | serial_free (serial_t *obj) |
| Release the serial peripheral, not currently invoked. | |
| void | serial_baud (serial_t *obj, int baudrate) |
| Configure the baud rate. | |
| void | serial_format (serial_t *obj, int data_bits, SerialParity parity, int stop_bits) |
| Configure the format. | |
| void | serial_irq_handler (serial_t *obj, uart_irq_handler handler, uint32_t id) |
| The serial interrupt handler registration. | |
| void | serial_irq_set (serial_t *obj, SerialIrq irq, uint32_t enable) |
| Configure serial interrupt. | |
| int | serial_getc (serial_t *obj) |
| Get character. | |
| void | serial_putc (serial_t *obj, int c) |
| Send a character. | |
| int | serial_readable (serial_t *obj) |
| Check if the serial peripheral is readable. | |
| int | serial_writable (serial_t *obj) |
| Check if the serial peripheral is writable. | |
| void | serial_clear (serial_t *obj) |
| Clear the serial peripheral. | |
| void | serial_break_set (serial_t *obj) |
| Set the break. | |
| void | serial_break_clear (serial_t *obj) |
| Clear the break. | |
| void | serial_pinout_tx (PinName tx) |
| Configure the TX pin for UART function. | |
| void | serial_set_flow_control (serial_t *obj, FlowControl type, PinName rxflow, PinName txflow) |
| Configure the serial for the flow control. | |
Function Documentation
| void serial_baud | ( | serial_t * | obj, |
| int | baudrate | ||
| ) |
Configure the baud rate.
- Parameters:
-
obj The serial object baudrate The baud rate to be configured
| void serial_break_clear | ( | serial_t * | obj ) |
Clear the break.
- Parameters:
-
obj The serial object
| void serial_break_set | ( | serial_t * | obj ) |
Set the break.
- Parameters:
-
obj The serial object
| void serial_clear | ( | serial_t * | obj ) |
Clear the serial peripheral.
- Parameters:
-
obj The serial object
| 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
- Parameters:
-
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.
- Parameters:
-
obj The serial object
| int serial_getc | ( | serial_t * | obj ) |
Get character.
This is a blocking call, waiting for a character
- Parameters:
-
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.
- Parameters:
-
obj The serial object tx The TX pin name rx The RX pin name
| void serial_irq_handler | ( | serial_t * | obj, |
| uart_irq_handler | handler, | ||
| uint32_t | id | ||
| ) |
The serial interrupt handler registration.
- Parameters:
-
obj The serial object handler The interrupt handler which will be invoked when the interrupt fires id The SerialBase object
| void serial_irq_set | ( | serial_t * | obj, |
| SerialIrq | irq, | ||
| uint32_t | enable | ||
| ) |
Configure serial interrupt.
This function is used for word-approach
- Parameters:
-
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.
- Parameters:
-
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
- Parameters:
-
obj The serial object c The character to be sent
| int serial_readable | ( | serial_t * | obj ) |
Check if the serial peripheral is readable.
- Parameters:
-
obj The serial object
- Returns:
- Non-zero value if a character can be read, 0 if nothing to read
| 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.
- Parameters:
-
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
| int serial_writable | ( | serial_t * | obj ) |
Check if the serial peripheral is writable.
- Parameters:
-
obj The serial object
- Returns:
- Non-zero value if a character can be written, 0 otherwise.
Generated on Tue Jul 12 2022 12:52:28 by
1.7.2
