Skip to content

Commit 415553c

Browse files
committed
update i2c on sensebox mcu-s2
1 parent fc30c80 commit 415553c

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

ports/espressif/boards/sensebox_mcu_esp32s2/mpconfigboard.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,21 @@
3232
#define MICROPY_HW_NEOPIXEL (&pin_GPIO1)
3333

3434

35-
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO40)
36-
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO39)
35+
#define CIRCUITPY_I2C_ALLOW_INTERNAL_PULL_UP 1
36+
#define CIRCUITPY_I2C_ALLOW_STRAPPING_PINS 1
3737

38+
#define CIRCUITPY_BOARD_I2C (2)
39+
#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO40, .sda = &pin_GPIO39}, \
40+
{.scl = &pin_GPIO42, .sda = &pin_GPIO45}}
3841
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36)
3942
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35)
4043
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37)
4144

4245
#define DEFAULT_UART_BUS_RX (&pin_GPIO44)
4346
#define DEFAULT_UART_BUS_TX (&pin_GPIO43)
4447

45-
#define DOUBLE_TAP_PIN (&pin_GPIO0)
48+
#define CIRCUITPY_BOARD_SPI (1)
49+
#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO36, .mosi = &pin_GPIO35, .miso = &pin_GPIO37}}
50+
51+
#define CIRCUITPY_BOARD_UART (1)
52+
#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO43, .rx = &pin_GPIO44}}

ports/espressif/boards/sensebox_mcu_esp32s2/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m
1111

1212
CIRCUITPY_ESPCAMERA = 0
1313

14+
CIRCUITPY_REQUIRE_I2C_PULLUPS = 0
1415

1516
# Include these Python libraries in firmware.
1617
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel

ports/espressif/common-hal/busio/I2C.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,15 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
4040
// support I2C on these pins.
4141
//
4242
// 46 is also input-only so it'll never work.
43+
#if CIRCUITPY_I2C_ALLOW_STRAPPING_PINS
44+
if (scl->number == 46 || sda->number == 46) {
45+
raise_ValueError_invalid_pins();
46+
}
47+
#else
4348
if (scl->number == 45 || scl->number == 46 || sda->number == 45 || sda->number == 46) {
4449
raise_ValueError_invalid_pins();
4550
}
51+
#endif
4652

4753
#if CIRCUITPY_REQUIRE_I2C_PULLUPS
4854
// Test that the pins are in a high state. (Hopefully indicating they are pulled up.)

0 commit comments

Comments
 (0)