From d8f4731d65a002e9cf7f854020e70fc7ef4c9b59 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 30 May 2024 18:20:58 +0100 Subject: [PATCH] move-I2C-reset-via-GPIO9-from-python-into-tildagon_i2c --- drivers/tildagon_i2c/tildagon_i2c.c | 4 ++++ modules/tildagonos.py | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/tildagon_i2c/tildagon_i2c.c b/drivers/tildagon_i2c/tildagon_i2c.c index 25cd2d6..bd03977 100644 --- a/drivers/tildagon_i2c/tildagon_i2c.c +++ b/drivers/tildagon_i2c/tildagon_i2c.c @@ -35,6 +35,7 @@ #include "driver/i2c.h" #include "hal/i2c_ll.h" +#include "driver/gpio.h" #include "tildagon_i2c.h" @@ -85,6 +86,9 @@ void tildagon_i2c_init() { int timeout = I2C_SCLK_FREQ / 1000000 * TILDAGON_HOST_I2C_TIMEOUT; i2c_set_timeout(TILDAGON_HOST_I2C_PORT, (timeout > I2C_LL_MAX_TIMEOUT) ? I2C_LL_MAX_TIMEOUT : timeout); i2c_driver_install(TILDAGON_HOST_I2C_PORT, I2C_MODE_MASTER, 0, 0, 0); + // reset I2C + gpio_set_direction(GPIO_NUM_9, GPIO_MODE_OUTPUT); + gpio_set_level(GPIO_NUM_9, 1); } diff --git a/modules/tildagonos.py b/modules/tildagonos.py index 48d8f12..92e0266 100644 --- a/modules/tildagonos.py +++ b/modules/tildagonos.py @@ -23,8 +23,6 @@ class _tildagonos: def __init__(self): - self.pin_reset_i2c = Pin(9, Pin.OUT) - self.pin_reset_i2c.on() self.system_i2c = I2C(7) self.init_gpio() self.leds = neopixel.NeoPixel(Pin(21), 19)