26 #include <libopencmsis/core_cm3.h> 27 #include <libopencm3/stm32/gpio.h> 28 #include <libopencm3/stm32/rcc.h> 29 #include <libopencm3/stm32/dbgmcu.h> 61 static char last_c = 0;
163 printf(
"available commands:\n");
172 printf(
"available modes:\n");
177 bool mode_found =
false;
222 if (!str || 0==strlen(str)) {
228 printf(
"command not recognized. enter help to list commands\n");
241 rcc_clock_setup_in_hse_8mhz_out_72mhz();
244 DBGMCU_CR |= DBGMCU_CR_STANDBY;
245 DBGMCU_CR |= DBGMCU_CR_STOP;
246 DBGMCU_CR |= DBGMCU_CR_SLEEP;
253 printf(
"\nwelcome to BusVoodoo (");
static void process_command(char *str)
process user command
void board_setup(void)
setup board peripherals
const struct menu_command_t * commands
list of menu commands provided by mode
library for UART communication (API)
const struct menu_command_t busvoodoo_global_commands[]
list of supported commands
BusVoodoo global definitions and methods (API)
struct busvoodoo_mode_t busvoodoo_i2c_mode
I2C mode interface definition.
void terminal_send(volatile char c)
send character to terminal
static void command_reset(void *argument)
command to reset board
static const struct menu_command_t menu_commands[]
command to reboot into bootloader
void busvoodoo_oled_setup(void)
setup OLED display
void led_off(void)
switch off board LED
void busvoodoo_oled_update(void)
update OLED display RAM with current display buffer
void uart_putchar_nonblocking(char c)
send character over UART (non-blocking)
void main(void)
program entry point this is the firmware function started by the micro-controller ...
struct busvoodoo_mode_t busvoodoo_hiz_mode
HiZ mode interface definition.
const char * busvoodoo_global_pinout_rscan[5]
RS/CAN connector pinout.
void usb_cdcacm_putchar(char c)
send character over USB (non-blocking)
global definitions and methods (API)
enum menu_argument_t argument
what kind of argument it accepts
terminal prompt interface (API)
static struct busvoodoo_mode_t * busvoodoo_mode
current BusVoodoo mode
static void switch_mode(struct busvoodoo_mode_t *mode)
switch BusVoddoo mode
bool busvoodoo_full
is the BusVoodoo board fully populated (with HV voltage regulator, RS-232, RS-485, CAN transceiver on the back side)
void usb_cdcacm_setup(void)
setup USB CDC ACM peripheral
char * name
complete name of the command (space-free)
void terminal_setup(void)
initialize terminal prompt
volatile bool button_flag
flag set when board user button has been pressed/released
struct busvoodoo_mode_t busvoodoo_spi_mode
SPI mode interface definition.
const char * busvoodoo_global_pinout_io[10]
I/O connector pinout.
static void command_quit(void *argument)
command to quit current BusVoodoo mode
BusVoodoo UART mode (API)
char user_input_get(void)
get user input
const uint8_t busvoodoo_global_commands_nb
number supported commands
struct busvoodoo_mode_t busvoodoo_uart_mode
UART mode interface definition.
void(* exit)(void)
function to exit from mode (i.e.
static void command_help(void *argument)
command to show help
void sleep_ms(uint32_t duration)
go to sleep for some milliseconds
size_t printf(const char *format,...)
print format string on user output
const uint8_t commands_nb
number of menu commands provided by mode
printing utilities to replace the large printf from the standard library (API)
bool(* setup)(char **prefix, const char *line)
function to setup mode (menu prefix can be used to ask parameter, and line will be the user provided ...
library for USB CDC ACM communication (API)
static bool busvoodoo_mode_complete
is mode setup complete
#define LENGTH(x)
get the length of an array
static struct busvoodoo_mode_t * busvoodoo_modes[]
all supported BusVoodoo modes
BusVoodoo high impedance (HiZ) default mode (API)
static void command_mode(void *argument)
command to select mode
void busvoodoo_oled_clear(void)
clear display buffer
library to show BusVoodoo mode information on SSD1306 OLED display: name, activity, pinout (API)
volatile bool user_input_available
flag set when user input is available
void busvoodoo_safe_state(void)
set safe state by disabling all outputs
BusVoodoo mode interface.
void busvoodoo_setup(void)
setup BusVoodoo board
void uart_setup(void)
setup UART peripheral
size_t putc(char c)
print a single character on user output
void(* terminal_process)(char *line)
called when a line is entered
char * terminal_prefix
terminal prompt prefix