diff --git a/lib/busvoodoo_global.h b/lib/busvoodoo_global.h index 5c95f64..30aafc3 100644 --- a/lib/busvoodoo_global.h +++ b/lib/busvoodoo_global.h @@ -104,6 +104,9 @@ #define BUSVOODOO_HW_VERSION_CHANNEL 8 /**< ADC to identify hardware version */ /** @} */ +/** recommended duration in ms for pulsing LEDs to show activity */ +#define BUSVOODOO_LED_PULSE 100 + /** BusVoodoo mode interface */ struct busvoodoo_mode_t { const char* name; /**< name of the mode (i.e. protocol shortcut for the menu) */ diff --git a/lib/busvoodoo_i2c.c b/lib/busvoodoo_i2c.c index 710ce57..c98232f 100644 --- a/lib/busvoodoo_i2c.c +++ b/lib/busvoodoo_i2c.c @@ -119,7 +119,7 @@ static bool busvoodoo_i2c_setup(char** prefix, const char* line) i2c_master_setup(BUSVOODOO_I2C, busvoodoo_i2c_speed); // setup I2C if (busvoodoo_i2c_embedded_pullup) { busvoodoo_embedded_pullup(true); // set pull-up - printf("use LV to set voltage\n"); + printf("use LV to set pull-up voltage\n"); } led_off(); // disable LED because there is no activity busvoodoo_i2c_setting = BUSVOODOO_I2C_SETTING_NONE; // restart settings next time @@ -155,7 +155,7 @@ static void busvoodoo_i2c_exit(void) static void busvoodoo_i2c_read(void) { printf("read: "); - busvoodoo_blue_blue(100); // pulse blue LED to show we read data + busvoodoo_led_blue_pulse(BUSVOODOO_LED_PULSE); // pulse blue LED to show we read data uint8_t data; // to store the data read switch (i2c_master_read(BUSVOODOO_I2C, &data, 1)) { case I2C_MASTER_RC_NONE: // all went fine @@ -182,7 +182,7 @@ static void busvoodoo_i2c_read(void) static void busvoodoo_i2c_write(uint8_t data) { printf("write 0x%02x: ", data); - busvoodoo_red_blue(100); // pulse red LED to show we send data + busvoodoo_led_red_pulse(BUSVOODOO_LED_PULSE); // pulse red LED to show we send data switch (i2c_master_write(BUSVOODOO_I2C, &data, 1)) { case I2C_MASTER_RC_NONE: // all went fine printf("ack"); @@ -218,7 +218,7 @@ static void busvoodoo_i2c_select(uint16_t slave, bool write) printf("0x%02x", slave); } printf(" to %s: ", write ? "write" : "read"); - busvoodoo_red_blue(100); // pulse red LED to show we send the slave address + busvoodoo_led_red_pulse(BUSVOODOO_LED_PULSE); // pulse red LED to show we send the slave address switch (i2c_master_select_slave(BUSVOODOO_I2C, slave, 10==busvoodoo_i2c_addressbits, write)) { case I2C_MASTER_RC_NONE: // all went fine printf("selected"); @@ -267,7 +267,7 @@ static bool busvoodoo_i2c_action(const char* action, uint32_t repetition, bool p } printf("send start condition: "); for (uint32_t i=0; i7) ? "0x%03x " : "0x%02x ", address); // display address i2c_slaves++; // increase slave count break;