diff options
author | Damien George <damien@micropython.org> | 2025-08-07 10:33:26 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-08-07 10:33:26 +1000 |
commit | d5ecda05eb743839e9011f3d23657b39cd05e6c0 (patch) | |
tree | c053eedafc884d495fa97b6980005e85a058a565 | |
parent | 255d74b5a8c31ec06d1c2c528f7888f6c2dfc246 (diff) |
ports: Allow MICROPY_PY_MACHINE_I2C_TARGET to be disabled by board cfg.
Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r-- | ports/alif/mpconfigport.h | 2 | ||||
-rw-r--r-- | ports/esp32/mpconfigport.h | 2 | ||||
-rw-r--r-- | ports/mimxrt/mpconfigport.h | 2 | ||||
-rw-r--r-- | ports/rp2/mpconfigport.h | 2 | ||||
-rw-r--r-- | ports/stm32/mpconfigboard_common.h | 2 |
5 files changed, 10 insertions, 0 deletions
diff --git a/ports/alif/mpconfigport.h b/ports/alif/mpconfigport.h index a8c8c8429..8a65721bb 100644 --- a/ports/alif/mpconfigport.h +++ b/ports/alif/mpconfigport.h @@ -132,10 +132,12 @@ #define MICROPY_PY_MACHINE_PULSE (1) #define MICROPY_PY_MACHINE_I2C (MICROPY_HW_ENABLE_HW_I2C) #define MICROPY_PY_MACHINE_I2C_TRANSFER_WRITE1 (1) +#ifndef MICROPY_PY_MACHINE_I2C_TARGET #define MICROPY_PY_MACHINE_I2C_TARGET (MICROPY_HW_ENABLE_HW_I2C) #define MICROPY_PY_MACHINE_I2C_TARGET_INCLUDEFILE "ports/alif/machine_i2c_target.c" #define MICROPY_PY_MACHINE_I2C_TARGET_MAX (4) #define MICROPY_PY_MACHINE_I2C_TARGET_HARD_IRQ (1) +#endif #define MICROPY_PY_MACHINE_SOFTI2C (1) #define MICROPY_PY_MACHINE_SPI (1) #define MICROPY_PY_MACHINE_SOFTSPI (1) diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h index cc10fd0b7..e47b333c7 100644 --- a/ports/esp32/mpconfigport.h +++ b/ports/esp32/mpconfigport.h @@ -139,11 +139,13 @@ #define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/esp32/machine_pwm.c" #define MICROPY_PY_MACHINE_I2C (1) #define MICROPY_PY_MACHINE_I2C_TRANSFER_WRITE1 (1) +#ifndef MICROPY_PY_MACHINE_I2C_TARGET // I2C target hardware is limited on ESP32 (eg read event comes after the read) so we only support newer SoCs. // ESP32C6 does not have enough flash space so also disable it on that SoC. #define MICROPY_PY_MACHINE_I2C_TARGET (SOC_I2C_SUPPORT_SLAVE && !CONFIG_IDF_TARGET_ESP32 && !CONFIG_IDF_TARGET_ESP32C6) #define MICROPY_PY_MACHINE_I2C_TARGET_INCLUDEFILE "ports/esp32/machine_i2c_target.c" #define MICROPY_PY_MACHINE_I2C_TARGET_MAX (2) +#endif #define MICROPY_PY_MACHINE_SOFTI2C (1) #define MICROPY_PY_MACHINE_SPI (1) #define MICROPY_PY_MACHINE_SOFTSPI (1) diff --git a/ports/mimxrt/mpconfigport.h b/ports/mimxrt/mpconfigport.h index 8ceb3b418..3cf6550d7 100644 --- a/ports/mimxrt/mpconfigport.h +++ b/ports/mimxrt/mpconfigport.h @@ -92,11 +92,13 @@ uint32_t trng_random_u32(void); #define MICROPY_PY_MACHINE_PWM (1) #define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/mimxrt/machine_pwm.c" #define MICROPY_PY_MACHINE_I2C (1) +#ifndef MICROPY_PY_MACHINE_I2C_TARGET #define MICROPY_PY_MACHINE_I2C_TARGET (1) #define MICROPY_PY_MACHINE_I2C_TARGET_INCLUDEFILE "ports/mimxrt/machine_i2c_target.c" #define MICROPY_PY_MACHINE_I2C_TARGET_MAX (FSL_FEATURE_SOC_LPI2C_COUNT) #define MICROPY_PY_MACHINE_I2C_TARGET_HARD_IRQ (1) #define MICROPY_PY_MACHINE_I2C_TARGET_FINALISER (1) +#endif #ifndef MICROPY_PY_MACHINE_I2S #define MICROPY_PY_MACHINE_I2S (0) #endif diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h index d35563bd0..c312293ac 100644 --- a/ports/rp2/mpconfigport.h +++ b/ports/rp2/mpconfigport.h @@ -171,10 +171,12 @@ #define MICROPY_PY_MACHINE_PWM (1) #define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/rp2/machine_pwm.c" #define MICROPY_PY_MACHINE_I2C (1) +#ifndef MICROPY_PY_MACHINE_I2C_TARGET #define MICROPY_PY_MACHINE_I2C_TARGET (1) #define MICROPY_PY_MACHINE_I2C_TARGET_INCLUDEFILE "ports/rp2/machine_i2c_target.c" #define MICROPY_PY_MACHINE_I2C_TARGET_MAX (2) #define MICROPY_PY_MACHINE_I2C_TARGET_HARD_IRQ (1) +#endif #define MICROPY_PY_MACHINE_SOFTI2C (1) #define MICROPY_PY_MACHINE_I2S (1) #define MICROPY_PY_MACHINE_I2S_INCLUDEFILE "ports/rp2/machine_i2s.c" diff --git a/ports/stm32/mpconfigboard_common.h b/ports/stm32/mpconfigboard_common.h index dcbbbccce..a8e50be5c 100644 --- a/ports/stm32/mpconfigboard_common.h +++ b/ports/stm32/mpconfigboard_common.h @@ -639,11 +639,13 @@ #if defined(MICROPY_HW_I2C1_SCL) || defined(MICROPY_HW_I2C2_SCL) \ || defined(MICROPY_HW_I2C3_SCL) || defined(MICROPY_HW_I2C4_SCL) #define MICROPY_HW_ENABLE_HW_I2C (1) +#ifndef MICROPY_HW_ENABLE_HW_I2C_TARGET #if defined(STM32F4) || defined(STM32F7) || defined(STM32H7) || defined(STM32WB) #define MICROPY_HW_ENABLE_HW_I2C_TARGET (1) #else #define MICROPY_HW_ENABLE_HW_I2C_TARGET (0) #endif +#endif #else #define MICROPY_HW_ENABLE_HW_I2C (0) #define MICROPY_HW_ENABLE_HW_I2C_TARGET (0) |