Merge pull request #6103 from ladyada/main

fix automatic i2c enablement with rev C
This commit is contained in:
Dan Halbert 2022-03-01 20:21:20 -05:00 committed by GitHub
commit 83cdfc42cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -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) {

View File

@ -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) },