stm32/pyb_i2c: Put pyb.I2C under MICROPY_PY_PYB_LEGACY setting.
When disabled, the pyb.I2C class saves around 8k of code space and 172 bytes of RAM. The same functionality is now available in machine.I2C (for F4 and F7 MCUs). It is still enabled by default.
This commit is contained in:
parent
92c5e2708d
commit
88c26a48b4
@ -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
|
||||
|
@ -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) },
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user