27 #include <libopencm3/cm3/nvic.h> 28 #include <libopencm3/stm32/gpio.h> 29 #include <libopencm3/stm32/rcc.h> 30 #include <libopencm3/stm32/usart.h> 44 #define BUSVOODOO_RS485_USART 2 48 static void busvoodoo_rs485_drive_enable(void) 71 #define BUSVOODOO_RS485_RX_TIMER 2 72 #define BUSVOODOO_RS485_RX_CHANNEL 4 75 static const struct busvoodoo_uart_generic_specific_t busvoodoo_uart_generic_rs485 = { 118 bool complete =
false;
129 *prefix =
"RS-485/422";
131 const char* pinout_io[10] = {
"GND",
"5V",
"3V3",
"LV", NULL, NULL, NULL, NULL, NULL, NULL};
135 #if BUSVOODOO_HARDWARE_VERSION==0 136 const char* pinout_rscan[5] = {
"HV", NULL, NULL,
"B",
"A"};
138 const char* pinout_rscan[5] = {
"HV", NULL,
"A",
"B", NULL};
143 const char* pinout[10] = {pinout_rscan[0], pinout_io[0], pinout_rscan[1], pinout_io[2], pinout_rscan[2], pinout_io[4], pinout_rscan[3], pinout_io[6], pinout_rscan[4], pinout_io[8]};
161 .description =
"Recommended Standard 485/422",
#define USART_TX_PORT(x)
get port for USART transmit pin based on USART identifier
#define RCC_USART(x)
get RCC for USART based on USART identifier
#define RCC_TIM_CH(x, y)
get RCC for port based on TIMx_CHy identifier
bool busvoodoo_uart_generic_setup(char **prefix, const char *line)
setup generic UART mode
BusVoodoo global definitions and methods (API)
void busvoodoo_oled_text_pinout(const char *pins[10], bool io_connector)
draw pin names on bottom (blue) part in display buffer
const char * name
name of the mode (i.e.
#define TIM_SR_CCOF(x)
get TIM_SR_CCxOF based on CHx identifier
static void busvoodoo_rs485_receive_enable(void)
enable RS-485 transceiver received to allow receiving
#define NVIC_TIM_IRQ(x)
get NVIC IRQ for timer base on TIM identifier
#define BUSVOODOO_RS485_RX_TIMER
timer ID to capture RX edges
#define RCC_USART_PORT(x)
get RCC for USART port based on USART identifier
void busvoodoo_oled_update(void)
update OLED display RAM with current display buffer
#define TIM_SR_CCIF(x)
get TIM_SR_CCxIF based on CHx identifier
const char * busvoodoo_global_pinout_rscan[5]
RS/CAN connector pinout.
#define TIM_DIER_CCIE(x)
get TIM_DIER_CCxIE based on CHx identifier
global definitions and methods (API)
#define GPIO(x)
get GPIO based on GPIO identifier
#define TIM_CCR(x, y)
get TIM_CCRy register based on TIMx_CHy identifier
#define BUSVOODOO_RS485_RE_PORT
RS-485 pin to enable receiver (active low, pulled up)
#define RCC_TIM(x)
get RCC for timer based on TIM identifier
#define TIM_CH_PIN(x, y)
get pin based on TIMx_CHy identifier
static bool busvoodoo_rs485_setup(char **prefix, const char *line)
setup RS-485 mode
void busvoodoo_led_blue_off(void)
switch off blue LED
static void busvoodoo_rs485_drive_enable(void)
enable RS-485 transceiver driver to allow transmitting
#define USART_RX_PIN(x)
get pin for USART receive pin based on USART identifier
#define USART_TX_PIN(x)
get pin for USART transmit pin based on USART identifier
#define TIM_IC(x)
get TIM_IC based on CHx identifier
#define RST_USART(x)
get RST for USART based on USART identifier
#define USART(x)
get USART based on USART identifier
#define BUSVOODOO_RS485_DE_PORT
RS-485 pin to enable transmitter (active high, pulled low)
void busvoodoo_uart_generic_exit(void)
exit genetic UART mode
#define TIM_IC_IN_TI(x)
get TIM_IC_IN_TI based on CHx identifier
const char * busvoodoo_global_pinout_io[10]
I/O connector pinout.
#define busvoodoo_uart_generic_commands_nb
number of commands supported by the generic UART mode
#define TIM_CH_PORT(x, y)
get port based on TIMx_CHy identifier
#define USART_RX_PORT(x)
get port for USART receive pin based on USART identifier
bool busvoodoo_uart_generic_configure(const struct busvoodoo_uart_generic_specific_t *conf)
provide the generic USART with mode specific information
static void busvoodoo_rs485_receive_disable(void)
enable RS-485 transceiver received to allow receiving
BusVoodoo generic UART mode (API)
printing utilities to replace the large printf from the standard library (API)
#define BUSVOODOO_RS485_DE_PIN
RS-485 pin to enable transmitter (active high, pulled low)
void busvoodoo_oled_text_left(char *text)
draw mode text on top (yellow) left side in display buffer
const struct menu_command_t busvoodoo_uart_generic_commands[busvoodoo_uart_generic_commands_nb]
commands supported by the generic UART mode
#define LENGTH(x)
get the length of an array
static void busvoodoo_rs485_drive_disable(void)
enable RS-485 transceiver driver to allow transmitting
#define BUSVOODOO_RS485_RE_PIN
RS-485 pin to enable receiver (active low, pulled up)
#define TIM(x)
get TIM based on TIM identifier
#define BUSVOODOO_RS485_RX_CHANNEL
channel ID used as input capture to capture RX edges
static const struct busvoodoo_uart_generic_specific_t busvoodoo_uart_generic_rs485
RS-485 specific methods that will be called by the generic methods.
library to show BusVoodoo mode information on SSD1306 OLED display: name, activity, pinout (API)
BusVoodoo mode interface.
BusVoodoo RS-485/422 mode (API)
static void busvoodoo_rs485_exit(void)
exit RS-485 mode
#define BUSVOODOO_RS485_USART
USART peripheral.
const struct busvoodoo_mode_t busvoodoo_rs485_mode
RS-485 mode interface definition.