From c4eb7acbcea1f4dd84628234dad973d6a93bef7e Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 19 Jul 2023 11:53:58 -0500 Subject: [PATCH 01/17] T-Watch WIP --- boards/t-watch-s3.json | 37 ++++++++++++ src/Power.cpp | 3 +- src/graphics/TFTDisplay.cpp | 4 +- src/platform/esp32/architecture.h | 2 + src/sleep.cpp | 5 +- variants/t-watch-s3/pins_arduino.h | 64 +++++++++++++++++++++ variants/t-watch-s3/platformio.ini | 14 +++++ variants/t-watch-s3/variant.h | 90 ++++++++++++++++++++++++++++++ variants/tbeam-s3-core/variant.h | 4 +- 9 files changed, 216 insertions(+), 7 deletions(-) create mode 100644 boards/t-watch-s3.json create mode 100644 variants/t-watch-s3/pins_arduino.h create mode 100644 variants/t-watch-s3/platformio.ini create mode 100644 variants/t-watch-s3/variant.h diff --git a/boards/t-watch-s3.json b/boards/t-watch-s3.json new file mode 100644 index 0000000000..b10dc186ad --- /dev/null +++ b/boards/t-watch-s3.json @@ -0,0 +1,37 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32s3_out.ld" + }, + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM", + "-DT_WATCH_S3", + "-DARDUINO_USB_CDC_ON_BOOT=1", + "-DARDUINO_USB_MODE=0", + "-DARDUINO_RUNNING_CORE=1", + "-DARDUINO_EVENT_RUNNING_CORE=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "dio", + "hwids": [["0X303A", "0x1001"]], + "mcu": "esp32s3", + "variant": "t-watch" + }, + "connectivity": ["wifi"], + "debug": { + "openocd_target": "esp32s3.cfg" + }, + "frameworks": ["arduino"], + "name": "LilyGo T-Watch 2020 V3", + "upload": { + "flash_size": "8MB", + "maximum_ram_size": 327680, + "maximum_size": 8388608, + "require_upload_port": true, + "speed": 921600 + }, + "url": "http://www.lilygo.cn/", + "vendor": "LilyGo" +} diff --git a/src/Power.cpp b/src/Power.cpp index ac1789cb0c..93965e55ab 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -681,7 +681,8 @@ bool Power::axpChipInit() // GNSS VDD 3300mV PMU->setPowerChannelVoltage(XPOWERS_ALDO3, 3300); PMU->enablePowerOutput(XPOWERS_ALDO3); - } else if (HW_VENDOR == meshtastic_HardwareModel_LILYGO_TBEAM_S3_CORE) { + } else if (HW_VENDOR == meshtastic_HardwareModel_LILYGO_TBEAM_S3_CORE || + HW_VENDOR == meshtastic_HardwareModel_T_WATCH_S3) { // t-beam s3 core /** * gnss module power channel diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 6f58d421dc..b2ccda28d3 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -302,7 +302,7 @@ bool TFTDisplay::connect() #endif tft.init(); -#if defined(M5STACK) || defined(T_DECK) +#if defined(M5STACK) || defined(T_DECK) || defined(T_WATCH_S3) tft.setRotation(1); // M5Stack/T-Deck have the TFT in landscape #else tft.setRotation(3); // Orient horizontal and wide underneath the silkscreen name label @@ -311,4 +311,4 @@ bool TFTDisplay::connect() return true; } -#endif +#endif \ No newline at end of file diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index c6842eee92..a4002bc2b2 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -83,6 +83,8 @@ #define HW_VENDOR meshtastic_HardwareModel_TLORA_V2_1_1P8 #elif defined(T_DECK) #define HW_VENDOR meshtastic_HardwareModel_T_DECK +#elif defined(T_WATCH_S3) +#define HW_VENDOR meshtastic_HardwareModel_T_WATCH_S3 #elif defined(GENIEBLOCKS) #define HW_VENDOR meshtastic_HardwareModel_GENIEBLOCKS #elif defined(PRIVATE_HW) diff --git a/src/sleep.cpp b/src/sleep.cpp index 0b8fbb7821..bfac997234 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -259,7 +259,8 @@ void doDeepSleep(uint32_t msecToWake) if (HW_VENDOR == meshtastic_HardwareModel_TBEAM) { // t-beam v1.2 radio power channel PMU->disablePowerOutput(XPOWERS_ALDO2); // lora radio power channel - } else if (HW_VENDOR == meshtastic_HardwareModel_LILYGO_TBEAM_S3_CORE) { + } else if (HW_VENDOR == meshtastic_HardwareModel_LILYGO_TBEAM_S3_CORE || + HW_VENDOR == meshtastic_HardwareModel_T_WATCH_S3) { PMU->disablePowerOutput(XPOWERS_ALDO3); // lora radio power channel } } else if (model == XPOWERS_AXP192) { @@ -388,4 +389,4 @@ void enableModemSleep() int rv = esp_pm_configure(&esp32_config); LOG_DEBUG("Sleep request result %x\n", rv); } -#endif +#endif \ No newline at end of file diff --git a/variants/t-watch-s3/pins_arduino.h b/variants/t-watch-s3/pins_arduino.h new file mode 100644 index 0000000000..d3dde68560 --- /dev/null +++ b/variants/t-watch-s3/pins_arduino.h @@ -0,0 +1,64 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 46 +#define NUM_DIGITAL_PINS 48 +#define NUM_ANALOG_INPUTS 20 + +#define analogInputToDigitalPin(p) (((p) < NUM_ANALOG_INPUTS) ? (analogChannelToDigitalPin(p)) : -1) +#define digitalPinToInterrupt(p) (((p) < NUM_DIGITAL_PINS) ? (p) : -1) +#define digitalPinHasPWM(p) (p < EXTERNAL_NUM_INTERRUPTS) + +// static const uint8_t LED_BUILTIN = -1; + +// static const uint8_t TX = 43; +// static const uint8_t RX = 44; + +static const uint8_t SDA = 10; +static const uint8_t SCL = 11; + +// Default SPI will be mapped to Radio +static const uint8_t SS = 5; +static const uint8_t MOSI = 1; +static const uint8_t MISO = 4; +static const uint8_t SCK = 3; + +static const uint8_t A0 = 1; +static const uint8_t A1 = 2; +static const uint8_t A2 = 3; +static const uint8_t A3 = 4; +static const uint8_t A4 = 5; +static const uint8_t A5 = 6; +static const uint8_t A6 = 7; +static const uint8_t A7 = 8; +static const uint8_t A8 = 9; +static const uint8_t A9 = 10; +static const uint8_t A10 = 11; +static const uint8_t A11 = 12; +static const uint8_t A12 = 13; +static const uint8_t A13 = 14; +static const uint8_t A14 = 15; +static const uint8_t A15 = 16; +static const uint8_t A16 = 17; +static const uint8_t A17 = 18; +static const uint8_t A18 = 19; +static const uint8_t A19 = 20; + +static const uint8_t T1 = 1; +static const uint8_t T2 = 2; +static const uint8_t T3 = 3; +static const uint8_t T4 = 4; +static const uint8_t T5 = 5; +static const uint8_t T6 = 6; +static const uint8_t T7 = 7; +static const uint8_t T8 = 8; +static const uint8_t T9 = 9; +static const uint8_t T10 = 10; +static const uint8_t T11 = 11; +static const uint8_t T12 = 12; +static const uint8_t T13 = 13; +static const uint8_t T14 = 14; + +#endif /* Pins_Arduino_h */ \ No newline at end of file diff --git a/variants/t-watch-s3/platformio.ini b/variants/t-watch-s3/platformio.ini new file mode 100644 index 0000000000..f71ff96e14 --- /dev/null +++ b/variants/t-watch-s3/platformio.ini @@ -0,0 +1,14 @@ +; LilyGo T-Watch S3 +[env:t-watch-s3] +extends = esp32s3_base +board = t-watch-s3 +upload_protocol = esp-builtin +monitor_port = /dev/tty.usbmodem3485188D636C1 +monitor_speed = 115200 + +build_flags = ${esp32_base.build_flags} + -DT_WATCH_S3 + -Ivariants/t-watch-s3 + +lib_deps = ${esp32s3_base.lib_deps} + lovyan03/LovyanGFX@^1.1.7 \ No newline at end of file diff --git a/variants/t-watch-s3/variant.h b/variants/t-watch-s3/variant.h new file mode 100644 index 0000000000..2532881015 --- /dev/null +++ b/variants/t-watch-s3/variant.h @@ -0,0 +1,90 @@ +// ST7789 TFT LCD +#define ST7789_CS 12 +#define ST7789_RS 38 // DC +#define ST7789_SDA 13 // MOSI +#define ST7789_SCK 18 +#define ST7789_RESET -1 +#define ST7789_MISO -1 +#define ST7789_BUSY -1 +#define ST7789_BL 45 +#define ST7789_SPI_HOST SPI2_HOST +//#define ST7789_BACKLIGHT_EN 15 +#define SPI_FREQUENCY 40000000 +#define SPI_READ_FREQUENCY 16000000 +#define TFT_HEIGHT 240 +#define TFT_WIDTH 240 +#define TFT_OFFSET_X 0 +#define TFT_OFFSET_Y 0 +#define SCREEN_ROTATE +#define SCREEN_TRANSITION_FRAMERATE 1 // fps +#define SCREEN_TOUCH_INT 16 +#define TOUCH_SLAVE_ADDRESS 0x5D // GT911 + +// #define TWATCH_TFT_MISO (GPIO_NUM_MAX) +// #define TWATCH_TFT_MOSI (GPIO_NUM_19) +// #define TWATCH_TFT_SCLK (GPIO_NUM_18) +// #define TWATCH_TFT_CS (GPIO_NUM_5) +// #define TWATCH_TFT_DC (GPIO_NUM_27) +// #define TWATCH_TFT_RST (GPIO_NUM_MAX) +// #define TWATCH_TFT_BL (GPIO_NUM_15) + +// Leave undefined to disable our PMU IRQ handler. DO NOT ENABLE THIS because the pmuirq can cause sperious interrupts +// and waking from light sleep +// #define PMU_IRQ 40 +#define HAS_AXP2101 + +#define HAS_RTC 1 + +// Specify the PMU as Wire1. In the t-beam-s3 core, PCF8563 and PMU share the bus +#define PMU_USE_WIRE1 +#define RTC_USE_WIRE1 + +// #define TOUCH_SDA (23) +// #define TOUCH_SCL (32) +// #define TOUCH_INT (38) +// #define TOUCH_RST (14) + +// #define SEN_SDA (21) +// #define SEN_SCL (22) + +// #define RTC_INT_PIN (37) +// #define AXP202_INT (35) +// #define BMA423_INT1 (39) + +// #define TWATCH_DAC_IIS_BCK (26) +// #define TWATCH_DAC_IIS_WS (25) +// #define TWATCH_DAC_IIS_DOUT (33) + +// #define MOTOR_PIN (4) + +#define I2C_SDA 10 // For QMC6310 sensors and screens +#define I2C_SCL 11 // For QMC6310 sensors and screens + +#define BUTTON_PIN 0 +// #define BUTTON_NEED_PULLUP + +#define HAS_GPS 0 +#undef GPS_RX_PIN +#undef GPS_TX_PIN + +#define USE_SX1262 +#define USE_SX1268 + +#define RF95_SCK 3 +#define RF95_MISO 4 +#define RF95_MOSI 1 +#define RF95_NSS 5 + +#define LORA_DIO0 -1 // a No connect on the SX1262 module +#define LORA_RESET 8 +#define LORA_DIO1 9 // SX1262 IRQ +#define LORA_DIO2 7 // SX1262 BUSY +#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262, if DIO3 is high the TXCO is enabled + +#define SX126X_CS RF95_NSS // FIXME - we really should define LORA_CS instead +#define SX126X_DIO1 LORA_DIO1 +#define SX126X_BUSY LORA_DIO2 +#define SX126X_RESET LORA_RESET +#define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that +// Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface +// code) \ No newline at end of file diff --git a/variants/tbeam-s3-core/variant.h b/variants/tbeam-s3-core/variant.h index 69f639de80..532b5b85c0 100644 --- a/variants/tbeam-s3-core/variant.h +++ b/variants/tbeam-s3-core/variant.h @@ -39,6 +39,8 @@ // #define PMU_IRQ 40 #define HAS_AXP2101 +#define HAS_RTC 1 + // Specify the PMU as Wire1. In the t-beam-s3 core, PCF8563 and PMU share the bus #define PMU_USE_WIRE1 #define RTC_USE_WIRE1 @@ -59,8 +61,6 @@ // PCF8563 RTC Module // #define PCF8563_RTC 0x51 //Putting definitions in variant. h does not compile correctly -#define HAS_RTC 1 - // has 32768 Hz crystal #define HAS_32768HZ From cafe2d1628319dbcdbd232bf400e9676cd6d5c1d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 19 Jul 2023 15:44:33 -0500 Subject: [PATCH 02/17] Updates --- boards/t-watch-s3.json | 5 +++-- variants/t-watch-s3/platformio.ini | 6 ++++-- variants/t-watch-s3/variant.h | 2 -- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/boards/t-watch-s3.json b/boards/t-watch-s3.json index b10dc186ad..d4c9f2abdc 100644 --- a/boards/t-watch-s3.json +++ b/boards/t-watch-s3.json @@ -17,7 +17,7 @@ "flash_mode": "dio", "hwids": [["0X303A", "0x1001"]], "mcu": "esp32s3", - "variant": "t-watch" + "variant": "t-watch-s3" }, "connectivity": ["wifi"], "debug": { @@ -30,7 +30,8 @@ "maximum_ram_size": 327680, "maximum_size": 8388608, "require_upload_port": true, - "speed": 921600 + "use_1200bps_touch": true, + "wait_for_upload_port": true }, "url": "http://www.lilygo.cn/", "vendor": "LilyGo" diff --git a/variants/t-watch-s3/platformio.ini b/variants/t-watch-s3/platformio.ini index f71ff96e14..c6c3b1f8e8 100644 --- a/variants/t-watch-s3/platformio.ini +++ b/variants/t-watch-s3/platformio.ini @@ -3,8 +3,10 @@ extends = esp32s3_base board = t-watch-s3 upload_protocol = esp-builtin -monitor_port = /dev/tty.usbmodem3485188D636C1 -monitor_speed = 115200 +; debug_tool = esp-builtin +; debug_speed = 12000 +; monitor_port = /dev/tty.usbmodem3485188D636C1 +; monitor_speed = 115200 build_flags = ${esp32_base.build_flags} -DT_WATCH_S3 diff --git a/variants/t-watch-s3/variant.h b/variants/t-watch-s3/variant.h index 2532881015..bf22a4e8af 100644 --- a/variants/t-watch-s3/variant.h +++ b/variants/t-watch-s3/variant.h @@ -36,8 +36,6 @@ #define HAS_RTC 1 // Specify the PMU as Wire1. In the t-beam-s3 core, PCF8563 and PMU share the bus -#define PMU_USE_WIRE1 -#define RTC_USE_WIRE1 // #define TOUCH_SDA (23) // #define TOUCH_SCL (32) From 44a500163e827790ad99fd7290df52b7020a3a2a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 19 Jul 2023 16:57:33 -0500 Subject: [PATCH 03/17] Temp --- src/graphics/TFTDisplay.cpp | 4 +++- variants/t-watch-s3/platformio.ini | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index b2ccda28d3..ef76f45e5a 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -302,8 +302,10 @@ bool TFTDisplay::connect() #endif tft.init(); -#if defined(M5STACK) || defined(T_DECK) || defined(T_WATCH_S3) +#if defined(M5STACK) || defined(T_DECK) tft.setRotation(1); // M5Stack/T-Deck have the TFT in landscape +#elif defined(T_WATCH_S3) + tft.setRotation(0); // T-Watch S3 has the TFT in portrait #else tft.setRotation(3); // Orient horizontal and wide underneath the silkscreen name label #endif diff --git a/variants/t-watch-s3/platformio.ini b/variants/t-watch-s3/platformio.ini index c6c3b1f8e8..f9a8e1321b 100644 --- a/variants/t-watch-s3/platformio.ini +++ b/variants/t-watch-s3/platformio.ini @@ -2,7 +2,10 @@ [env:t-watch-s3] extends = esp32s3_base board = t-watch-s3 -upload_protocol = esp-builtin +upload_protocol = esptool +upload_speed = 115200 +upload_port = /dev/tty.usbmodem3485188D636C1 + ; debug_tool = esp-builtin ; debug_speed = 12000 ; monitor_port = /dev/tty.usbmodem3485188D636C1 From b80b4342e5dfc755a6130be6c847da16dbe8b8b2 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 20 Jul 2023 07:31:32 -0500 Subject: [PATCH 04/17] Update screen spi bus and and backlight en --- variants/t-watch-s3/variant.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/variants/t-watch-s3/variant.h b/variants/t-watch-s3/variant.h index bf22a4e8af..cd0fae2520 100644 --- a/variants/t-watch-s3/variant.h +++ b/variants/t-watch-s3/variant.h @@ -7,8 +7,8 @@ #define ST7789_MISO -1 #define ST7789_BUSY -1 #define ST7789_BL 45 -#define ST7789_SPI_HOST SPI2_HOST -//#define ST7789_BACKLIGHT_EN 15 +#define ST7789_SPI_HOST SPI3_HOST +#define ST7789_BACKLIGHT_EN 45 #define SPI_FREQUENCY 40000000 #define SPI_READ_FREQUENCY 16000000 #define TFT_HEIGHT 240 @@ -84,5 +84,5 @@ #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET #define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that -// Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface -// code) \ No newline at end of file + // Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface + // code) \ No newline at end of file From 4270723638d0b646f7893289a7e383e5edc6c865 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 20 Jul 2023 13:14:18 -0500 Subject: [PATCH 05/17] Peripherals progress --- platformio.ini | 1 + src/AccelerometerThread.h | 100 +++++++++++++++++++++++++++-- src/ButtonThread.h | 9 +++ src/Power.cpp | 2 + src/configuration.h | 3 +- src/detect/ScanI2C.cpp | 6 +- src/detect/ScanI2C.h | 1 + src/detect/ScanI2CTwoWire.cpp | 1 + src/graphics/Screen.cpp | 6 ++ src/graphics/Screen.h | 9 ++- src/graphics/TFTDisplay.cpp | 11 ++++ src/graphics/TFTDisplay.h | 4 +- src/mesh/NodeDB.cpp | 7 +- src/platform/esp32/architecture.h | 4 ++ variants/t-watch-s3/platformio.ini | 4 +- variants/t-watch-s3/variant.h | 12 +++- 16 files changed, 163 insertions(+), 17 deletions(-) diff --git a/platformio.ini b/platformio.ini index e19175af76..08b00fee37 100644 --- a/platformio.ini +++ b/platformio.ini @@ -121,3 +121,4 @@ lib_deps = adafruit/Adafruit PM25 AQI Sensor@^1.0.6 adafruit/Adafruit MPU6050@^2.2.4 adafruit/Adafruit LIS3DH@^1.2.4 + https://github.com/lewisxhe/BMA423_Library@^0.0.1 \ No newline at end of file diff --git a/src/AccelerometerThread.h b/src/AccelerometerThread.h index 307ca233e3..08ea7b03f5 100644 --- a/src/AccelerometerThread.h +++ b/src/AccelerometerThread.h @@ -6,10 +6,37 @@ #include #include +#include +#include +#include + +BMA423 bmaSensor; +bool BMA_IRQ = false; #define ACCELEROMETER_CHECK_INTERVAL_MS 100 #define ACCELEROMETER_CLICK_THRESHOLD 40 +uint16_t readRegister(uint8_t address, uint8_t reg, uint8_t *data, uint16_t len) +{ + Wire.beginTransmission(address); + Wire.write(reg); + Wire.endTransmission(); + Wire.requestFrom((uint8_t)address, (uint8_t)len); + uint8_t i = 0; + while (Wire.available()) { + data[i++] = Wire.read(); + } + return 0; // Pass +} + +uint16_t writeRegister(uint8_t address, uint8_t reg, uint8_t *data, uint16_t len) +{ + Wire.beginTransmission(address); + Wire.write(reg); + Wire.write(data, len); + return (0 != Wire.endTransmission()); +} + namespace concurrency { class AccelerometerThread : public concurrency::OSThread @@ -29,10 +56,10 @@ class AccelerometerThread : public concurrency::OSThread return; } - accleremoter_type = type; + acceleremoter_type = type; LOG_DEBUG("AccelerometerThread initializing\n"); - if (accleremoter_type == ScanI2C::DeviceType::MPU6050 && mpu.begin(accelerometer_found.address)) { + if (acceleremoter_type == ScanI2C::DeviceType::MPU6050 && mpu.begin(accelerometer_found.address)) { LOG_DEBUG("MPU6050 initializing\n"); // setup motion detection mpu.setHighPassFilter(MPU6050_HIGHPASS_0_63_HZ); @@ -40,11 +67,60 @@ class AccelerometerThread : public concurrency::OSThread mpu.setMotionDetectionDuration(20); mpu.setInterruptPinLatch(true); // Keep it latched. Will turn off when reinitialized. mpu.setInterruptPinPolarity(true); - } else if (accleremoter_type == ScanI2C::DeviceType::LIS3DH && lis.begin(accelerometer_found.address)) { + } else if (acceleremoter_type == ScanI2C::DeviceType::LIS3DH && lis.begin(accelerometer_found.address)) { LOG_DEBUG("LIS3DH initializing\n"); lis.setRange(LIS3DH_RANGE_2_G); // Adjust threshold, higher numbers are less sensitive lis.setClick(config.device.double_tap_as_button_press ? 2 : 1, ACCELEROMETER_CLICK_THRESHOLD); + } else if (acceleremoter_type == ScanI2C::DeviceType::BMA423 && bmaSensor.begin(readRegister, writeRegister, delay)) { + LOG_DEBUG("BMA423 initializing\n"); + Acfg cfg; + cfg.odr = BMA4_OUTPUT_DATA_RATE_100HZ; + cfg.range = BMA4_ACCEL_RANGE_2G; + cfg.bandwidth = BMA4_ACCEL_NORMAL_AVG4; + cfg.perf_mode = BMA4_CONTINUOUS_MODE; + bmaSensor.setAccelConfig(cfg); + bmaSensor.enableAccel(); + + struct bma4_int_pin_config config; + config.edge_ctrl = BMA4_LEVEL_TRIGGER; + config.lvl = BMA4_ACTIVE_HIGH; + config.od = BMA4_PUSH_PULL; + config.output_en = BMA4_OUTPUT_ENABLE; + config.input_en = BMA4_INPUT_DISABLE; + // The correct trigger interrupt needs to be configured as needed + bmaSensor.setINTPinConfig(config, BMA4_INTR1_MAP); + +#ifdef BMA423_INT + pinMode(BMA4XX_INT, INPUT); + attachInterrupt( + BMA4XX_INT, + [] { + // Set interrupt to set irq value to true + BMA_IRQ = true; + }, + RISING); // Select the interrupt mode according to the actual circuit +#endif + + struct bma423_axes_remap remap_data; + remap_data.x_axis = 0; + remap_data.x_axis_sign = 1; + remap_data.y_axis = 1; + remap_data.y_axis_sign = 0; + remap_data.z_axis = 2; + remap_data.z_axis_sign = 1; + // Need to raise the wrist function, need to set the correct axis + bmaSensor.setRemapAxes(&remap_data); + // sensor.enableFeature(BMA423_STEP_CNTR, true); + bmaSensor.enableFeature(BMA423_TILT, true); + bmaSensor.enableFeature(BMA423_WAKEUP, true); + // sensor.resetStepCounter(); + + // Turn on feature interrupt + bmaSensor.enableStepCountInterrupt(); + bmaSensor.enableTiltInterrupt(); + // It corresponds to isDoubleClick interrupt + bmaSensor.enableWakeupInterrupt(); } } @@ -53,9 +129,9 @@ class AccelerometerThread : public concurrency::OSThread { canSleep = true; // Assume we should not keep the board awake - if (accleremoter_type == ScanI2C::DeviceType::MPU6050 && mpu.getMotionInterruptStatus()) { + if (acceleremoter_type == ScanI2C::DeviceType::MPU6050 && mpu.getMotionInterruptStatus()) { wakeScreen(); - } else if (accleremoter_type == ScanI2C::DeviceType::LIS3DH && lis.getClick() > 0) { + } else if (acceleremoter_type == ScanI2C::DeviceType::LIS3DH && lis.getClick() > 0) { uint8_t click = lis.getClick(); if (!config.device.double_tap_as_button_press) { wakeScreen(); @@ -65,7 +141,17 @@ class AccelerometerThread : public concurrency::OSThread buttonPress(); return 500; } + } else if (acceleremoter_type == ScanI2C::DeviceType::BMA423 && BMA_IRQ) { + BMA_IRQ = false; + bmaSensor.getINT(); + + if (bmaSensor.isTilt() || bmaSensor.isDoubleClick()) { + wakeScreen(); + powerFSM.trigger(EVENT_PRESS); + return 500; + } } + return ACCELEROMETER_CHECK_INTERVAL_MS; } @@ -84,9 +170,9 @@ class AccelerometerThread : public concurrency::OSThread powerFSM.trigger(EVENT_PRESS); } - ScanI2C::DeviceType accleremoter_type; + ScanI2C::DeviceType acceleremoter_type; Adafruit_MPU6050 mpu; Adafruit_LIS3DH lis; }; -} // namespace concurrency +} // namespace concurrency \ No newline at end of file diff --git a/src/ButtonThread.h b/src/ButtonThread.h index f03d2861af..be66492a3c 100644 --- a/src/ButtonThread.h +++ b/src/ButtonThread.h @@ -100,6 +100,15 @@ class ButtonThread : public concurrency::OSThread #endif // if (!canSleep) LOG_DEBUG("Suppressing sleep!\n"); // else LOG_DEBUG("sleep ok\n"); +#if defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) + int x, y = 0; + screen->getTouch(&x, &y); + if (x > 0 && y > 0) { + LOG_DEBUG("touch %d %d\n", x, y); + powerFSM.trigger(EVENT_PRESS); + return 100; // Check for next touch every in 100ms + } +#endif return 5; } diff --git a/src/Power.cpp b/src/Power.cpp index 93965e55ab..42da746874 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -540,10 +540,12 @@ int32_t Power::runOnce() LOG_DEBUG("Battery removed\n"); } */ +#ifndef T_WATCH_S3 // FIXME - why is this triggering on the T-Watch S3? if (PMU->isPekeyLongPressIrq()) { LOG_DEBUG("PEK long button press\n"); screen->setOn(false); } +#endif PMU->clearIrqStatus(); } diff --git a/src/configuration.h b/src/configuration.h index e1420c8dba..3e289ef544 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -123,6 +123,7 @@ along with this program. If not, see . // ----------------------------------------------------------------------------- #define MPU6050_ADDR 0x68 #define LIS3DH_ADR 0x18 +#define BMA423_ADDR 0x19 // ----------------------------------------------------------------------------- // LED @@ -193,4 +194,4 @@ along with this program. If not, see . #ifndef HW_VENDOR #error HW_VENDOR must be defined -#endif +#endif \ No newline at end of file diff --git a/src/detect/ScanI2C.cpp b/src/detect/ScanI2C.cpp index 4ce8486127..75b23f4194 100644 --- a/src/detect/ScanI2C.cpp +++ b/src/detect/ScanI2C.cpp @@ -36,8 +36,8 @@ ScanI2C::FoundDevice ScanI2C::firstKeyboard() const ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const { - ScanI2C::DeviceType types[] = {MPU6050, LIS3DH}; - return firstOfOrNONE(2, types); + ScanI2C::DeviceType types[] = {MPU6050, LIS3DH, BMA423}; + return firstOfOrNONE(3, types); } ScanI2C::FoundDevice ScanI2C::find(ScanI2C::DeviceType) const @@ -73,4 +73,4 @@ bool ScanI2C::DeviceAddress::operator<(const ScanI2C::DeviceAddress &other) cons || (port != NO_I2C && other.port != NO_I2C && (address < other.address)); } -ScanI2C::FoundDevice::FoundDevice(ScanI2C::DeviceType type, ScanI2C::DeviceAddress address) : type(type), address(address) {} +ScanI2C::FoundDevice::FoundDevice(ScanI2C::DeviceType type, ScanI2C::DeviceAddress address) : type(type), address(address) {} \ No newline at end of file diff --git a/src/detect/ScanI2C.h b/src/detect/ScanI2C.h index 4b6361cfd9..559cff7ec7 100644 --- a/src/detect/ScanI2C.h +++ b/src/detect/ScanI2C.h @@ -33,6 +33,7 @@ class ScanI2C PMSA0031, MPU6050, LIS3DH, + BMA423, #ifdef HAS_NCP5623 NCP5623, #endif diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 7b5bb0a128..66e0929513 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -274,6 +274,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port) SCAN_SIMPLE_CASE(PMSA0031_ADDR, PMSA0031, "PMSA0031 air quality sensor found\n") SCAN_SIMPLE_CASE(MPU6050_ADDR, MPU6050, "MPU6050 accelerometer found\n"); + SCAN_SIMPLE_CASE(BMA423_ADDR, BMA423, "BMA423 accelerometer found\n"); default: LOG_INFO("Device found at address 0x%x was not able to be enumerated\n", addr.address); diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 049382c196..49b52275c6 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -944,6 +944,9 @@ void Screen::handleSetOn(bool on) if (on != screenOn) { if (on) { LOG_INFO("Turning on screen\n"); +#ifdef TFT_BL + digitalWrite(TFT_BL, TFT_BACKLIGHT_ON); +#endif dispdev.displayOn(); dispdev.displayOn(); enabled = true; @@ -952,6 +955,9 @@ void Screen::handleSetOn(bool on) } else { LOG_INFO("Turning off screen\n"); dispdev.displayOff(); +#ifdef TFT_BL + digitalWrite(TFT_BL, !TFT_BACKLIGHT_ON); +#endif enabled = false; } screenOn = on; diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index debc6ac0ba..9ebe1c75ac 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -313,6 +313,13 @@ class Screen : public concurrency::OSThread void setWelcomeFrames(); + void getTouch(int *x, int *y) + { +#if defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) + dispdev.getTouch(x, y); +#endif + }; + protected: /// Updates the UI. // @@ -394,4 +401,4 @@ class Screen : public concurrency::OSThread }; } // namespace graphics -#endif +#endif \ No newline at end of file diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index ef76f45e5a..85d14cf525 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -194,8 +194,13 @@ class LGFX : public lgfx::LGFX_Device // I2C cfg.i2c_port = 1; cfg.i2c_addr = TOUCH_SLAVE_ADDRESS; +#ifdef SCREEN_TOUCH_USE_I2C1 + cfg.pin_sda = I2C_SDA1; + cfg.pin_scl = I2C_SCL1; +#else cfg.pin_sda = I2C_SDA; cfg.pin_scl = I2C_SCL; +#endif cfg.freq = 400000; _touch_instance.config(cfg); @@ -313,4 +318,10 @@ bool TFTDisplay::connect() return true; } +// Get touch coords from the display +void TFTDisplay::getTouch(int *x, int *y) +{ + tft.getTouch(x, y); +} + #endif \ No newline at end of file diff --git a/src/graphics/TFTDisplay.h b/src/graphics/TFTDisplay.h index 46cfe85e79..03293d6f4e 100644 --- a/src/graphics/TFTDisplay.h +++ b/src/graphics/TFTDisplay.h @@ -28,6 +28,8 @@ class TFTDisplay : public OLEDDisplay */ void setDetected(uint8_t detected); + void getTouch(int *x, int *y); + protected: // the header size of the buffer used, e.g. for the SPI command header virtual int getBufferOffset(void) override { return 0; } @@ -37,4 +39,4 @@ class TFTDisplay : public OLEDDisplay // Connect to the display virtual bool connect() override; -}; +}; \ No newline at end of file diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 6d71a750c0..197c4fcca4 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -165,6 +165,7 @@ void NodeDB::installDefaultConfig() config.has_network = true; config.has_bluetooth = true; config.device.rebroadcast_mode = meshtastic_Config_DeviceConfig_RebroadcastMode_ALL; + config.lora.sx126x_rx_boosted_gain = false; config.lora.tx_enabled = true; // FIXME: maybe false in the future, and setting region to enable it. (unset region forces it off) @@ -195,6 +196,10 @@ void NodeDB::installDefaultConfig() config.position.position_flags = (meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE | meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE_MSL); +#ifdef T_WATCH_S3 + config.display.wake_on_tap_or_motion = true; +#endif + initConfigIntervals(); } @@ -916,4 +921,4 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co LOG_ERROR("A critical failure occurred, portduino is exiting..."); exit(2); #endif -} +} \ No newline at end of file diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index a4002bc2b2..6e80b50e66 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -46,6 +46,10 @@ #if defined(HAS_AXP192) || defined(HAS_AXP2101) #define HAS_PMU #endif + +#ifdef PIN_BUTTON_TOUCH +#define BUTTON_PIN_TOUCH PIN_BUTTON_TOUCH +#endif // // set HW_VENDOR // diff --git a/variants/t-watch-s3/platformio.ini b/variants/t-watch-s3/platformio.ini index f9a8e1321b..84ebea8cad 100644 --- a/variants/t-watch-s3/platformio.ini +++ b/variants/t-watch-s3/platformio.ini @@ -14,6 +14,8 @@ upload_port = /dev/tty.usbmodem3485188D636C1 build_flags = ${esp32_base.build_flags} -DT_WATCH_S3 -Ivariants/t-watch-s3 + -DPCF8563_RTC=0x51 lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.7 \ No newline at end of file + lovyan03/LovyanGFX@^1.1.7 + lewisxhe/PCF8563_Library@1.0.1 \ No newline at end of file diff --git a/variants/t-watch-s3/variant.h b/variants/t-watch-s3/variant.h index cd0fae2520..1b0c649cea 100644 --- a/variants/t-watch-s3/variant.h +++ b/variants/t-watch-s3/variant.h @@ -18,8 +18,12 @@ #define SCREEN_ROTATE #define SCREEN_TRANSITION_FRAMERATE 1 // fps #define SCREEN_TOUCH_INT 16 +#define SCREEN_TOUCH_USE_I2C1 1 #define TOUCH_SLAVE_ADDRESS 0x5D // GT911 +#define I2C_SDA1 39 // Used for capacitive touch +#define I2C_SCL1 40 // Used for capacitive touch + // #define TWATCH_TFT_MISO (GPIO_NUM_MAX) // #define TWATCH_TFT_MOSI (GPIO_NUM_19) // #define TWATCH_TFT_SCLK (GPIO_NUM_18) @@ -59,8 +63,12 @@ #define I2C_SCL 11 // For QMC6310 sensors and screens #define BUTTON_PIN 0 + +//#define PIN_BUTTON_TOUCH 16 // Actually capacitive touch interrupt // #define BUTTON_NEED_PULLUP +#define BMA4XX_INT 14 // Interrupt for BMA_423 axis sensor + #define HAS_GPS 0 #undef GPS_RX_PIN #undef GPS_TX_PIN @@ -84,5 +92,5 @@ #define SX126X_BUSY LORA_DIO2 #define SX126X_RESET LORA_RESET #define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that - // Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface - // code) \ No newline at end of file + // Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for + // the sx1262interface code) \ No newline at end of file From bfef48799f7a065142f92fbdbb8a90e6e43aee5c Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 20 Jul 2023 14:12:40 -0500 Subject: [PATCH 06/17] Fixes --- src/AccelerometerThread.h | 14 +++++++------- src/graphics/TFTDisplay.cpp | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/AccelerometerThread.h b/src/AccelerometerThread.h index 08ea7b03f5..327a424d58 100644 --- a/src/AccelerometerThread.h +++ b/src/AccelerometerThread.h @@ -82,14 +82,14 @@ class AccelerometerThread : public concurrency::OSThread bmaSensor.setAccelConfig(cfg); bmaSensor.enableAccel(); - struct bma4_int_pin_config config; - config.edge_ctrl = BMA4_LEVEL_TRIGGER; - config.lvl = BMA4_ACTIVE_HIGH; - config.od = BMA4_PUSH_PULL; - config.output_en = BMA4_OUTPUT_ENABLE; - config.input_en = BMA4_INPUT_DISABLE; + struct bma4_int_pin_config pin_config; + pin_config.edge_ctrl = BMA4_LEVEL_TRIGGER; + pin_config.lvl = BMA4_ACTIVE_HIGH; + pin_config.od = BMA4_PUSH_PULL; + pin_config.output_en = BMA4_OUTPUT_ENABLE; + pin_config.input_en = BMA4_INPUT_DISABLE; // The correct trigger interrupt needs to be configured as needed - bmaSensor.setINTPinConfig(config, BMA4_INTR1_MAP); + bmaSensor.setINTPinConfig(pin_config, BMA4_INTR1_MAP); #ifdef BMA423_INT pinMode(BMA4XX_INT, INPUT); diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 85d14cf525..8cd389f031 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -266,7 +266,7 @@ void TFTDisplay::sendCommand(uint8_t com) // handle display on/off directly switch (com) { case DISPLAYON: { -#ifdef TFT_BL +#if defined(TFT_BL) && defined(TFT_BACKLIGHT_ON) digitalWrite(TFT_BL, TFT_BACKLIGHT_ON); #endif #ifdef VTFT_CTRL @@ -275,7 +275,7 @@ void TFTDisplay::sendCommand(uint8_t com) break; } case DISPLAYOFF: { -#ifdef TFT_BL +#if defined(TFT_BL) && defined(TFT_BACKLIGHT_ON) digitalWrite(TFT_BL, !TFT_BACKLIGHT_ON); #endif #ifdef VTFT_CTRL From a5288766372b24f162e3ae84ec0fecb91a20e525 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 20 Jul 2023 14:55:52 -0500 Subject: [PATCH 07/17] Fixes --- src/graphics/Screen.cpp | 4 ++-- src/graphics/TFTDisplay.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 49b52275c6..320eac1b3f 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -944,7 +944,7 @@ void Screen::handleSetOn(bool on) if (on != screenOn) { if (on) { LOG_INFO("Turning on screen\n"); -#ifdef TFT_BL +#if defined(TFT_BL) && defined(TFT_BACKLIGHT_ON) digitalWrite(TFT_BL, TFT_BACKLIGHT_ON); #endif dispdev.displayOn(); @@ -955,7 +955,7 @@ void Screen::handleSetOn(bool on) } else { LOG_INFO("Turning off screen\n"); dispdev.displayOff(); -#ifdef TFT_BL +#if defined(TFT_BL) && defined(TFT_BACKLIGHT_ON) digitalWrite(TFT_BL, !TFT_BACKLIGHT_ON); #endif enabled = false; diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 8cd389f031..37f4633484 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -321,7 +321,9 @@ bool TFTDisplay::connect() // Get touch coords from the display void TFTDisplay::getTouch(int *x, int *y) { +#if defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) tft.getTouch(x, y); +#endif } #endif \ No newline at end of file From f45dde2334ef4dd2181b76ee13718aff14c4fa1d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 20 Jul 2023 17:31:54 -0500 Subject: [PATCH 08/17] Updates --- src/graphics/TFTDisplay.cpp | 2 +- src/mesh/NodeDB.cpp | 7 +++++++ variants/t-watch-s3/variant.h | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 37f4633484..395f75f6ac 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -321,7 +321,7 @@ bool TFTDisplay::connect() // Get touch coords from the display void TFTDisplay::getTouch(int *x, int *y) { -#if defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) +#ifndef M5STACK tft.getTouch(x, y); #endif } diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 197c4fcca4..ac873b3a5a 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -239,6 +239,13 @@ void NodeDB::installDefaultModuleConfig() moduleConfig.external_notification.output_ms = 1000; moduleConfig.external_notification.nag_timeout = 60; #endif + // #ifdef T_WATCH_S3 + // moduleConfig.external_notification.enabled = true; + // moduleConfig.external_notification.active = true; + // moduleConfig.external_notification.alert_message = true; + // moduleConfig.external_notification.output_ms = 1000; + // moduleConfig.external_notification.nag_timeout = 60; + // #endif moduleConfig.has_canned_message = true; strncpy(moduleConfig.mqtt.address, default_mqtt_address, sizeof(moduleConfig.mqtt.address)); diff --git a/variants/t-watch-s3/variant.h b/variants/t-watch-s3/variant.h index 1b0c649cea..b23467b8a8 100644 --- a/variants/t-watch-s3/variant.h +++ b/variants/t-watch-s3/variant.h @@ -19,7 +19,7 @@ #define SCREEN_TRANSITION_FRAMERATE 1 // fps #define SCREEN_TOUCH_INT 16 #define SCREEN_TOUCH_USE_I2C1 1 -#define TOUCH_SLAVE_ADDRESS 0x5D // GT911 +#define TOUCH_SLAVE_ADDRESS 0x38 // GT911 #define I2C_SDA1 39 // Used for capacitive touch #define I2C_SCL1 40 // Used for capacitive touch From 8b9c5f478155e9f7d1c69ca760ed39e5f4f358ca Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 20 Jul 2023 17:35:48 -0500 Subject: [PATCH 09/17] DRV scaffolding --- src/modules/ExternalNotificationModule.cpp | 41 +++++++++++++++++++--- variants/t-watch-s3/platformio.ini | 3 +- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/modules/ExternalNotificationModule.cpp b/src/modules/ExternalNotificationModule.cpp index 79bbb4028a..c72408156e 100644 --- a/src/modules/ExternalNotificationModule.cpp +++ b/src/modules/ExternalNotificationModule.cpp @@ -19,6 +19,11 @@ uint8_t green = 0; uint8_t blue = 0; #endif +#ifdef T_WATCH_S3 +#include +Adafruit_DRV2605 drv; +#endif + #ifndef PIN_BUZZER #define PIN_BUZZER false #endif @@ -93,6 +98,10 @@ int32_t ExternalNotificationModule::runOnce() rgb.setColor(red, green, blue); } #endif + +#ifdef T_WATCH_S3 + drv.go(); +#endif } // now let the PWM buzzer play @@ -124,7 +133,8 @@ void ExternalNotificationModule::setExternalOn(uint8_t index) digitalWrite(moduleConfig.external_notification.output_buzzer, true); break; default: - digitalWrite(output, (moduleConfig.external_notification.active ? true : false)); + if (output > 0) + digitalWrite(output, (moduleConfig.external_notification.active ? true : false)); break; } #ifdef HAS_NCP5623 @@ -132,6 +142,9 @@ void ExternalNotificationModule::setExternalOn(uint8_t index) rgb.setColor(red, green, blue); } #endif +#ifdef T_WATCH_S3 + drv.go(); +#endif } void ExternalNotificationModule::setExternalOff(uint8_t index) @@ -149,7 +162,8 @@ void ExternalNotificationModule::setExternalOff(uint8_t index) digitalWrite(moduleConfig.external_notification.output_buzzer, false); break; default: - digitalWrite(output, (moduleConfig.external_notification.active ? false : true)); + if (output > 0) + digitalWrite(output, (moduleConfig.external_notification.active ? false : true)); break; } @@ -161,6 +175,9 @@ void ExternalNotificationModule::setExternalOff(uint8_t index) rgb.setColor(red, green, blue); } #endif +#ifdef T_WATCH_S3 + drv.stop(); +#endif } bool ExternalNotificationModule::getExternal(uint8_t index) @@ -174,6 +191,9 @@ void ExternalNotificationModule::stopNow() nagCycleCutoff = 1; // small value isNagging = false; setIntervalFromNow(0); +#ifdef T_WATCH_S3 + drv.stop(); +#endif } ExternalNotificationModule::ExternalNotificationModule() @@ -185,7 +205,6 @@ ExternalNotificationModule::ExternalNotificationModule() without having to configure it from the PythonAPI or WebUI. */ - // moduleConfig.external_notification.enabled = true; // moduleConfig.external_notification.alert_message = true; // moduleConfig.external_notification.alert_message_buzzer = true; // moduleConfig.external_notification.alert_message_vibra = true; @@ -213,8 +232,10 @@ ExternalNotificationModule::ExternalNotificationModule() : EXT_NOTIFICATION_MODULE_OUTPUT; // Set the direction of a pin - LOG_INFO("Using Pin %i in digital mode\n", output); - pinMode(output, OUTPUT); + if (output > 0) { + LOG_INFO("Using Pin %i in digital mode\n", output); + pinMode(output, OUTPUT); + } setExternalOff(0); externalTurnedOn[0] = 0; if (moduleConfig.external_notification.output_vibra) { @@ -241,6 +262,16 @@ ExternalNotificationModule::ExternalNotificationModule() rgb.setCurrent(10); } #endif +#ifdef T_WATCH_S3 + drv.begin(); + // I2C trigger by sending 'go' command + drv.setMode(DRV2605_MODE_INTTRIG); // default, internal trigger when sending GO command + drv.selectLibrary(1); + drv.setWaveform(0, 84); // ramp up medium 1, see datasheet part 11.2 + drv.setWaveform(1, 1); // strong click 100%, see datasheet part 11.2 + drv.setWaveform(2, 0); // end of waveforms +#endif + } else { LOG_INFO("External Notification Module Disabled\n"); disable(); diff --git a/variants/t-watch-s3/platformio.ini b/variants/t-watch-s3/platformio.ini index 84ebea8cad..ed88b9647d 100644 --- a/variants/t-watch-s3/platformio.ini +++ b/variants/t-watch-s3/platformio.ini @@ -18,4 +18,5 @@ build_flags = ${esp32_base.build_flags} lib_deps = ${esp32s3_base.lib_deps} lovyan03/LovyanGFX@^1.1.7 - lewisxhe/PCF8563_Library@1.0.1 \ No newline at end of file + lewisxhe/PCF8563_Library@1.0.1 + adafruit/Adafruit DRV2605 Library@^1.2.2 \ No newline at end of file From 4b86c54f9a7d85a417bb692126de88e2841640cb Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 21 Jul 2023 07:26:00 -0500 Subject: [PATCH 10/17] Fixed touch-screen driver selection. WIP on DRV haptic feedback --- src/ButtonThread.h | 27 ++++++++++++++++++---- src/graphics/TFTDisplay.cpp | 4 ++++ src/main.cpp | 12 ++++++++++ src/main.h | 6 +++++ src/modules/ExternalNotificationModule.cpp | 25 ++++++++------------ 5 files changed, 53 insertions(+), 21 deletions(-) diff --git a/src/ButtonThread.h b/src/ButtonThread.h index be66492a3c..76fd15976c 100644 --- a/src/ButtonThread.h +++ b/src/ButtonThread.h @@ -5,6 +5,7 @@ #include "configuration.h" #include "graphics/Screen.h" #include "power.h" +#include "main.h" #include namespace concurrency @@ -102,12 +103,28 @@ class ButtonThread : public concurrency::OSThread // else LOG_DEBUG("sleep ok\n"); #if defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) int x, y = 0; - screen->getTouch(&x, &y); - if (x > 0 && y > 0) { - LOG_DEBUG("touch %d %d\n", x, y); - powerFSM.trigger(EVENT_PRESS); - return 100; // Check for next touch every in 100ms + if (isVibrating) { + isVibrating = false; +#ifdef T_WATCH_S3 + LOG_DEBUG("Stopping DRV vibration sequence\n"); + //drv.stop(); +#endif + } else { + screen->getTouch(&x, &y); + if (x > 0 && y > 0) { + isVibrating = true; +#ifdef T_WATCH_S3 + LOG_DEBUG("Starting DRV vibration sequence\n"); + drv.setWaveform(0, 26); + drv.setWaveform(1, 0);// end waveform + drv.go(); +#endif + LOG_DEBUG("touch %d %d\n", x, y); + powerFSM.trigger(EVENT_PRESS); + return 1000; // Check for next touch every in 150 + } } + #endif return 5; diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 395f75f6ac..1f67f90c9e 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -108,7 +108,11 @@ class LGFX : public lgfx::LGFX_Device lgfx::Panel_ST7789 _panel_instance; lgfx::Bus_SPI _bus_instance; lgfx::Light_PWM _light_instance; +#ifdef T_WATCH_S3 + lgfx::Touch_FT5x06 _touch_instance; +#else lgfx::Touch_GT911 _touch_instance; +#endif public: LGFX(void) diff --git a/src/main.cpp b/src/main.cpp index 949dbcf1f6..9ec0485892 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -110,6 +110,11 @@ ScanI2C::FoundDevice rgb_found = ScanI2C::FoundDevice(ScanI2C::DeviceType::NONE, ATECCX08A atecc; #endif +#ifdef T_WATCH_S3 +Adafruit_DRV2605 drv; +#endif +bool isVibrating = false; + bool eink_found = true; uint32_t serialSinceMsec; @@ -476,6 +481,13 @@ void setup() } #endif +#ifdef T_WATCH_S3 + drv.begin(); + drv.selectLibrary(1); + // I2C trigger by sending 'go' command + drv.setMode(DRV2605_MODE_INTTRIG); +#endif + // Init our SPI controller (must be before screen and lora) initSPI(); #ifdef ARCH_RP2040 diff --git a/src/main.h b/src/main.h index c13c92bd40..b513d64788 100644 --- a/src/main.h +++ b/src/main.h @@ -38,6 +38,12 @@ extern bool isUSBPowered; extern ATECCX08A atecc; #endif +#ifdef T_WATCH_S3 +#include +extern Adafruit_DRV2605 drv; +#endif +extern bool isVibrating; + extern int TCPPort; // set by Portduino // Global Screen singleton. diff --git a/src/modules/ExternalNotificationModule.cpp b/src/modules/ExternalNotificationModule.cpp index c72408156e..6c6ca5ea9f 100644 --- a/src/modules/ExternalNotificationModule.cpp +++ b/src/modules/ExternalNotificationModule.cpp @@ -19,11 +19,6 @@ uint8_t green = 0; uint8_t blue = 0; #endif -#ifdef T_WATCH_S3 -#include -Adafruit_DRV2605 drv; -#endif - #ifndef PIN_BUZZER #define PIN_BUZZER false #endif @@ -262,16 +257,15 @@ ExternalNotificationModule::ExternalNotificationModule() rgb.setCurrent(10); } #endif -#ifdef T_WATCH_S3 - drv.begin(); - // I2C trigger by sending 'go' command - drv.setMode(DRV2605_MODE_INTTRIG); // default, internal trigger when sending GO command - drv.selectLibrary(1); - drv.setWaveform(0, 84); // ramp up medium 1, see datasheet part 11.2 - drv.setWaveform(1, 1); // strong click 100%, see datasheet part 11.2 - drv.setWaveform(2, 0); // end of waveforms -#endif - + // #ifdef T_WATCH_S3 + // drv.begin(); + // // I2C trigger by sending 'go' command + // drv.setMode(DRV2605_MODE_INTTRIG); // default, internal trigger when sending GO command + // drv.selectLibrary(1); + // drv.setWaveform(0, 84); // ramp up medium 1, see datasheet part 11.2 + // drv.setWaveform(1, 1); // strong click 100%, see datasheet part 11.2 + // drv.setWaveform(2, 0); // end of waveforms + // #endif } else { LOG_INFO("External Notification Module Disabled\n"); disable(); @@ -374,7 +368,6 @@ ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshP } setIntervalFromNow(0); // run once so we know if we should do something } - } else { LOG_INFO("External Notification Module Disabled\n"); } From a7555ec11802bc0c7f2648bc1ea3a44dcf802ca2 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 21 Jul 2023 11:28:12 -0500 Subject: [PATCH 11/17] DRV2605 pmu channel --- src/Power.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Power.cpp b/src/Power.cpp index 42da746874..a66ed4ec7b 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -719,6 +719,12 @@ bool Power::axpChipInit() PMU->setPowerChannelVoltage(XPOWERS_BLDO1, 3300); PMU->enablePowerOutput(XPOWERS_BLDO1); +#ifdef T_WATCH_S3 + // DRV2605 power channel + PMU->setPowerChannelVoltage(XPOWERS_BLDO2, 3300); + PMU->enablePowerOutput(XPOWERS_BLDO2); +#endif + // PMU->setPowerChannelVoltage(XPOWERS_DCDC4, 3300); // PMU->enablePowerOutput(XPOWERS_DCDC4); From f861a81378d97c8ef956061d84cc0805b663d0ba Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 21 Jul 2023 11:32:38 -0500 Subject: [PATCH 12/17] Trunk --- src/ButtonThread.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ButtonThread.h b/src/ButtonThread.h index 76fd15976c..2dd13873cf 100644 --- a/src/ButtonThread.h +++ b/src/ButtonThread.h @@ -4,8 +4,8 @@ #include "concurrency/OSThread.h" #include "configuration.h" #include "graphics/Screen.h" -#include "power.h" #include "main.h" +#include "power.h" #include namespace concurrency @@ -107,7 +107,7 @@ class ButtonThread : public concurrency::OSThread isVibrating = false; #ifdef T_WATCH_S3 LOG_DEBUG("Stopping DRV vibration sequence\n"); - //drv.stop(); + // drv.stop(); #endif } else { screen->getTouch(&x, &y); @@ -116,7 +116,7 @@ class ButtonThread : public concurrency::OSThread #ifdef T_WATCH_S3 LOG_DEBUG("Starting DRV vibration sequence\n"); drv.setWaveform(0, 26); - drv.setWaveform(1, 0);// end waveform + drv.setWaveform(1, 0); // end waveform drv.go(); #endif LOG_DEBUG("touch %d %d\n", x, y); From 55dc825d51824f2a7401147e6271e9a97db7eac5 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 21 Jul 2023 16:22:44 -0500 Subject: [PATCH 13/17] Fixes and defaults --- src/AccelerometerThread.h | 6 +---- src/ButtonThread.h | 26 +++++++--------------- src/mesh/NodeDB.cpp | 12 +++++----- src/modules/ExternalNotificationModule.cpp | 16 +++++-------- variants/t-watch-s3/variant.h | 2 ++ 5 files changed, 22 insertions(+), 40 deletions(-) diff --git a/src/AccelerometerThread.h b/src/AccelerometerThread.h index 327a424d58..da56953687 100644 --- a/src/AccelerometerThread.h +++ b/src/AccelerometerThread.h @@ -141,13 +141,9 @@ class AccelerometerThread : public concurrency::OSThread buttonPress(); return 500; } - } else if (acceleremoter_type == ScanI2C::DeviceType::BMA423 && BMA_IRQ) { - BMA_IRQ = false; - bmaSensor.getINT(); - + } else if (acceleremoter_type == ScanI2C::DeviceType::BMA423 && bmaSensor.getINT()) { if (bmaSensor.isTilt() || bmaSensor.isDoubleClick()) { wakeScreen(); - powerFSM.trigger(EVENT_PRESS); return 500; } } diff --git a/src/ButtonThread.h b/src/ButtonThread.h index 2dd13873cf..fcbb73af03 100644 --- a/src/ButtonThread.h +++ b/src/ButtonThread.h @@ -103,26 +103,16 @@ class ButtonThread : public concurrency::OSThread // else LOG_DEBUG("sleep ok\n"); #if defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) int x, y = 0; - if (isVibrating) { - isVibrating = false; + screen->getTouch(&x, &y); + if (x > 0 && y > 0) { #ifdef T_WATCH_S3 - LOG_DEBUG("Stopping DRV vibration sequence\n"); - // drv.stop(); + drv.setWaveform(0, 75); + drv.setWaveform(1, 0); // end waveform + drv.go(); #endif - } else { - screen->getTouch(&x, &y); - if (x > 0 && y > 0) { - isVibrating = true; -#ifdef T_WATCH_S3 - LOG_DEBUG("Starting DRV vibration sequence\n"); - drv.setWaveform(0, 26); - drv.setWaveform(1, 0); // end waveform - drv.go(); -#endif - LOG_DEBUG("touch %d %d\n", x, y); - powerFSM.trigger(EVENT_PRESS); - return 1000; // Check for next touch every in 150 - } + LOG_DEBUG("touch %d %d\n", x, y); + powerFSM.trigger(EVENT_PRESS); + return 150; // Check for next touch every in 150ms } #endif diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index ac873b3a5a..37e19eed17 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -197,6 +197,7 @@ void NodeDB::installDefaultConfig() (meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE | meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE_MSL); #ifdef T_WATCH_S3 + config.display.screen_on_secs = 30; config.display.wake_on_tap_or_motion = true; #endif @@ -239,13 +240,10 @@ void NodeDB::installDefaultModuleConfig() moduleConfig.external_notification.output_ms = 1000; moduleConfig.external_notification.nag_timeout = 60; #endif - // #ifdef T_WATCH_S3 - // moduleConfig.external_notification.enabled = true; - // moduleConfig.external_notification.active = true; - // moduleConfig.external_notification.alert_message = true; - // moduleConfig.external_notification.output_ms = 1000; - // moduleConfig.external_notification.nag_timeout = 60; - // #endif +#ifdef T_WATCH_S3 + // Don't worry about the other settings, we'll use the DRV2056 behavior for notifications + moduleConfig.external_notification.enabled = true; +#endif moduleConfig.has_canned_message = true; strncpy(moduleConfig.mqtt.address, default_mqtt_address, sizeof(moduleConfig.mqtt.address)); diff --git a/src/modules/ExternalNotificationModule.cpp b/src/modules/ExternalNotificationModule.cpp index 6c6ca5ea9f..7dd6dd1ced 100644 --- a/src/modules/ExternalNotificationModule.cpp +++ b/src/modules/ExternalNotificationModule.cpp @@ -257,15 +257,6 @@ ExternalNotificationModule::ExternalNotificationModule() rgb.setCurrent(10); } #endif - // #ifdef T_WATCH_S3 - // drv.begin(); - // // I2C trigger by sending 'go' command - // drv.setMode(DRV2605_MODE_INTTRIG); // default, internal trigger when sending GO command - // drv.selectLibrary(1); - // drv.setWaveform(0, 84); // ramp up medium 1, see datasheet part 11.2 - // drv.setWaveform(1, 1); // strong click 100%, see datasheet part 11.2 - // drv.setWaveform(2, 0); // end of waveforms - // #endif } else { LOG_INFO("External Notification Module Disabled\n"); disable(); @@ -275,7 +266,12 @@ ExternalNotificationModule::ExternalNotificationModule() ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshPacket &mp) { if (moduleConfig.external_notification.enabled) { - +#if T_WATCH_S3 + drv.setWaveform(0, 75); + drv.setWaveform(1, 56); + drv.setWaveform(2, 0); + drv.go(); +#endif if (getFrom(&mp) != nodeDB.getNodeNum()) { // Check if the message contains a bell character. Don't do this loop for every pin, just once. diff --git a/variants/t-watch-s3/variant.h b/variants/t-watch-s3/variant.h index b23467b8a8..6632a33a34 100644 --- a/variants/t-watch-s3/variant.h +++ b/variants/t-watch-s3/variant.h @@ -24,6 +24,8 @@ #define I2C_SDA1 39 // Used for capacitive touch #define I2C_SCL1 40 // Used for capacitive touch +#define TFT_BL T7789_BACKLIGHT_EN + // #define TWATCH_TFT_MISO (GPIO_NUM_MAX) // #define TWATCH_TFT_MOSI (GPIO_NUM_19) // #define TWATCH_TFT_SCLK (GPIO_NUM_18) From 8a24bea8a876798f62479353ba8f793639f7417e Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 21 Jul 2023 16:34:24 -0500 Subject: [PATCH 14/17] Dropped an s --- variants/t-watch-s3/variant.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/t-watch-s3/variant.h b/variants/t-watch-s3/variant.h index 6632a33a34..4e59036306 100644 --- a/variants/t-watch-s3/variant.h +++ b/variants/t-watch-s3/variant.h @@ -24,7 +24,7 @@ #define I2C_SDA1 39 // Used for capacitive touch #define I2C_SCL1 40 // Used for capacitive touch -#define TFT_BL T7789_BACKLIGHT_EN +#define TFT_BL ST7789_BACKLIGHT_EN // #define TWATCH_TFT_MISO (GPIO_NUM_MAX) // #define TWATCH_TFT_MOSI (GPIO_NUM_19) From f57cb8853855090c5f40066400b8d66209f55091 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 21 Jul 2023 17:00:24 -0500 Subject: [PATCH 15/17] Move PMU and turn off screen that way --- src/graphics/Screen.cpp | 8 ++++---- src/sleep.cpp | 5 ----- src/sleep.h | 6 ++++++ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 320eac1b3f..d1cc5ad361 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -944,8 +944,8 @@ void Screen::handleSetOn(bool on) if (on != screenOn) { if (on) { LOG_INFO("Turning on screen\n"); -#if defined(TFT_BL) && defined(TFT_BACKLIGHT_ON) - digitalWrite(TFT_BL, TFT_BACKLIGHT_ON); +#ifdef T_WATCH_S3 + PMU->enablePowerOutput(XPOWERS_ALDO2); #endif dispdev.displayOn(); dispdev.displayOn(); @@ -955,8 +955,8 @@ void Screen::handleSetOn(bool on) } else { LOG_INFO("Turning off screen\n"); dispdev.displayOff(); -#if defined(TFT_BL) && defined(TFT_BACKLIGHT_ON) - digitalWrite(TFT_BL, !TFT_BACKLIGHT_ON); +#ifdef T_WATCH_S3 + PMU->disablePowerOutput(XPOWERS_ALDO2); #endif enabled = false; } diff --git a/src/sleep.cpp b/src/sleep.cpp index bfac997234..3d6da7febb 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -23,11 +23,6 @@ esp_sleep_source_t wakeCause; // the reason we booted this time #define INCLUDE_vTaskSuspend 0 #endif -#ifdef HAS_PMU -#include "XPowersLibInterface.hpp" -extern XPowersLibInterface *PMU; -#endif - /// Called to ask any observers if they want to veto sleep. Return 1 to veto or 0 to allow sleep to happen Observable preflightSleep; diff --git a/src/sleep.h b/src/sleep.h index a4b8f37b5d..856d8d6b16 100644 --- a/src/sleep.h +++ b/src/sleep.h @@ -12,6 +12,12 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t msecToWake); extern esp_sleep_source_t wakeCause; #endif + +#ifdef HAS_PMU +#include "XPowersLibInterface.hpp" +extern XPowersLibInterface *PMU; +#endif + void setGPSPower(bool on); void doGPSpowersave(bool on); // Perform power on init that we do on each wake from deep sleep From 91c6508910336e6dcf3838816590b7f2cf2fc8e5 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 22 Jul 2023 08:36:43 -0500 Subject: [PATCH 16/17] Add t-deck and t-watch-s3 to CI and cleanup --- .github/workflows/main_matrix.yml | 4 ++++ src/main.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 237322433a..acc07dec91 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -33,6 +33,8 @@ jobs: - board: m5stack-coreink - board: tbeam-s3-core - board: tlora-t3s3-v1 + - board: t-watch-s3 + - board: t-deck #- board: rak11310 runs-on: ubuntu-latest @@ -88,6 +90,8 @@ jobs: - board: heltec-wireless-paper - board: tbeam-s3-core - board: tlora-t3s3-v1 + - board: t-watch-s3 + - board: t-deck uses: ./.github/workflows/build_esp32_s3.yml with: board: ${{ matrix.board }} diff --git a/src/main.cpp b/src/main.cpp index 2515378cce..101ef51d8a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -490,6 +490,8 @@ void setup() #if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) if (acc_info.type != ScanI2C::DeviceType::NONE) { + config.display.wake_on_tap_or_motion = true; + moduleConfig.external_notification.enabled = true; accelerometerThread = new AccelerometerThread(acc_info.type); } #endif From ee024a8a14aa7a25ddee129c56a0024669c3c6e4 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 22 Jul 2023 08:38:43 -0500 Subject: [PATCH 17/17] More cleanup --- variants/t-watch-s3/platformio.ini | 7 +----- variants/t-watch-s3/variant.h | 34 ------------------------------ 2 files changed, 1 insertion(+), 40 deletions(-) diff --git a/variants/t-watch-s3/platformio.ini b/variants/t-watch-s3/platformio.ini index ed88b9647d..709ea89eeb 100644 --- a/variants/t-watch-s3/platformio.ini +++ b/variants/t-watch-s3/platformio.ini @@ -4,12 +4,7 @@ extends = esp32s3_base board = t-watch-s3 upload_protocol = esptool upload_speed = 115200 -upload_port = /dev/tty.usbmodem3485188D636C1 - -; debug_tool = esp-builtin -; debug_speed = 12000 -; monitor_port = /dev/tty.usbmodem3485188D636C1 -; monitor_speed = 115200 +#upload_port = /dev/tty.usbmodem3485188D636C1 build_flags = ${esp32_base.build_flags} -DT_WATCH_S3 diff --git a/variants/t-watch-s3/variant.h b/variants/t-watch-s3/variant.h index 4e59036306..652696c3fb 100644 --- a/variants/t-watch-s3/variant.h +++ b/variants/t-watch-s3/variant.h @@ -26,49 +26,15 @@ #define TFT_BL ST7789_BACKLIGHT_EN -// #define TWATCH_TFT_MISO (GPIO_NUM_MAX) -// #define TWATCH_TFT_MOSI (GPIO_NUM_19) -// #define TWATCH_TFT_SCLK (GPIO_NUM_18) -// #define TWATCH_TFT_CS (GPIO_NUM_5) -// #define TWATCH_TFT_DC (GPIO_NUM_27) -// #define TWATCH_TFT_RST (GPIO_NUM_MAX) -// #define TWATCH_TFT_BL (GPIO_NUM_15) - -// Leave undefined to disable our PMU IRQ handler. DO NOT ENABLE THIS because the pmuirq can cause sperious interrupts -// and waking from light sleep -// #define PMU_IRQ 40 #define HAS_AXP2101 #define HAS_RTC 1 -// Specify the PMU as Wire1. In the t-beam-s3 core, PCF8563 and PMU share the bus - -// #define TOUCH_SDA (23) -// #define TOUCH_SCL (32) -// #define TOUCH_INT (38) -// #define TOUCH_RST (14) - -// #define SEN_SDA (21) -// #define SEN_SCL (22) - -// #define RTC_INT_PIN (37) -// #define AXP202_INT (35) -// #define BMA423_INT1 (39) - -// #define TWATCH_DAC_IIS_BCK (26) -// #define TWATCH_DAC_IIS_WS (25) -// #define TWATCH_DAC_IIS_DOUT (33) - -// #define MOTOR_PIN (4) - #define I2C_SDA 10 // For QMC6310 sensors and screens #define I2C_SCL 11 // For QMC6310 sensors and screens #define BUTTON_PIN 0 -//#define PIN_BUTTON_TOUCH 16 // Actually capacitive touch interrupt -// #define BUTTON_NEED_PULLUP - #define BMA4XX_INT 14 // Interrupt for BMA_423 axis sensor #define HAS_GPS 0