From bdef79c4f91381c319eabffa73dffdd3a84e510a Mon Sep 17 00:00:00 2001 From: lady ada Date: Tue, 22 Mar 2022 15:50:30 -0400 Subject: [PATCH] power is enabled by the board variant, we dont need to do it manually --- .../BME280_LC709203_Adafruit_IO/code.py | 9 ++++----- .../BME280_LC709203_Simple_Data/code.py | 5 ----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Adafruit_Feather_ESP32-S2/BME280_LC709203_Adafruit_IO/code.py b/Adafruit_Feather_ESP32-S2/BME280_LC709203_Adafruit_IO/code.py index c003f90f8..89afbed03 100644 --- a/Adafruit_Feather_ESP32-S2/BME280_LC709203_Adafruit_IO/code.py +++ b/Adafruit_Feather_ESP32-S2/BME280_LC709203_Adafruit_IO/code.py @@ -33,11 +33,6 @@ battery_pack_size = PackSize.MAH400 led = digitalio.DigitalInOut(board.LED) led.switch_to_output() -# Pull the I2C power pin low -i2c_power = digitalio.DigitalInOut(board.I2C_POWER_INVERTED) -i2c_power.switch_to_output() -i2c_power.value = False - # Set up the BME280 and LC709203 sensors bme280 = adafruit_bme280.Adafruit_BME280_I2C(board.I2C()) battery_monitor = LC709203F(board.I2C()) @@ -53,6 +48,10 @@ battery_percent = "{:.1f}".format(battery_monitor.cell_percent) def go_to_sleep(sleep_period): + # Turn off I2C power by setting it to input + i2c_power = digitalio.DigitalInOut(board.I2C_POWER) + i2c_power.switch_to_input() + # Create a an alarm that will trigger sleep_period number of seconds from now. time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + sleep_period) # Exit and deep sleep until the alarm wakes us. diff --git a/Adafruit_Feather_ESP32-S2/BME280_LC709203_Simple_Data/code.py b/Adafruit_Feather_ESP32-S2/BME280_LC709203_Simple_Data/code.py index 5e390b577..debfcf3c2 100644 --- a/Adafruit_Feather_ESP32-S2/BME280_LC709203_Simple_Data/code.py +++ b/Adafruit_Feather_ESP32-S2/BME280_LC709203_Simple_Data/code.py @@ -9,11 +9,6 @@ import digitalio from adafruit_bme280 import basic as adafruit_bme280 from adafruit_lc709203f import LC709203F, PackSize -# Pull the I2C power pin low -i2c_power = digitalio.DigitalInOut(board.I2C_POWER_INVERTED) -i2c_power.switch_to_output() -i2c_power.value = False - # Create sensor objects, using the board's default I2C bus. i2c = board.I2C() bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)