CuVoodoo STM32F1 firmware template
Macros | Enumerations | Functions | Variables
busvoodoo_uart.c File Reference

BusVoodoo UART mode (code) More...

Go to the source code of this file.

Macros

#define BUSVOODOO_USART_ID   3
 USART peripheral.
 

Enumerations

enum  busvoodoo_uart_setting_t {
  BUSVOODOO_UART_SETTING_NONE, BUSVOODOO_UART_SETTING_BAUDRATE, BUSVOODOO_UART_SETTING_DATABITS, BUSVOODOO_UART_SETTING_PARITY,
  BUSVOODOO_UART_SETTING_STOPBITS, BUSVOODOO_UART_SETTING_HWFLOWCTL, BUSVOODOO_UART_SETTING_DRIVE, BUSVOODOO_UART_SETTING_DONE
}
 mode setup stage
 

Functions

static bool busvoodoo_uart_setup (char **prefix, const char *line)
 setup UART mode More...
 
static void busvoodoo_uart_exit (void)
 exit UART mode
 
static void busvoodoo_uart_write (uint16_t value)
 write to UART More...
 
static void busvoodoo_uart_read (void)
 read from UART
 
static bool busvoodoo_uart_action (const char *action, uint32_t repetition, bool perform)
 perform UART action More...
 
static void busvoodoo_uart_command_actions (void *argument)
 command to perform actions More...
 
static void busvoodoo_uart_command_transmit (void *argument)
 command to transmit a string More...
 
static void busvoodoo_uart_command_receive (void *argument)
 command to receive data More...
 
static void busvoodoo_uart_command_transceive (void *argument)
 command to transmit and receive data More...
 
static void busvoodoo_uart_command_error (void *argument)
 command to verify incoming transmission for error More...
 

Variables

static enum busvoodoo_uart_setting_t busvoodoo_uart_setting = BUSVOODOO_UART_SETTING_NONE
 current mode setup stage
 
static uint32_t busvoodoo_uart_baudrate = 115200
 UART baud rate (in bps)
 
static uint8_t busvoodoo_uart_databits = 8
 UART data bits.
 
static uint32_t busvoodoo_uart_parity = USART_PARITY_NONE
 UART parity setting.
 
static uint32_t busvoodoo_uart_stopbits = USART_STOPBITS_1
 UART stop bits setting.
 
static bool busvoodoo_uart_hwflowctl = false
 UART hardware flow control setting (true = with hardware flow control, false = without hardware flow control.
 
static bool busvoodoo_uart_drive = true
 pin drive mode (true = push-pull, false = open-drain)
 
static bool busvoodoo_uart_pullup = false
 if embedded pull-up resistors are used
 
static const struct menu_command_t busvoodoo_uart_commands []
 UART menu commands.
 
const struct busvoodoo_mode_t busvoodoo_uart_mode
 UART mode interface definition. More...
 

Detailed Description

BusVoodoo UART mode (code)

Author
King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info
Date
2018
Note
peripherals used: USART USART peripheral used for UART communication

Definition in file busvoodoo_uart.c.

Function Documentation

◆ busvoodoo_uart_action()

static bool busvoodoo_uart_action ( const char *  action,
uint32_t  repetition,
bool  perform 
)
static

perform UART action

Parameters
[in]actionaction to perform
[in]repetitionhow many times to perform the action
[in]performthe action (true) or just check it (false)
Returns
true if the action has been performed, false if it is malformed

Definition at line 367 of file busvoodoo_uart.c.

◆ busvoodoo_uart_command_actions()

static void busvoodoo_uart_command_actions ( void *  argument)
static

command to perform actions

Parameters
[in]argumentactions to perform

Definition at line 468 of file busvoodoo_uart.c.

◆ busvoodoo_uart_command_error()

static void busvoodoo_uart_command_error ( void *  argument)
static

command to verify incoming transmission for error

Parameters
[in]argumentargument not required

Definition at line 632 of file busvoodoo_uart.c.

◆ busvoodoo_uart_command_receive()

static void busvoodoo_uart_command_receive ( void *  argument)
static

command to receive data

Parameters
[in]argumentin which format to display

Definition at line 529 of file busvoodoo_uart.c.

◆ busvoodoo_uart_command_transceive()

static void busvoodoo_uart_command_transceive ( void *  argument)
static

command to transmit and receive data

Parameters
[in]argumentno argument required

Definition at line 594 of file busvoodoo_uart.c.

◆ busvoodoo_uart_command_transmit()

static void busvoodoo_uart_command_transmit ( void *  argument)
static

command to transmit a string

Parameters
[in]argumentstring to transmit (CR+LF when none provided)

Definition at line 504 of file busvoodoo_uart.c.

◆ busvoodoo_uart_setup()

static bool busvoodoo_uart_setup ( char **  prefix,
const char *  line 
)
static

setup UART mode

Parameters
[out]prefixterminal prompt prefix
[in]lineterminal prompt line to configure mode
Returns
if setup is complete

Definition at line 76 of file busvoodoo_uart.c.

◆ busvoodoo_uart_write()

static void busvoodoo_uart_write ( uint16_t  value)
static

write to UART

Parameters
[in]valuevalue to write

Definition at line 280 of file busvoodoo_uart.c.

Variable Documentation

◆ busvoodoo_uart_mode

const struct busvoodoo_mode_t busvoodoo_uart_mode
Initial value:
= {
.name = "uart",
.description = "Universal Asynchronous Receiver-Transmitter",
.full_only = false,
}
static bool busvoodoo_uart_setup(char **prefix, const char *line)
setup UART mode
static const struct menu_command_t busvoodoo_uart_commands[]
UART menu commands.
#define LENGTH(x)
get the length of an array
Definition: global.h:26
static void busvoodoo_uart_exit(void)
exit UART mode

UART mode interface definition.

Definition at line 686 of file busvoodoo_uart.c.