BV: support full only modes
This commit is contained in:
parent
9fe271f40a
commit
5dc18f91a2
|
@ -43,7 +43,7 @@
|
|||
#include "busvoodoo_spi.h" // BusVoodoo SPI mode
|
||||
|
||||
/** all supported BusVoodoo modes */
|
||||
static struct busvoodoo_mode_t* busvoodoo_modes[] = {
|
||||
static const struct busvoodoo_mode_t* busvoodoo_modes[] = {
|
||||
&busvoodoo_hiz_mode,
|
||||
&busvoodoo_uart_mode,
|
||||
&busvoodoo_i2c_mode,
|
||||
|
@ -51,7 +51,7 @@ static struct busvoodoo_mode_t* busvoodoo_modes[] = {
|
|||
};
|
||||
|
||||
/** current BusVoodoo mode */
|
||||
static struct busvoodoo_mode_t* busvoodoo_mode = NULL;
|
||||
static struct busvoodoo_mode_t const * busvoodoo_mode = NULL;
|
||||
/** is mode setup complete */
|
||||
static bool busvoodoo_mode_complete = false;
|
||||
|
||||
|
@ -76,7 +76,7 @@ size_t putc(char c)
|
|||
/** switch BusVoddoo mode
|
||||
* @param[in] mode mode to switch to
|
||||
*/
|
||||
static void switch_mode(struct busvoodoo_mode_t* mode)
|
||||
static void switch_mode(const struct busvoodoo_mode_t* mode)
|
||||
{
|
||||
if (busvoodoo_mode) {
|
||||
(*busvoodoo_mode->exit)(); // exit current mode
|
||||
|
@ -124,36 +124,36 @@ static void command_reset(void* argument);
|
|||
/** list of all supported commands */
|
||||
static const struct menu_command_t menu_commands[] = {
|
||||
{
|
||||
'm',
|
||||
"mode",
|
||||
"select mode",
|
||||
MENU_ARGUMENT_STRING,
|
||||
"[mode]",
|
||||
&command_mode,
|
||||
.shortcut = 'm',
|
||||
.name = "mode",
|
||||
.command_description = "select mode",
|
||||
.argument = MENU_ARGUMENT_STRING,
|
||||
.argument_description = "[mode]",
|
||||
.command_handler = &command_mode,
|
||||
},
|
||||
{
|
||||
'q',
|
||||
"quit",
|
||||
"quit current mode",
|
||||
MENU_ARGUMENT_NONE,
|
||||
NULL,
|
||||
&command_quit,
|
||||
.shortcut = 'q',
|
||||
.name = "quit",
|
||||
.command_description = "quit current mode",
|
||||
.argument = MENU_ARGUMENT_NONE,
|
||||
.argument_description = NULL,
|
||||
.command_handler = &command_quit,
|
||||
},
|
||||
{
|
||||
'r',
|
||||
"reset",
|
||||
"reset board",
|
||||
MENU_ARGUMENT_NONE,
|
||||
NULL,
|
||||
&command_reset,
|
||||
.shortcut = 'R',
|
||||
.name = "reset",
|
||||
.command_description = "reset board",
|
||||
.argument = MENU_ARGUMENT_NONE,
|
||||
.argument_description = NULL,
|
||||
.command_handler = &command_reset,
|
||||
},
|
||||
{
|
||||
'h',
|
||||
"help",
|
||||
"display help",
|
||||
MENU_ARGUMENT_NONE,
|
||||
NULL,
|
||||
&command_help,
|
||||
.shortcut = 'h',
|
||||
.name = "help",
|
||||
.command_description = "display help",
|
||||
.argument = MENU_ARGUMENT_NONE,
|
||||
.argument_description = NULL,
|
||||
.command_handler = &command_help,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -163,7 +163,12 @@ static void command_help(void* argument)
|
|||
printf("available commands:\n");
|
||||
menu_print_commands(menu_commands, LENGTH(menu_commands)); // print global commands
|
||||
menu_print_commands(busvoodoo_global_commands, busvoodoo_global_commands_nb); // print BusVoodoo global commands
|
||||
menu_print_commands(busvoodoo_mode->commands, busvoodoo_mode->commands_nb); // print BusVoodoo mode commands
|
||||
if (busvoodoo_full) {
|
||||
menu_print_commands(busvoodoo_global_full_commands, busvoodoo_global_full_commands_nb); // print BusVoodoo global commands
|
||||
}
|
||||
if (!busvoodoo_mode->full_only || busvoodoo_full) {
|
||||
menu_print_commands(busvoodoo_mode->commands, busvoodoo_mode->commands_nb); // print BusVoodoo mode commands
|
||||
}
|
||||
}
|
||||
|
||||
static void command_mode(void* argument)
|
||||
|
@ -171,13 +176,19 @@ static void command_mode(void* argument)
|
|||
if (NULL==argument || 0==strlen(argument)) { // no mode provided: list all modes
|
||||
printf("available modes:\n");
|
||||
for (uint8_t i=0; i<LENGTH(busvoodoo_modes); i++) { // go through all modes
|
||||
printf("%s\t%s\n", busvoodoo_modes[i]->name, busvoodoo_modes[i]->description); // display mode information
|
||||
if (!busvoodoo_modes[i]->full_only || busvoodoo_full) {
|
||||
printf("%s\t%s\n", busvoodoo_modes[i]->name, busvoodoo_modes[i]->description); // display mode information
|
||||
}
|
||||
}
|
||||
} else { // mode provided
|
||||
bool mode_found = false; // to know if we found the matching mode
|
||||
for (uint8_t i=0; i<LENGTH(busvoodoo_modes); i++) { // go through all modes
|
||||
if (0==strcmp(argument, busvoodoo_modes[i]->name)) { // check for corresponding mode
|
||||
switch_mode(busvoodoo_modes[i]); // switch to mode
|
||||
if (!busvoodoo_mode->full_only || busvoodoo_full) {
|
||||
switch_mode(busvoodoo_modes[i]); // switch to mode
|
||||
} else {
|
||||
printf("mode only available for BusVoodoo full\n");
|
||||
}
|
||||
mode_found = true; // remember we found the mode
|
||||
break; // stop searching for mode
|
||||
}
|
||||
|
@ -217,17 +228,26 @@ static void process_command(char* str)
|
|||
if (!busvoodoo_mode_complete) { // mode setup is not complete
|
||||
busvoodoo_mode_complete = (*busvoodoo_mode->setup)(&terminal_prefix, str); // continue setup
|
||||
terminal_send(0); // update the terminal prompt
|
||||
} else {
|
||||
} else { // mode setup is complete
|
||||
// don't handle empty lines
|
||||
if (!str || 0==strlen(str)) {
|
||||
return;
|
||||
}
|
||||
if (!menu_handle_command(str, busvoodoo_mode->commands, busvoodoo_mode->commands_nb)) {
|
||||
if (!menu_handle_command(str, busvoodoo_global_commands, busvoodoo_global_commands_nb)) {
|
||||
if (!menu_handle_command(str, menu_commands, LENGTH(menu_commands))) {
|
||||
printf("command not recognized. enter help to list commands\n");
|
||||
}
|
||||
}
|
||||
bool command_handled = false;
|
||||
if (!busvoodoo_mode->full_only || busvoodoo_full) {
|
||||
command_handled = menu_handle_command(str, busvoodoo_mode->commands, busvoodoo_mode->commands_nb); // try if the mode can handle this command
|
||||
}
|
||||
if (!command_handled && busvoodoo_full) {
|
||||
command_handled = menu_handle_command(str, busvoodoo_global_full_commands, busvoodoo_global_full_commands_nb); // try if full BusVoodoo can handle this command
|
||||
}
|
||||
if (!command_handled) {
|
||||
command_handled = menu_handle_command(str, busvoodoo_global_commands, busvoodoo_global_commands_nb); // try if the base BusVoodoo can handle this command
|
||||
}
|
||||
if (!command_handled) {
|
||||
command_handled = menu_handle_command(str, menu_commands, LENGTH(menu_commands)); // try if this is not a global command
|
||||
}
|
||||
if (!command_handled) {
|
||||
printf("command not recognized. enter help to list commands\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -723,44 +723,48 @@ static void busvoodoo_global_pinout(void* argument)
|
|||
}
|
||||
}
|
||||
|
||||
/** list of supported commands */
|
||||
const struct menu_command_t busvoodoo_global_commands[] = {
|
||||
{
|
||||
'P',
|
||||
"power",
|
||||
"switch 3V3 and 5V power rails on/off, or read internal voltages",
|
||||
MENU_ARGUMENT_STRING,
|
||||
"[on|off]",
|
||||
&busvoodoo_global_power,
|
||||
.shortcut = 'p',
|
||||
.name = "pinout",
|
||||
.command_description = "show connector pinout",
|
||||
.argument = MENU_ARGUMENT_NONE,
|
||||
.argument_description = NULL,
|
||||
.command_handler = &busvoodoo_global_pinout,
|
||||
},
|
||||
{
|
||||
'L',
|
||||
"LV",
|
||||
"set voltage on low voltage power rail (0, 0.3-4.8, 5V), or read voltage on pin",
|
||||
MENU_ARGUMENT_FLOAT,
|
||||
"[voltage]",
|
||||
&busvoodoo_global_lv,
|
||||
.shortcut = 'P',
|
||||
.name = "power",
|
||||
.command_description = "switch 3V3 and 5V power rails on/off, or read internal voltages",
|
||||
.argument = MENU_ARGUMENT_STRING,
|
||||
.argument_description = "[on|off]",
|
||||
.command_handler = &busvoodoo_global_power,
|
||||
},
|
||||
{
|
||||
'H',
|
||||
"HV",
|
||||
"set voltage on high voltage power rail (0, 3.3-24V), or read voltage on pin",
|
||||
MENU_ARGUMENT_FLOAT,
|
||||
"[voltage]",
|
||||
&busvoodoo_global_hv,
|
||||
},
|
||||
{
|
||||
'p',
|
||||
"pinout",
|
||||
"show connector pinout",
|
||||
MENU_ARGUMENT_NONE,
|
||||
NULL,
|
||||
&busvoodoo_global_pinout,
|
||||
.shortcut = 'L',
|
||||
.name = "LV",
|
||||
.command_description = "set voltage on low voltage power rail (0, 0.3-4.8, 5V), or read voltage on pin",
|
||||
.argument = MENU_ARGUMENT_FLOAT,
|
||||
.argument_description = "[voltage]",
|
||||
.command_handler = &busvoodoo_global_lv,
|
||||
},
|
||||
};
|
||||
|
||||
const uint8_t busvoodoo_global_commands_nb = LENGTH(busvoodoo_global_commands);
|
||||
|
||||
const struct menu_command_t busvoodoo_global_full_commands[] = {
|
||||
{
|
||||
.shortcut = 'H',
|
||||
.name = "HV",
|
||||
.command_description = "set voltage on high voltage power rail (0, 3.3-24V), or read voltage on pin",
|
||||
.argument = MENU_ARGUMENT_FLOAT,
|
||||
.argument_description = "[voltage]",
|
||||
.command_handler = &busvoodoo_global_hv,
|
||||
},
|
||||
};
|
||||
|
||||
const uint8_t busvoodoo_global_full_commands_nb = LENGTH(busvoodoo_global_full_commands);
|
||||
|
||||
/** interrupt service routine called on LED timeout */
|
||||
void TIM_ISR(BUSVOODOO_LED_TIMER)(void)
|
||||
{
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
struct busvoodoo_mode_t {
|
||||
const char* name; /**< name of the mode (i.e. protocol shortcut for the menu) */
|
||||
const char* description; /**< human readable description of the mode (i.e. full protocol name) */
|
||||
const bool full_only; /**< if this mode is available only for BusVoodoo full flavor */
|
||||
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 response)*/
|
||||
const struct menu_command_t* commands; /**< list of menu commands provided by mode */
|
||||
const uint8_t commands_nb; /**< number of menu commands provided by mode */
|
||||
|
@ -130,10 +131,14 @@ extern const uint8_t busvoodoo_io_groups[13]; /**< which I/O pin (group) does th
|
|||
extern bool busvoodoo_full;
|
||||
/** version of the hardware board */
|
||||
extern char busvoodoo_version;
|
||||
/** list of supported commands */
|
||||
/** list of supported commands for base BusVoodoo */
|
||||
extern const struct menu_command_t busvoodoo_global_commands[];
|
||||
/** number supported commands */
|
||||
/** number supported commands for base BusVoodoo */
|
||||
extern const uint8_t busvoodoo_global_commands_nb;
|
||||
/** list of supported commands for BusVoodoo full only */
|
||||
extern const struct menu_command_t busvoodoo_global_full_commands[];
|
||||
/** number supported commands for BusVoodoo full only */
|
||||
extern const uint8_t busvoodoo_global_full_commands_nb;
|
||||
|
||||
/** I/O connector pinout */
|
||||
extern const char* busvoodoo_global_pinout_io[10];
|
||||
|
|
|
@ -63,7 +63,7 @@ static bool busvoodoo_hiz_setup(char** prefix, const char* line)
|
|||
for (uint8_t i=0; i<LENGTH(pinout_rscan) && i<LENGTH(busvoodoo_global_pinout_rscan); i++) {
|
||||
busvoodoo_global_pinout_rscan[i] = pinout_rscan[i]; // set pin names
|
||||
}
|
||||
}
|
||||
}
|
||||
busvoodoo_oled_text_pinout(busvoodoo_global_pinout_io, true); // set pinout on display
|
||||
busvoodoo_oled_update(); // update display to show text and pinout
|
||||
return true;
|
||||
|
@ -860,44 +860,45 @@ static void busvoodoo_hiz_command_test_pins(void* argument)
|
|||
/** HiZ menu commands */
|
||||
static const struct menu_command_t busvoodoo_hiz_commands[] = {
|
||||
{
|
||||
'v',
|
||||
"version",
|
||||
"show hardware and firmware version",
|
||||
MENU_ARGUMENT_NONE,
|
||||
NULL,
|
||||
&busvoodoo_hiz_version,
|
||||
.shortcut = 'v',
|
||||
.name = "version",
|
||||
.command_description = "show hardware and firmware version",
|
||||
.argument = MENU_ARGUMENT_NONE,
|
||||
.argument_description = NULL,
|
||||
.command_handler = &busvoodoo_hiz_version,
|
||||
},
|
||||
{
|
||||
'b',
|
||||
"bootloader",
|
||||
"reboot into DFU bootloader",
|
||||
MENU_ARGUMENT_NONE,
|
||||
NULL,
|
||||
&busvoodoo_hiz_bootloader,
|
||||
.shortcut = 'b',
|
||||
.name = "bootloader",
|
||||
.command_description = "reboot into DFU bootloader",
|
||||
.argument = MENU_ARGUMENT_NONE,
|
||||
.argument_description = NULL,
|
||||
.command_handler = &busvoodoo_hiz_bootloader,
|
||||
},
|
||||
{
|
||||
's',
|
||||
"self-test [halt]",
|
||||
"perform board self-test (optional halt on error)",
|
||||
MENU_ARGUMENT_STRING,
|
||||
NULL,
|
||||
&busvoodoo_hiz_command_test_self,
|
||||
.shortcut = 's',
|
||||
.name = "self-test [halt]",
|
||||
.command_description = "perform board self-test (optional halt on error)",
|
||||
.argument = MENU_ARGUMENT_STRING,
|
||||
.argument_description = NULL,
|
||||
.command_handler = &busvoodoo_hiz_command_test_self,
|
||||
},
|
||||
{
|
||||
't',
|
||||
"pins-test [halt]",
|
||||
"perform connector pins test (optional halt on error)",
|
||||
MENU_ARGUMENT_STRING,
|
||||
NULL,
|
||||
&busvoodoo_hiz_command_test_pins,
|
||||
.shortcut = 't',
|
||||
.name = "pins-test [halt]",
|
||||
.command_description = "perform connector pins test (optional halt on error)",
|
||||
.argument = MENU_ARGUMENT_STRING,
|
||||
.argument_description = NULL,
|
||||
.command_handler = &busvoodoo_hiz_command_test_pins,
|
||||
},
|
||||
};
|
||||
|
||||
struct busvoodoo_mode_t busvoodoo_hiz_mode = {
|
||||
"hiz",
|
||||
"High Impedance (Z)",
|
||||
&busvoodoo_hiz_setup,
|
||||
busvoodoo_hiz_commands,
|
||||
LENGTH(busvoodoo_hiz_commands),
|
||||
&busvoodoo_hiz_exit,
|
||||
const struct busvoodoo_mode_t busvoodoo_hiz_mode = {
|
||||
.name = "hiz",
|
||||
.description = "High Impedance (Z)",
|
||||
.full_only = false,
|
||||
.setup = &busvoodoo_hiz_setup,
|
||||
.commands = busvoodoo_hiz_commands,
|
||||
.commands_nb = LENGTH(busvoodoo_hiz_commands),
|
||||
.exit = &busvoodoo_hiz_exit,
|
||||
};
|
||||
|
|
|
@ -19,4 +19,4 @@
|
|||
*/
|
||||
|
||||
/** HiZ mode interface definition */
|
||||
extern struct busvoodoo_mode_t busvoodoo_hiz_mode;
|
||||
extern const struct busvoodoo_mode_t busvoodoo_hiz_mode;
|
||||
|
|
|
@ -129,6 +129,12 @@ static bool busvoodoo_i2c_setup(char** prefix, const char* line)
|
|||
for (uint8_t i=0; i<LENGTH(pinout_io) && i<LENGTH(busvoodoo_global_pinout_io); i++) {
|
||||
busvoodoo_global_pinout_io[i] = pinout_io[i]; // set pin names
|
||||
}
|
||||
if (busvoodoo_full) {
|
||||
const char* pinout_rscan[5] = {"HV", NULL, NULL, NULL, NULL}; // HiZ mode RS/CAN pinout
|
||||
for (uint8_t i=0; i<LENGTH(pinout_rscan) && i<LENGTH(busvoodoo_global_pinout_rscan); i++) {
|
||||
busvoodoo_global_pinout_rscan[i] = pinout_rscan[i]; // set pin names
|
||||
}
|
||||
}
|
||||
busvoodoo_oled_text_pinout(pinout_io, true); // set pinout on display
|
||||
busvoodoo_oled_update(); // update display to show text and pinout
|
||||
complete = true; // configuration is complete
|
||||
|
@ -171,7 +177,7 @@ static void busvoodoo_i2c_read(void)
|
|||
printf("not in receive mode");
|
||||
break;
|
||||
case I2C_MASTER_RC_BUS_ERROR:
|
||||
printf("error detected on bus (flush I2C peripheral to correct)");
|
||||
printf("error detected on bus (reset I2C peripheral to correct)");
|
||||
break;
|
||||
default:
|
||||
printf("error");
|
||||
|
@ -203,7 +209,7 @@ static void busvoodoo_i2c_write(uint8_t data)
|
|||
printf("not in transmit mode");
|
||||
break;
|
||||
case I2C_MASTER_RC_BUS_ERROR:
|
||||
printf("error detected on bus (flush I2C peripheral to correct)");
|
||||
printf("error detected on bus (reset I2C peripheral to correct)");
|
||||
break;
|
||||
default:
|
||||
printf("error");
|
||||
|
@ -242,7 +248,7 @@ static void busvoodoo_i2c_select(uint16_t slave, bool write)
|
|||
printf("not in transmit mode");
|
||||
break;
|
||||
case I2C_MASTER_RC_BUS_ERROR:
|
||||
printf("error detected on bus (flush I2C peripheral to correct)");
|
||||
printf("error detected on bus (reset I2C peripheral to correct)");
|
||||
break;
|
||||
default:
|
||||
printf("error");
|
||||
|
@ -517,36 +523,37 @@ static void busvoodoo_i2c_command_scan(void* argument)
|
|||
/** I2C menu commands */
|
||||
static const struct menu_command_t busvoodoo_i2c_commands[] = {
|
||||
{
|
||||
'f',
|
||||
"flush",
|
||||
"flush I2C peripheral",
|
||||
MENU_ARGUMENT_NONE,
|
||||
NULL,
|
||||
&busvoodoo_i2c_command_reset,
|
||||
.shortcut = 'r',
|
||||
.name = "reset_i2c",
|
||||
.command_description = "reset I2C peripheral",
|
||||
.argument = MENU_ARGUMENT_NONE,
|
||||
.argument_description = NULL,
|
||||
.command_handler = &busvoodoo_i2c_command_reset,
|
||||
},
|
||||
{
|
||||
'a',
|
||||
"action",
|
||||
"perform protocol actions",
|
||||
MENU_ARGUMENT_STRING,
|
||||
"[actions]",
|
||||
&busvoodoo_i2c_command_actions,
|
||||
.shortcut = 'a',
|
||||
.name = "action",
|
||||
.command_description = "perform protocol actions",
|
||||
.argument = MENU_ARGUMENT_STRING,
|
||||
.argument_description = "[actions]",
|
||||
.command_handler = &busvoodoo_i2c_command_actions,
|
||||
},
|
||||
{
|
||||
's',
|
||||
"scan",
|
||||
"scan for slave devices",
|
||||
MENU_ARGUMENT_NONE,
|
||||
NULL,
|
||||
&busvoodoo_i2c_command_scan,
|
||||
.shortcut = 's',
|
||||
.name = "scan",
|
||||
.command_description = "scan for slave devices",
|
||||
.argument = MENU_ARGUMENT_NONE,
|
||||
.argument_description = NULL,
|
||||
.command_handler = &busvoodoo_i2c_command_scan,
|
||||
},
|
||||
};
|
||||
|
||||
struct busvoodoo_mode_t busvoodoo_i2c_mode = {
|
||||
"i2c",
|
||||
"Inter-Integrated Circuit",
|
||||
&busvoodoo_i2c_setup,
|
||||
busvoodoo_i2c_commands,
|
||||
LENGTH(busvoodoo_i2c_commands),
|
||||
&busvoodoo_i2c_exit,
|
||||
const struct busvoodoo_mode_t busvoodoo_i2c_mode = {
|
||||
.name = "i2c",
|
||||
.description = "Inter-Integrated Circuit",
|
||||
.full_only = false,
|
||||
.setup = &busvoodoo_i2c_setup,
|
||||
.commands = busvoodoo_i2c_commands,
|
||||
.commands_nb = LENGTH(busvoodoo_i2c_commands),
|
||||
.exit = &busvoodoo_i2c_exit,
|
||||
};
|
||||
|
|
|
@ -20,4 +20,4 @@
|
|||
*/
|
||||
|
||||
/** I2C mode interface definition */
|
||||
extern struct busvoodoo_mode_t busvoodoo_i2c_mode;
|
||||
extern const struct busvoodoo_mode_t busvoodoo_i2c_mode;
|
||||
|
|
|
@ -252,6 +252,12 @@ static bool busvoodoo_spi_setup(char** prefix, const char* line)
|
|||
for (uint8_t i=0; i<LENGTH(pinout_io) && i<LENGTH(busvoodoo_global_pinout_io); i++) {
|
||||
busvoodoo_global_pinout_io[i] = pinout_io[i]; // set pin names
|
||||
}
|
||||
if (busvoodoo_full) {
|
||||
const char* pinout_rscan[5] = {"HV", NULL, NULL, NULL, NULL}; // HiZ mode RS/CAN pinout
|
||||
for (uint8_t i=0; i<LENGTH(pinout_rscan) && i<LENGTH(busvoodoo_global_pinout_rscan); i++) {
|
||||
busvoodoo_global_pinout_rscan[i] = pinout_rscan[i]; // set pin names
|
||||
}
|
||||
}
|
||||
busvoodoo_oled_text_pinout(pinout_io, true); // set pinout on display
|
||||
busvoodoo_oled_update(); // update display to show text and pinout
|
||||
complete = true; // configuration is complete
|
||||
|
@ -481,20 +487,21 @@ static void busvoodoo_spi_command_actions(void* argument)
|
|||
/** SPI menu commands */
|
||||
static const struct menu_command_t busvoodoo_spi_commands[] = {
|
||||
{
|
||||
'a',
|
||||
"action",
|
||||
"perform protocol actions",
|
||||
MENU_ARGUMENT_STRING,
|
||||
"[actions]",
|
||||
&busvoodoo_spi_command_actions,
|
||||
.shortcut = 'a',
|
||||
.name = "action",
|
||||
.command_description = "perform protocol actions",
|
||||
.argument = MENU_ARGUMENT_STRING,
|
||||
.argument_description = "[actions]",
|
||||
.command_handler = &busvoodoo_spi_command_actions,
|
||||
},
|
||||
};
|
||||
|
||||
struct busvoodoo_mode_t busvoodoo_spi_mode = {
|
||||
"spi",
|
||||
"Serial Peripheral Interface",
|
||||
&busvoodoo_spi_setup,
|
||||
busvoodoo_spi_commands,
|
||||
LENGTH(busvoodoo_spi_commands),
|
||||
&busvoodoo_spi_exit,
|
||||
const struct busvoodoo_mode_t busvoodoo_spi_mode = {
|
||||
.name = "spi",
|
||||
.description = "Serial Peripheral Interface",
|
||||
.full_only = false,
|
||||
.setup = &busvoodoo_spi_setup,
|
||||
.commands = busvoodoo_spi_commands,
|
||||
.commands_nb = LENGTH(busvoodoo_spi_commands),
|
||||
.exit = &busvoodoo_spi_exit,
|
||||
};
|
||||
|
|
|
@ -20,4 +20,4 @@
|
|||
*/
|
||||
|
||||
/** SPI mode interface definition */
|
||||
extern struct busvoodoo_mode_t busvoodoo_spi_mode;
|
||||
extern const struct busvoodoo_mode_t busvoodoo_spi_mode;
|
||||
|
|
|
@ -243,6 +243,12 @@ static bool busvoodoo_uart_setup(char** prefix, const char* line)
|
|||
for (uint8_t i=0; i<LENGTH(pinout_io) && i<LENGTH(busvoodoo_global_pinout_io); i++) {
|
||||
busvoodoo_global_pinout_io[i] = pinout_io[i]; // set pin names
|
||||
}
|
||||
if (busvoodoo_full) {
|
||||
const char* pinout_rscan[5] = {"HV", NULL, NULL, NULL, NULL}; // HiZ mode RS/CAN pinout
|
||||
for (uint8_t i=0; i<LENGTH(pinout_rscan) && i<LENGTH(busvoodoo_global_pinout_rscan); i++) {
|
||||
busvoodoo_global_pinout_rscan[i] = pinout_rscan[i]; // set pin names
|
||||
}
|
||||
}
|
||||
busvoodoo_oled_text_pinout((const char**)pinout_io, true); // set pinout on display
|
||||
busvoodoo_oled_update(); // update display to show text and pinout
|
||||
complete = true; // configuration is complete
|
||||
|
@ -636,52 +642,53 @@ static void busvoodoo_uart_command_error(void* argument)
|
|||
/** UART menu commands */
|
||||
static const struct menu_command_t busvoodoo_uart_commands[] = {
|
||||
{
|
||||
'a',
|
||||
"action",
|
||||
"perform protocol actions",
|
||||
MENU_ARGUMENT_STRING,
|
||||
"[actions]",
|
||||
&busvoodoo_uart_command_actions,
|
||||
.shortcut = 'a',
|
||||
.name = "action",
|
||||
.command_description = "perform protocol actions",
|
||||
.argument = MENU_ARGUMENT_STRING,
|
||||
.argument_description = "[actions]",
|
||||
.command_handler = &busvoodoo_uart_command_actions,
|
||||
},
|
||||
{
|
||||
'r',
|
||||
"receive",
|
||||
"show incoming data [in hexadecimal or binary]",
|
||||
MENU_ARGUMENT_STRING,
|
||||
"[hex|bin]",
|
||||
&busvoodoo_uart_command_receive,
|
||||
.shortcut = 'r',
|
||||
.name = "receive",
|
||||
.command_description = "show incoming data [in hexadecimal or binary]",
|
||||
.argument = MENU_ARGUMENT_STRING,
|
||||
.argument_description = "[hex|bin]",
|
||||
.command_handler = &busvoodoo_uart_command_receive,
|
||||
},
|
||||
{
|
||||
't',
|
||||
"transmit",
|
||||
"transmit ASCII text (empty for CR+LF)",
|
||||
MENU_ARGUMENT_STRING,
|
||||
"[text]",
|
||||
&busvoodoo_uart_command_transmit,
|
||||
.shortcut = 't',
|
||||
.name = "transmit",
|
||||
.command_description = "transmit ASCII text (empty for CR+LF)",
|
||||
.argument = MENU_ARGUMENT_STRING,
|
||||
.argument_description = "[text]",
|
||||
.command_handler = &busvoodoo_uart_command_transmit,
|
||||
},
|
||||
{
|
||||
'x',
|
||||
"transceive",
|
||||
"transmit and receive data",
|
||||
MENU_ARGUMENT_NONE,
|
||||
NULL,
|
||||
&busvoodoo_uart_command_transceive,
|
||||
.shortcut = 'x',
|
||||
.name = "transceive",
|
||||
.command_description = "transmit and receive data",
|
||||
.argument = MENU_ARGUMENT_NONE,
|
||||
.argument_description = NULL,
|
||||
.command_handler = &busvoodoo_uart_command_transceive,
|
||||
},
|
||||
{
|
||||
'e',
|
||||
"error",
|
||||
"verify incoming transmission for errors",
|
||||
MENU_ARGUMENT_NONE,
|
||||
NULL,
|
||||
&busvoodoo_uart_command_error,
|
||||
.shortcut = 'e',
|
||||
.name = "error",
|
||||
.command_description = "verify incoming transmission for errors",
|
||||
.argument = MENU_ARGUMENT_NONE,
|
||||
.argument_description = NULL,
|
||||
.command_handler = &busvoodoo_uart_command_error,
|
||||
},
|
||||
};
|
||||
|
||||
struct busvoodoo_mode_t busvoodoo_uart_mode = {
|
||||
"uart",
|
||||
"Universal Asynchronous Receiver-Transmitter",
|
||||
&busvoodoo_uart_setup,
|
||||
busvoodoo_uart_commands,
|
||||
LENGTH(busvoodoo_uart_commands),
|
||||
&busvoodoo_uart_exit,
|
||||
const struct busvoodoo_mode_t busvoodoo_uart_mode = {
|
||||
.name = "uart",
|
||||
.description = "Universal Asynchronous Receiver-Transmitter",
|
||||
.full_only = false,
|
||||
.setup = &busvoodoo_uart_setup,
|
||||
.commands = busvoodoo_uart_commands,
|
||||
.commands_nb = LENGTH(busvoodoo_uart_commands),
|
||||
.exit = &busvoodoo_uart_exit,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue