diff --git a/main/configuration.h b/main/configuration.h index 7e157eb..022db6b 100644 --- a/main/configuration.h +++ b/main/configuration.h @@ -82,16 +82,21 @@ void ttn_register(void (*callback)(uint8_t message)); // General // ----------------------------------------------------------------------------- -#define BUTTON_PIN 39 +#define I2C_SDA 21 +#define I2C_SCL 22 #define LED_PIN 14 +#if defined(T_BEAM_V07) +#define BUTTON_PIN 39 +#elif defined(T_BEAM_V10) +#define BUTTON_PIN 38 +#endif + // ----------------------------------------------------------------------------- // OLED // ----------------------------------------------------------------------------- #define OLED_ADDRESS 0x3C -#define OLED_SDA 21 -#define OLED_SCL 22 // ----------------------------------------------------------------------------- // GPS @@ -123,11 +128,10 @@ void ttn_register(void (*callback)(uint8_t message)); #define DIO2_GPIO 32 // ----------------------------------------------------------------------------- -// Rev1-specific options +// AXP192 (Rev1-specific options) // ----------------------------------------------------------------------------- -#ifdef T_BEAM_V10 -#define GPS_POWER_CTRL_CH 3 -#define LORA_POWER_CTRL_CH 2 -#define PMU_IRQ 35 -#endif +#define AXP192_SLAVE_ADDRESS 0x34 +#define GPS_POWER_CTRL_CH 3 +#define LORA_POWER_CTRL_CH 2 +#define PMU_IRQ 35 diff --git a/main/main.ino b/main/main.ino index 6ff88ff..a7ef624 100644 --- a/main/main.ino +++ b/main/main.ino @@ -23,10 +23,11 @@ #include "configuration.h" #include "rom/rtc.h" +#include +#include #ifdef T_BEAM_V10 #include "axp20x.h" -#define AXP192_SLAVE_ADDRESS 0x34 AXP20X_Class axp; bool axp192_found = false; bool pmu_irq = false; @@ -35,10 +36,6 @@ String baChStatus = "No charging"; // Message counter, stored in RTC memory, survives deep sleep RTC_DATA_ATTR uint32_t count = 0; -// ----------------------------------------------------------------------------- -// Submodules -// ----------------------------------------------------------------------------- -#include #if defined(PAYLOAD_USE_FULL) // includes number of satellites and accuracy @@ -144,7 +141,8 @@ void setup() { #endif #ifdef T_BEAM_V10 - axp192_found = 1; + Wire.begin(I2C_SDA, I2C_SCL); + axp192_found = true; if (axp192_found) { if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) { Serial.println("AXP192 Begin PASS"); diff --git a/main/screen.ino b/main/screen.ino index e000c4b..3cecc15 100644 --- a/main/screen.ino +++ b/main/screen.ino @@ -93,7 +93,7 @@ void screen_update() { void screen_setup() { // Display instance - display = new SSD1306Wire(OLED_ADDRESS, OLED_SDA, OLED_SCL); + display = new SSD1306Wire(OLED_ADDRESS, I2C_SDA, I2C_SCL); display->init(); display->flipScreenVertically(); display->setFont(Custom_ArialMT_Plain_10);