CuVoodoo STM32F1 firmware template
Functions | Variables
uart_soft.h File Reference

library to control up to 4 independent receive and transmit software UART ports (API) More...

Go to the source code of this file.

Functions

bool uart_soft_setup (uint32_t *rx_baudrates, uint32_t *tx_baudrates)
 setup software UART ports More...
 
uint8_t uart_soft_getbyte (uint8_t uart)
 get received byte from UART port More...
 
void uart_soft_flush (uint8_t uart)
 ensure all bytes are transmitted for the UART More...
 
void uart_soft_putbyte_nonblocking (uint8_t uart, uint8_t byte)
 put byte in buffer to be transmitted on UART port More...
 
void uart_soft_putbyte_blocking (uint8_t uart, uint8_t byte)
 transmit byte on UART port More...
 

Variables

volatile bool uart_soft_received [4]
 if data has been received from UART port and is available to be read
 

Detailed Description

library to control up to 4 independent receive and transmit software UART ports (API)

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.h.

Function Documentation

§ uart_soft_flush()

void uart_soft_flush ( uint8_t  uart)

ensure all bytes are transmitted for the UART

Parameters
[in]uartUART 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]uartUART 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]uartUART port to transmit the byte from
[in]bytebyte 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]uartUART port to transmit the byte from
[in]bytebyte 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_baudratesbaud rates of the 4 UART RX ports (0 if unused)
[in]tx_baudratesbaud 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.