BV: fix pinout
This commit is contained in:
parent
fc8c73be49
commit
5ecea30801
|
@ -53,7 +53,7 @@ static bool busvoodoo_hiz_setup(char** prefix, const char* line)
|
|||
*prefix = "HiZ"; // set command line prefix
|
||||
led_blue(); // switch blue LED on to show we are ready
|
||||
busvoodoo_oled_text_left("HiZ"); // set mode title on OLED display
|
||||
const char* pinout_io[10] = {"GND", "3V3", "5V", "LV", NULL, NULL, NULL, NULL, NULL, NULL}; // HiZ mode I/O pinout
|
||||
const char* pinout_io[10] = {"GND", "5V", "3V3", "LV", NULL, NULL, NULL, NULL, NULL, NULL}; // HiZ mode I/O pinout
|
||||
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
|
||||
}
|
||||
|
|
|
@ -99,35 +99,33 @@ static bool busvoodoo_i2c_setup(char** prefix, const char* line)
|
|||
}
|
||||
}
|
||||
if (BUSVOODOO_I2C_SETTING_PULLUP==busvoodoo_i2c_setting) { // if next setting
|
||||
printf("i) embedded\n");
|
||||
printf("e) external\n");
|
||||
snprintf(busvoodoo_global_string, LENGTH(busvoodoo_global_string), "pull-up resistors (i,e) [%c]", busvoodoo_i2c_embedded_pullup ? 'i' : 'e'); // prepare next setting
|
||||
printf("1) open-drain, with embedded pull-up (2kO)\n");
|
||||
printf("2) open-drain, with external pull-up\n");
|
||||
snprintf(busvoodoo_global_string, LENGTH(busvoodoo_global_string), "drive mode (1,2) [%c]", busvoodoo_i2c_embedded_pullup ? '1' : '2'); // show drive mode
|
||||
*prefix = busvoodoo_global_string; // display next setting
|
||||
}
|
||||
break;
|
||||
case BUSVOODOO_I2C_SETTING_PULLUP:
|
||||
if (NULL==line || 0==strlen(line)) { // use default setting
|
||||
busvoodoo_i2c_setting = BUSVOODOO_I2C_SETTING_DONE; // go to next setting
|
||||
} else { // setting provided
|
||||
if (0==strcmp("i", line)) { // check setting
|
||||
busvoodoo_i2c_embedded_pullup = true; // remember setting
|
||||
busvoodoo_i2c_setting = BUSVOODOO_I2C_SETTING_DONE; // go to next setting
|
||||
} else if (0==strcmp("e", line)) {
|
||||
busvoodoo_i2c_embedded_pullup = false; // remember setting
|
||||
} else if (1==strlen(line)) { // setting provided
|
||||
uint8_t drive = atoi(line); // parse setting
|
||||
if (1==drive || 2==drive) { // check setting
|
||||
busvoodoo_i2c_embedded_pullup = (1==drive); // remember setting
|
||||
if (!busvoodoo_i2c_embedded_pullup) {
|
||||
printf("use LV to set voltage\n");
|
||||
}
|
||||
busvoodoo_i2c_setting = BUSVOODOO_I2C_SETTING_DONE; // go to next setting
|
||||
}
|
||||
}
|
||||
if (BUSVOODOO_I2C_SETTING_DONE==busvoodoo_i2c_setting) { // we have all settings, configure I2C
|
||||
i2c_master_setup(BUSVOODOO_I2C, false); // setup I2C
|
||||
busvoodoo_embedded_pullup(busvoodoo_i2c_embedded_pullup); // set pull-up
|
||||
if (busvoodoo_i2c_embedded_pullup) {
|
||||
printf("set pull-up voltage with LV\n");
|
||||
}
|
||||
led_off(); // disable LED because there is no activity
|
||||
busvoodoo_i2c_setting = BUSVOODOO_I2C_SETTING_NONE; // restart settings next time
|
||||
*prefix = "I2C"; // display mode
|
||||
busvoodoo_oled_text_left(*prefix); // set mode title on OLED display
|
||||
const char* pinout_io[10] = {"GND", "3V3", "5V", "LV", "SDA", "SCL", NULL, NULL}; // HiZ mode pinout
|
||||
const char* pinout_io[10] = {"GND", "5V", "3V3", "LV", "SDA", "SCL", NULL, NULL}; // HiZ mode pinout
|
||||
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
|
||||
}
|
||||
|
@ -162,7 +160,7 @@ static void busvoodoo_i2c_command_scan(void* argument)
|
|||
{
|
||||
(void)argument; // we won't use the argument
|
||||
if (!i2c_master_check_signals(BUSVOODOO_I2C)) { // ensure SCL and SDA are high
|
||||
printf("SCL or SDA is low. The signals need to be pulled up\n");
|
||||
printf("SCL or SDA is/are low. The signals need to be pulled up\n");
|
||||
if (busvoodoo_i2c_embedded_pullup) {
|
||||
printf("set pull-up voltage with LV\n");
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ static bool busvoodoo_spi_setup(char** prefix, const char* line)
|
|||
busvoodoo_spi_setting = BUSVOODOO_SPI_SETTING_NONE; // restart settings next time
|
||||
*prefix = "SPI"; // display mode
|
||||
busvoodoo_oled_text_left(*prefix); // set mode title on OLED display
|
||||
const char* pinout_io[10] = {"GND", "3V3", "5V", "LV", NULL, NULL, "MISO", "SCK", "MOSI", "SS"}; // SPI mode pinout
|
||||
const char* pinout_io[10] = {"GND", "5V", "3V3", "LV", NULL, NULL, "MISO", "SCK", "MOSI", "SS"}; // SPI mode pinout
|
||||
if (!busvoodoo_spi_duplex) {
|
||||
pinout_io[6] = NULL; // MISO is not used
|
||||
pinout_io[8] = "MOSIMISO"; // MOSI is also used as MISO
|
||||
|
|
|
@ -214,7 +214,7 @@ static bool busvoodoo_uart_setup(char** prefix, const char* line)
|
|||
busvoodoo_uart_setting = BUSVOODOO_UART_SETTING_NONE; // restart settings next time
|
||||
*prefix = "UART"; // display mode
|
||||
busvoodoo_oled_text_left("UART"); // set mode title on OLED display
|
||||
const char* pinout_io[10] = {"GND", "3V3", "5V", "LV", "Rx", "Tx", NULL, NULL, NULL, NULL}; // UART mode pinout
|
||||
const char* pinout_io[10] = {"GND", "5V", "3V3", "LV", "Rx", "Tx", NULL, NULL, NULL, NULL}; // UART mode pinout
|
||||
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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue