CuVoodoo STM32F1 firmware template
|
library for enhanced USART communication (code) More...
Go to the source code of this file.
Macros | |
#define | USART_PERIPHERALS_NB 3 |
number of available USART peripherals | |
Functions | |
static uint8_t | usart_enhanced_id (uint32_t usart) |
get index of corresponding enhanced USART configurations More... | |
bool | usart_enhanced_config (uint32_t usart, uint8_t databits, enum usart_enhanced_parity_t parity) |
configure enhanced USART More... | |
void | usart_enhanced_send (uint32_t usart, uint8_t data) |
send data over the enhanced USART using the configuration More... | |
uint8_t | usart_enhanced_recv (uint32_t usart) |
receive data over the enhanced USART using the configuration More... | |
bool | usart_enhanced_parity_error (uint32_t usart) |
get the parity status of the received data More... | |
Variables | |
static uint8_t | usart_enhanced_databits [USART_PERIPHERALS_NB] |
configured enhanced USART word size | |
static enum usart_enhanced_parity_t | usart_enhanced_parity [USART_PERIPHERALS_NB] |
configured enhanced USART parity | |
static bool | usart_enhanced_parity_errors [USART_PERIPHERALS_NB] |
last enhanced USART parity error status | |
static const bool | even_parity_lut [256] = { true, false, false, true, false, true, true, false, false, true, true, false, true, false, false, true, false, true, true, false, true, false, false, true, true, false, false, true, false, true, true, false, false, true, true, false, true, false, false, true, true, false, false, true, false, true, true, false, true, false, false, true, false, true, true, false, false, true, true, false, true, false, false, true, false, true, true, false, true, false, false, true, true, false, false, true, false, true, true, false, true, false, false, true, false, true, true, false, false, true, true, false, true, false, false, true, true, false, false, true, false, true, true, false, false, true, true, false, true, false, false, true, false, true, true, false, true, false, false, true, true, false, false, true, false, true, true, false, false, true, true, false, true, false, false, true, true, false, false, true, false, true, true, false, true, false, false, true, false, true, true, false, false, true, true, false, true, false, false, true, true, false, false, true, false, true, true, false, false, true, true, false, true, false, false, true, false, true, true, false, true, false, false, true, true, false, false, true, false, true, true, false, true, false, false, true, false, true, true, false, false, true, true, false, true, false, false, true, false, true, true, false, true, false, false, true, true, false, false, true, false, true, true, false, false, true, true, false, true, false, false, true, true, false, false, true, false, true, true, false, true, false, false, true, false, true, true, false, false, true, true, false, true, false, false, true, } |
know if there is an even number of 1's in a integer More... | |
library for enhanced USART communication (code)
the USART peripherals only support 8 or 9-bit word and even or odd parity (included in the data bits). The library adds support for 5 to 8-bit words, none/even/odd/mark/space parity (on top of the data bits)
Definition in file usart_enhanced.c.
bool usart_enhanced_config | ( | uint32_t | usart, |
uint8_t | databits, | ||
enum usart_enhanced_parity_t | parity | ||
) |
configure enhanced USART
[in] | usart | USART peripheral base address |
[in] | databits | word size in bits (5 to 8) |
[in] | parity | additional parity bit |
Definition at line 72 of file usart_enhanced.c.
|
static |
get index of corresponding enhanced USART configurations
[in] | usart | USART peripheral base address |
Definition at line 52 of file usart_enhanced.c.
bool usart_enhanced_parity_error | ( | uint32_t | usart | ) |
get the parity status of the received data
[in] | usart | USART peripheral base address |
Definition at line 177 of file usart_enhanced.c.
uint8_t usart_enhanced_recv | ( | uint32_t | usart | ) |
receive data over the enhanced USART using the configuration
[in] | usart | USART peripheral base address |
Definition at line 135 of file usart_enhanced.c.
void usart_enhanced_send | ( | uint32_t | usart, |
uint8_t | data | ||
) |
send data over the enhanced USART using the configuration
[in] | usart | USART peripheral base address |
[in] | data | data to be sent |
Definition at line 100 of file usart_enhanced.c.
|
static |
know if there is an even number of 1's in a integer
Definition at line 44 of file usart_enhanced.c.