library to control up to 4 independent receive and transmit software UART ports (code)
More...
Go to the source code of this file.
|
static struct soft_uart_rx_state * | uart_soft_rx_states [4] = {NULL} |
| states of UART receive ports (up to 4)
|
|
static struct soft_uart_tx_state * | uart_soft_tx_states [4] = {NULL} |
| states of UART transmit ports (up to 4)
|
|
volatile bool | uart_soft_received [4] = {false, false, false, false} |
| if data has been received from UART port and is available to be read
|
|
static const uint32_t | timer_flags [4] = {TIM_SR_CC1IF,TIM_SR_CC2IF,TIM_SR_CC3IF,TIM_SR_CC4IF} |
| the interrupt flags for the compare units
|
|
static const uint32_t | timer_interrupt [4] = {TIM_DIER_CC1IE,TIM_DIER_CC2IE,TIM_DIER_CC3IE,TIM_DIER_CC4IE} |
| the interrupt enable for the compare units
|
|
static enum tim_oc_id | timer_oc [4] = {TIM_OC1,TIM_OC2,TIM_OC3,TIM_OC4} |
| the output compares for the compare units
|
|
library to control up to 4 independent receive and transmit software UART ports (code)
- Author
- King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info
- Date
- 2016
- Note
- peripherals used: GPIO GPIO used for the software 4 UART ports, timer timer used to sample UART signals
Definition in file uart_soft.c.
§ uart_soft_flush()
void uart_soft_flush |
( |
uint8_t |
uart | ) |
|
ensure all bytes are transmitted for the UART
- Parameters
-
[in] | uart | UART port to flush |
Definition at line 253 of file uart_soft.c.
§ uart_soft_getbyte()
uint8_t uart_soft_getbyte |
( |
uint8_t |
uart | ) |
|
get received byte from UART port
- Parameters
-
[in] | uart | UART receive port to read byte from |
- Returns
- received byte (0 if no byte is available)
Definition at line 195 of file uart_soft.c.
§ uart_soft_putbyte_blocking()
void uart_soft_putbyte_blocking |
( |
uint8_t |
uart, |
|
|
uint8_t |
byte |
|
) |
| |
transmit byte on UART port
- Note
- blocks until all buffered byte and this byte are transmitted
- Parameters
-
[in] | uart | UART port to transmit the byte from |
[in] | byte | byte to transmit |
Definition at line 303 of file uart_soft.c.
§ uart_soft_putbyte_nonblocking()
void uart_soft_putbyte_nonblocking |
( |
uint8_t |
uart, |
|
|
uint8_t |
byte |
|
) |
| |
put byte in buffer to be transmitted on UART port
- Note
- blocking if buffer is full
- Parameters
-
[in] | uart | UART port to transmit the byte from |
[in] | byte | byte to put in transmit buffer |
Definition at line 290 of file uart_soft.c.
§ uart_soft_setup()
bool uart_soft_setup |
( |
uint32_t * |
rx_baudrates, |
|
|
uint32_t * |
tx_baudrates |
|
) |
| |
setup software UART ports
- Parameters
-
[in] | rx_baudrates | baud rates of the 4 UART RX ports (0 if unused) |
[in] | tx_baudrates | baud rates of the 4 UART TX ports (0 if unused) |
- Returns
- is setup succeeded, else the configuration is wrong
Definition at line 115 of file uart_soft.c.
§ uart_soft_transmit()
static void uart_soft_transmit |
( |
uint8_t |
uart | ) |
|
|
static |
start transmitting a byte from the buffer
- Parameters
-
[in] | uart | UART port used for transmission |
Definition at line 269 of file uart_soft.c.