diff --git a/lib/busvoodoo_i2c.c b/lib/busvoodoo_i2c.c index c831dac..d6b8d48 100644 --- a/lib/busvoodoo_i2c.c +++ b/lib/busvoodoo_i2c.c @@ -459,9 +459,14 @@ static bool busvoodoo_i2c_action(const char* action, uint32_t repetition, bool p static void busvoodoo_i2c_command_reset(void* argument) { (void)argument; // we won't use the argument - i2c_master_reset(BUSVOODOO_I2C); // reset the I2C peripheral since it might be stuck - i2c_master_setup(BUSVOODOO_I2C, busvoodoo_i2c_speed); // re-setup I2C - printf("I2C peripheral reset\n"); + if (!i2c_master_reset(BUSVOODOO_I2C)) { // reset the I2C peripheral since it might be stuck + busvoodoo_text_style(BUSVOODOO_TEXT_STYLE_WARNING); + printf("reset failed: check the SDA/SCL lines and retry"); + busvoodoo_text_style(BUSVOODOO_TEXT_STYLE_RESET); + } else { + i2c_master_setup(BUSVOODOO_I2C, busvoodoo_i2c_speed); // re-setup I2C + printf("I2C peripheral reset\n"); + } }