diff --git a/components/axp2101/axp2101.cpp b/components/axp2101/axp2101.cpp index 7bd96ac..a3e904f 100644 --- a/components/axp2101/axp2101.cpp +++ b/components/axp2101/axp2101.cpp @@ -21,9 +21,12 @@ bool pmu_flag = 0; XPowersPMU PMU; -const uint8_t i2c_sda = CONFIG_PMU_SDA; -const uint8_t i2c_scl = CONFIG_PMU_SCL; +//const uint8_t i2c_sda = CONFIG_PMU_SDA; +//const uint8_t i2c_scl = CONFIG_PMU_SCL; +#ifdef USE_ARDUINO +// TODO: Use esphome APIs (to allow I/O expanders, etc) const uint8_t pmu_irq_pin = CONFIG_PMU_IRQ; +#endif void setFlag(void) { @@ -249,8 +252,12 @@ void AXP2101Component::setup() // Force add pull-up +#ifdef USE_ARDUINO pinMode(pmu_irq_pin, INPUT_PULLUP); attachInterrupt(pmu_irq_pin, setFlag, FALLING); +#else +#warning "IRQ support not ready in ESP-IDF" // TODO +#endif // Disable all interrupts