10000 Merge pull request #6103 from ladyada/main · adafruit/circuitpython@83cdfc4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 83cdfc4

Browse files
authored
Merge pull request #6103 from ladyada/main
fix automatic i2c enablement with rev C
2 parents b1161f5 + 90c5fb2 commit 83cdfc4

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

ports/espressif/boards/adafruit_feather_esp32s2/board.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,16 @@ bool board_requests_safe_mode(void) {
4141

4242
void reset_board(void) {
4343
// Turn on I2C power by default.
44+
45+
// set pin to input to find 'rest state'
46+
gpio_set_direction(7, GPIO_MODE_DEF_INPUT);
47+
// wait 1 millis for pull to activate
48+
mp_hal_delay_ms(1);
49+
// read rest state (off)
50+
bool restlevel = gpio_get_level(7);
4451
gpio_set_direction(7, GPIO_MODE_DEF_OUTPUT);
45-
gpio_set_level(7, false);
52+
// flip it!
53+
gpio_set_level(7, !restlevel);
4654
}
4755

4856
void board_deinit(void) {

ports/espressif/boards/adafruit_feather_esp32s2/pins.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
1616
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) },
1717
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) },
1818

19-
{ MP_ROM_QSTR(MP_QSTR_I2C_POWER_INVERTED), MP_ROM_PTR(&pin_GPIO7) },
19+
{ MP_ROM_QSTR(MP_QSTR_I2C_POWER), MP_ROM_PTR(&pin_GPIO7) },
2020
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) },
2121

2222
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) },

0 commit comments

Comments
 (0)
0