Skip to content

Commit

Permalink
Merge pull request #6103 from ladyada/main
Browse files Browse the repository at this point in the history
fix automatic i2c enablement with rev C
  • Loading branch information
dhalbert authored Mar 2, 2022
2 parents b1161f5 + 90c5fb2 commit 83cdfc4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion ports/espressif/boards/adafruit_feather_esp32s2/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,16 @@ bool board_requests_safe_mode(void) {

void reset_board(void) {
// Turn on I2C power by default.

// set pin to input to find 'rest state'
gpio_set_direction(7, GPIO_MODE_DEF_INPUT);
// wait 1 millis for pull to activate
mp_hal_delay_ms(1);
// read rest state (off)
bool restlevel = gpio_get_level(7);
gpio_set_direction(7, GPIO_MODE_DEF_OUTPUT);
gpio_set_level(7, false);
// flip it!
gpio_set_level(7, !restlevel);
}

void board_deinit(void) {
Expand Down
2 changes: 1 addition & 1 deletion ports/espressif/boards/adafruit_feather_esp32s2/pins.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) },

{ MP_ROM_QSTR(MP_QSTR_I2C_POWER_INVERTED), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_I2C_POWER), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) },

{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) },
Expand Down

0 comments on commit 83cdfc4

Please sign in to comment.