fix automatic i2c enablement with rev C

This commit is contained in:
lady ada 2022-03-01 18:15:37 -05:00
parent b1161f5c4c
commit ee52795540
2 changed files with 10 additions and 1 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

@ -17,6 +17,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ 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) },