busvoodoo: add HiZ commands
This commit is contained in:
parent
c9c017ac29
commit
3e210ae720
|
@ -135,7 +135,7 @@ static void command_help(void* argument)
|
||||||
(void)argument; // we won't use the argument
|
(void)argument; // we won't use the argument
|
||||||
printf("available commands:\n");
|
printf("available commands:\n");
|
||||||
menu_print_commands(menu_commands, LENGTH(menu_commands)); // print global commands
|
menu_print_commands(menu_commands, LENGTH(menu_commands)); // print global commands
|
||||||
// menu_print_commands(busvoodoo_hiz_commands, LENGTH(busvoodoo_hiz_commands)); // print BusVoodoo HiZ commands
|
menu_print_commands(busvoodoo_hiz_commands, LENGTH(busvoodoo_hiz_commands)); // print BusVoodoo HiZ commands
|
||||||
}
|
}
|
||||||
|
|
||||||
static void command_led(void* argument)
|
static void command_led(void* argument)
|
||||||
|
@ -190,59 +190,11 @@ static void process_command(char* str)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// handle user input
|
// handle user input
|
||||||
// if (!menu_handle_command(str, busvoodoo_hiz_commands, LENGTH(busvoodoo_hiz_commands))) {
|
if (!menu_handle_command(str, busvoodoo_hiz_commands, LENGTH(busvoodoo_hiz_commands))) {
|
||||||
if (!menu_handle_command(str, menu_commands, LENGTH(menu_commands))) {
|
if (!menu_handle_command(str, menu_commands, LENGTH(menu_commands))) {
|
||||||
printf("command not recognized. enter help to list commands\n");
|
printf("command not recognized. enter help to list commands\n");
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
return;
|
|
||||||
// split command
|
|
||||||
const char* delimiter = " ";
|
|
||||||
char* word = strtok(str,delimiter);
|
|
||||||
if (!word) {
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
// parse command
|
|
||||||
if (0==strcmp(word,"h") || 0==strcmp(word,"help") || 0==strcmp(word,"?")) {
|
|
||||||
printf("s|self-test perform self-test\n");
|
|
||||||
printf("p|pin-test perform pin test\n");
|
|
||||||
} else if (0==strcmp(word,"s") || 0==strcmp(word,"self_-test")) {
|
|
||||||
printf("performing self-test\n");
|
|
||||||
printf("remove all cables from connectors and press space to start\n");
|
|
||||||
if (wait_space()) {
|
|
||||||
if (busvoodoo_hiz_test_self()) { // perform self-test
|
|
||||||
led_blink(0, 1.0); // show blue OK LED
|
|
||||||
printf("self-test succeeded\n"); // notify user
|
|
||||||
} else {
|
|
||||||
led_blink(0.5, 0.5); // show error on LEDs
|
|
||||||
printf("self-test failed\n"); // notify user
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
printf("self-test aborted\n");
|
|
||||||
}
|
|
||||||
} else if (0==strcmp(word,"p") || 0==strcmp(word,"pin-test")) {
|
|
||||||
printf("performing pin test\n");
|
|
||||||
printf("test will proceed automatically once the connection is detected\n");
|
|
||||||
printf("remove all cables from connectors and press space to start\n");
|
|
||||||
if (wait_space()) {
|
|
||||||
if (busvoodoo_hiz_test_self()) { // perform self-test
|
|
||||||
led_blink(0, 1.0); // show blue OK LED
|
|
||||||
printf("pin test succeeded\n"); // notify user
|
|
||||||
} else {
|
|
||||||
led_blink(0.5, 0.5); // show error on LEDs
|
|
||||||
printf("pin test failed\n"); // notify user
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
printf("pin :test aborted\n");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return; // command successfully processed
|
|
||||||
error:
|
|
||||||
printf("command not recognized. enter help to list commands\n");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** program entry point
|
/** program entry point
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
/* own libraries */
|
/* own libraries */
|
||||||
#include "global.h" // board definitions
|
#include "global.h" // board definitions
|
||||||
#include "print.h" // printing utilities
|
#include "print.h" // printing utilities
|
||||||
|
#include "menu.h" // menu definitions
|
||||||
#include "busvoodoo_global.h" // BusVoodoo definitions
|
#include "busvoodoo_global.h" // BusVoodoo definitions
|
||||||
#include "busvoodoo_hiz.h" // own definitions
|
#include "busvoodoo_hiz.h" // own definitions
|
||||||
|
|
||||||
|
@ -39,7 +40,10 @@
|
||||||
#define BUSVOODOO_12V_DEFAULT (1.25*(1+100.0/10.0)) /**< default (when not driven) 12V voltage regulator output voltage based on R1 and R2 */
|
#define BUSVOODOO_12V_DEFAULT (1.25*(1+100.0/10.0)) /**< default (when not driven) 12V voltage regulator output voltage based on R1 and R2 */
|
||||||
#define BUSVOODOO_12V_TEST 12.0 /**< target 12V output voltage to test if we can set control the 12V voltage regulator */
|
#define BUSVOODOO_12V_TEST 12.0 /**< target 12V output voltage to test if we can set control the 12V voltage regulator */
|
||||||
|
|
||||||
bool busvoodoo_hiz_test_self(void)
|
/** perform self tests
|
||||||
|
* @return if self tests passed
|
||||||
|
*/
|
||||||
|
static bool busvoodoo_hiz_test_self(void)
|
||||||
{
|
{
|
||||||
bool to_return = false; // success of the self-test
|
bool to_return = false; // success of the self-test
|
||||||
busvoodoo_safe_state(); // start from a safe state
|
busvoodoo_safe_state(); // start from a safe state
|
||||||
|
@ -404,7 +408,10 @@ error:
|
||||||
return to_return;
|
return to_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool busvoodoo_hiz_test_pins(void)
|
/** test if signals are soldered correctly to the connector pins
|
||||||
|
* @return if pin test passed
|
||||||
|
*/
|
||||||
|
static bool busvoodoo_hiz_test_pins(void)
|
||||||
{
|
{
|
||||||
bool to_return = false; // test result to return
|
bool to_return = false; // test result to return
|
||||||
busvoodoo_safe_state(); // start from safe state with all outputs switched off
|
busvoodoo_safe_state(); // start from safe state with all outputs switched off
|
||||||
|
@ -605,3 +612,66 @@ error:
|
||||||
return to_return;
|
return to_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// command handlers
|
||||||
|
/** command to perform board self-test
|
||||||
|
* @param[in] argument no argument required
|
||||||
|
*/
|
||||||
|
static void busvoodoo_hiz_command_test_self(void* argument)
|
||||||
|
{
|
||||||
|
(void)argument; // we won't use the argument
|
||||||
|
printf("performing self-test\n");
|
||||||
|
printf("remove all cables from connectors\n");
|
||||||
|
if (wait_space()) {
|
||||||
|
if (busvoodoo_hiz_test_self()) { // perform self-test
|
||||||
|
led_blink(0, 1.0); // show blue OK LED
|
||||||
|
printf("self-test succeeded\n"); // notify user
|
||||||
|
} else {
|
||||||
|
led_blink(0.5, 0.5); // show error on LEDs
|
||||||
|
printf("self-test failed\n"); // notify user
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf("self-test aborted\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** command to perform pins test
|
||||||
|
* @param[in] argument no argument required
|
||||||
|
*/
|
||||||
|
static void busvoodoo_hiz_command_test_pins(void* argument)
|
||||||
|
{
|
||||||
|
(void)argument; // we won't use the argument
|
||||||
|
printf("performing pins test\n");
|
||||||
|
printf("remove all cables from connectors\n");
|
||||||
|
if (wait_space()) {
|
||||||
|
if (busvoodoo_hiz_test_pins()) { // perform pin test
|
||||||
|
led_blink(0, 1.0); // show blue OK LED
|
||||||
|
printf("pin test succeeded\n"); // notify user
|
||||||
|
} else {
|
||||||
|
led_blink(0.5, 0.5); // show error on LEDs
|
||||||
|
printf("pin test failed\n"); // notify user
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf("pin test aborted\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const struct menu_command_t busvoodoo_hiz_commands[] = {
|
||||||
|
{
|
||||||
|
's',
|
||||||
|
"self-test",
|
||||||
|
"perform board self-test",
|
||||||
|
MENU_ARGUMENT_NONE,
|
||||||
|
NULL,
|
||||||
|
&busvoodoo_hiz_command_test_self,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'p',
|
||||||
|
"pins-test",
|
||||||
|
"perform connector pins test",
|
||||||
|
MENU_ARGUMENT_NONE,
|
||||||
|
NULL,
|
||||||
|
&busvoodoo_hiz_command_test_pins,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t busvoodoo_hiz_commands_length = LENGTH(busvoodoo_hiz_commands);
|
||||||
|
|
|
@ -18,12 +18,5 @@
|
||||||
* @date 2018
|
* @date 2018
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** perform self tests
|
/** list of supported commands */
|
||||||
* @return if self tests passed
|
extern const struct menu_command_t busvoodoo_hiz_commands[2];
|
||||||
*/
|
|
||||||
bool busvoodoo_hiz_test_self(void);
|
|
||||||
/** test if signals are soldered correctly to the connector pins
|
|
||||||
* @return if pin test passed
|
|
||||||
*/
|
|
||||||
bool busvoodoo_hiz_test_pins(void);
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue