diff --git a/micropython/modules/breakout_as7262/breakout_as7262.cpp b/micropython/modules/breakout_as7262/breakout_as7262.cpp index deecafc3..a0dd8621 100644 --- a/micropython/modules/breakout_as7262/breakout_as7262.cpp +++ b/micropython/modules/breakout_as7262/breakout_as7262.cpp @@ -62,7 +62,7 @@ mp_obj_t BreakoutAS7262_make_new(const mp_obj_type_t *type, size_t n_args, size_ int scl = args[ARG_scl].u_int; if(i2c_id == -1) { - i2c_id = sda & 1; + i2c_id = (sda >> 1) & 0b1; // If no i2c specified, choose the one for the given SDA pin } if(i2c_id < 0 || i2c_id > 1) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%d) doesn't exist"), i2c_id); diff --git a/micropython/modules/breakout_dotmatrix/breakout_dotmatrix.cpp b/micropython/modules/breakout_dotmatrix/breakout_dotmatrix.cpp index 0f961745..f8205c37 100644 --- a/micropython/modules/breakout_dotmatrix/breakout_dotmatrix.cpp +++ b/micropython/modules/breakout_dotmatrix/breakout_dotmatrix.cpp @@ -65,7 +65,7 @@ mp_obj_t BreakoutDotMatrix_make_new(const mp_obj_type_t *type, size_t n_args, si int scl = args[ARG_scl].u_int; if(i2c_id == -1) { - i2c_id = sda & 1; + i2c_id = (sda >> 1) & 0b1; // If no i2c specified, choose the one for the given SDA pin } if(i2c_id < 0 || i2c_id > 1) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%d) doesn't exist"), i2c_id); diff --git a/micropython/modules/breakout_encoder/breakout_encoder.cpp b/micropython/modules/breakout_encoder/breakout_encoder.cpp index 8b8fe3de..8d30b1bc 100644 --- a/micropython/modules/breakout_encoder/breakout_encoder.cpp +++ b/micropython/modules/breakout_encoder/breakout_encoder.cpp @@ -69,7 +69,7 @@ mp_obj_t BreakoutEncoder_make_new(const mp_obj_type_t *type, size_t n_args, size int scl = args[ARG_scl].u_int; if(i2c_id == -1) { - i2c_id = sda & 1; + i2c_id = (sda >> 1) & 0b1; // If no i2c specified, choose the one for the given SDA pin } if(i2c_id < 0 || i2c_id > 1) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%d) doesn't exist"), i2c_id); diff --git a/micropython/modules/breakout_ioexpander/breakout_ioexpander.cpp b/micropython/modules/breakout_ioexpander/breakout_ioexpander.cpp index ef4135aa..272405be 100644 --- a/micropython/modules/breakout_ioexpander/breakout_ioexpander.cpp +++ b/micropython/modules/breakout_ioexpander/breakout_ioexpander.cpp @@ -69,7 +69,7 @@ mp_obj_t BreakoutIOExpander_make_new(const mp_obj_type_t *type, size_t n_args, s int scl = args[ARG_scl].u_int; if(i2c_id == -1) { - i2c_id = sda & 1; + i2c_id = (sda >> 1) & 0b1; // If no i2c specified, choose the one for the given SDA pin } if(i2c_id < 0 || i2c_id > 1) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%d) doesn't exist"), i2c_id); diff --git a/micropython/modules/breakout_ltr559/breakout_ltr559.cpp b/micropython/modules/breakout_ltr559/breakout_ltr559.cpp index 1130c83a..645df5a1 100644 --- a/micropython/modules/breakout_ltr559/breakout_ltr559.cpp +++ b/micropython/modules/breakout_ltr559/breakout_ltr559.cpp @@ -69,7 +69,7 @@ mp_obj_t BreakoutLTR559_make_new(const mp_obj_type_t *type, size_t n_args, size_ int scl = args[ARG_scl].u_int; if(i2c_id == -1) { - i2c_id = sda & 1; + i2c_id = (sda >> 1) & 0b1; // If no i2c specified, choose the one for the given SDA pin } if(i2c_id < 0 || i2c_id > 1) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%d) doesn't exist"), i2c_id); diff --git a/micropython/modules/breakout_mics6814/breakout_mics6814.cpp b/micropython/modules/breakout_mics6814/breakout_mics6814.cpp index 800a5440..5579c016 100644 --- a/micropython/modules/breakout_mics6814/breakout_mics6814.cpp +++ b/micropython/modules/breakout_mics6814/breakout_mics6814.cpp @@ -69,7 +69,7 @@ mp_obj_t BreakoutMICS6814_make_new(const mp_obj_type_t *type, size_t n_args, siz int scl = args[ARG_scl].u_int; if(i2c_id == -1) { - i2c_id = sda & 1; + i2c_id = (sda >> 1) & 0b1; // If no i2c specified, choose the one for the given SDA pin } if(i2c_id < 0 || i2c_id > 1) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%d) doesn't exist"), i2c_id); diff --git a/micropython/modules/breakout_msa301/breakout_msa301.cpp b/micropython/modules/breakout_msa301/breakout_msa301.cpp index 7f7db729..a59628ef 100644 --- a/micropython/modules/breakout_msa301/breakout_msa301.cpp +++ b/micropython/modules/breakout_msa301/breakout_msa301.cpp @@ -62,7 +62,7 @@ mp_obj_t BreakoutMSA301_make_new(const mp_obj_type_t *type, size_t n_args, size_ int scl = args[ARG_scl].u_int; if(i2c_id == -1) { - i2c_id = sda & 1; + i2c_id = (sda >> 1) & 0b1; // If no i2c specified, choose the one for the given SDA pin } if(i2c_id < 0 || i2c_id > 1) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%d) doesn't exist"), i2c_id); diff --git a/micropython/modules/breakout_potentiometer/breakout_potentiometer.cpp b/micropython/modules/breakout_potentiometer/breakout_potentiometer.cpp index 5cbfb3e3..2812a161 100644 --- a/micropython/modules/breakout_potentiometer/breakout_potentiometer.cpp +++ b/micropython/modules/breakout_potentiometer/breakout_potentiometer.cpp @@ -69,7 +69,7 @@ mp_obj_t BreakoutPotentiometer_make_new(const mp_obj_type_t *type, size_t n_args int scl = args[ARG_scl].u_int; if(i2c_id == -1) { - i2c_id = sda & 1; + i2c_id = (sda >> 1) & 0b1; // If no i2c specified, choose the one for the given SDA pin } if(i2c_id < 0 || i2c_id > 1) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%d) doesn't exist"), i2c_id); diff --git a/micropython/modules/breakout_rgbmatrix5x5/breakout_rgbmatrix5x5.cpp b/micropython/modules/breakout_rgbmatrix5x5/breakout_rgbmatrix5x5.cpp index d2531281..3057e507 100644 --- a/micropython/modules/breakout_rgbmatrix5x5/breakout_rgbmatrix5x5.cpp +++ b/micropython/modules/breakout_rgbmatrix5x5/breakout_rgbmatrix5x5.cpp @@ -65,7 +65,7 @@ mp_obj_t BreakoutRGBMatrix5x5_make_new(const mp_obj_type_t *type, size_t n_args, int scl = args[ARG_scl].u_int; if(i2c_id == -1) { - i2c_id = sda & 1; + i2c_id = (sda >> 1) & 0b1; // If no i2c specified, choose the one for the given SDA pin } if(i2c_id < 0 || i2c_id > 1) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%d) doesn't exist"), i2c_id); diff --git a/micropython/modules/breakout_rtc/breakout_rtc.cpp b/micropython/modules/breakout_rtc/breakout_rtc.cpp index 4c55b897..d36df64d 100644 --- a/micropython/modules/breakout_rtc/breakout_rtc.cpp +++ b/micropython/modules/breakout_rtc/breakout_rtc.cpp @@ -65,7 +65,7 @@ mp_obj_t BreakoutRTC_make_new(const mp_obj_type_t *type, size_t n_args, size_t n int scl = args[ARG_scl].u_int; if(i2c_id == -1) { - i2c_id = sda & 1; + i2c_id = (sda >> 1) & 0b1; // If no i2c specified, choose the one for the given SDA pin } if(i2c_id < 0 || i2c_id > 1) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%d) doesn't exist"), i2c_id); diff --git a/micropython/modules/breakout_sgp30/breakout_sgp30.cpp b/micropython/modules/breakout_sgp30/breakout_sgp30.cpp index 590c6c14..7812b4a1 100644 --- a/micropython/modules/breakout_sgp30/breakout_sgp30.cpp +++ b/micropython/modules/breakout_sgp30/breakout_sgp30.cpp @@ -58,7 +58,7 @@ mp_obj_t BreakoutSGP30_make_new(const mp_obj_type_t *type, size_t n_args, size_t int scl = args[ARG_scl].u_int; if(i2c_id == -1) { - i2c_id = sda & 1; + i2c_id = (sda >> 1) & 0b1; // If no i2c specified, choose the one for the given SDA pin } if(i2c_id < 0 || i2c_id > 1) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%d) doesn't exist"), i2c_id); diff --git a/micropython/modules/breakout_trackball/breakout_trackball.cpp b/micropython/modules/breakout_trackball/breakout_trackball.cpp index 357b9a7a..81b23f3c 100644 --- a/micropython/modules/breakout_trackball/breakout_trackball.cpp +++ b/micropython/modules/breakout_trackball/breakout_trackball.cpp @@ -69,7 +69,7 @@ mp_obj_t BreakoutTrackball_make_new(const mp_obj_type_t *type, size_t n_args, si int scl = args[ARG_scl].u_int; if(i2c_id == -1) { - i2c_id = sda & 1; + i2c_id = (sda >> 1) & 0b1; // If no i2c specified, choose the one for the given SDA pin } if(i2c_id < 0 || i2c_id > 1) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%d) doesn't exist"), i2c_id);