diff --git a/ports/stm32/main.c b/ports/stm32/main.c index 4553a07e28..460a19ccb1 100644 --- a/ports/stm32/main.c +++ b/ports/stm32/main.c @@ -505,7 +505,7 @@ void stm32_main(uint32_t reset_mode) { rtc_init_start(false); #endif spi_init0(); - #if MICROPY_HW_ENABLE_HW_I2C + #if MICROPY_PY_PYB_LEGACY && MICROPY_HW_ENABLE_HW_I2C i2c_init0(); #endif #if MICROPY_HW_HAS_SDCARD diff --git a/ports/stm32/modpyb.c b/ports/stm32/modpyb.c index 3438b12e8e..6357aca946 100644 --- a/ports/stm32/modpyb.c +++ b/ports/stm32/modpyb.c @@ -227,7 +227,7 @@ STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = { #if defined(MICROPY_HW_LED1) { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pyb_led_type) }, #endif - #if MICROPY_HW_ENABLE_HW_I2C + #if MICROPY_PY_PYB_LEGACY && MICROPY_HW_ENABLE_HW_I2C { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&pyb_i2c_type) }, #endif { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&pyb_spi_type) }, diff --git a/ports/stm32/pyb_i2c.c b/ports/stm32/pyb_i2c.c index db09f688bf..33aaa48cbb 100644 --- a/ports/stm32/pyb_i2c.c +++ b/ports/stm32/pyb_i2c.c @@ -35,7 +35,7 @@ #include "dma.h" #include "i2c.h" -#if MICROPY_HW_ENABLE_HW_I2C +#if MICROPY_PY_PYB_LEGACY && MICROPY_HW_ENABLE_HW_I2C /// \moduleref pyb /// \class I2C - a two-wire serial protocol @@ -1065,4 +1065,4 @@ const mp_obj_type_t pyb_i2c_type = { .locals_dict = (mp_obj_dict_t*)&pyb_i2c_locals_dict, }; -#endif // MICROPY_HW_ENABLE_HW_I2C +#endif // MICROPY_PY_PYB_LEGACY && MICROPY_HW_ENABLE_HW_I2C diff --git a/ports/stm32/stm32_it.c b/ports/stm32/stm32_it.c index db812958fb..a77802bfa4 100644 --- a/ports/stm32/stm32_it.c +++ b/ports/stm32/stm32_it.c @@ -776,6 +776,8 @@ void CAN2_SCE_IRQHandler(void) { } #endif +#if MICROPY_PY_PYB_LEGACY + #if defined(MICROPY_HW_I2C1_SCL) void I2C1_EV_IRQHandler(void) { IRQ_ENTER(I2C1_EV_IRQn); @@ -831,3 +833,5 @@ void I2C4_ER_IRQHandler(void) { IRQ_EXIT(I2C4_ER_IRQn); } #endif // defined(MICROPY_HW_I2C4_SCL) + +#endif // MICROPY_PY_PYB_LEGACY