2025-03-06 21:39:17 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <MeshCore.h>
|
|
|
|
|
#include <Arduino.h>
|
2025-12-12 19:01:15 +07:00
|
|
|
#include <helpers/NRF52Board.h>
|
2025-03-06 21:39:17 +01:00
|
|
|
|
|
|
|
|
// built-ins
|
2025-03-23 15:57:33 +01:00
|
|
|
#define VBAT_MV_PER_LSB (0.73242188F) // 3.0V ADC range and 12-bit ADC resolution = 3000mV/4096
|
|
|
|
|
|
|
|
|
|
#define VBAT_DIVIDER (0.5F) // 150K + 150K voltage divider on VBAT
|
|
|
|
|
#define VBAT_DIVIDER_COMP (2.0F) // Compensation factor for the VBAT divider
|
|
|
|
|
|
|
|
|
|
#define PIN_VBAT_READ (4)
|
|
|
|
|
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
|
2025-03-06 21:39:17 +01:00
|
|
|
|
2025-12-09 19:56:00 +01:00
|
|
|
class TechoBoard : public NRF52BoardOTA {
|
2025-03-06 21:39:17 +01:00
|
|
|
public:
|
2025-12-09 19:56:00 +01:00
|
|
|
TechoBoard() : NRF52BoardOTA("TECHO_OTA") {}
|
2025-03-23 15:57:33 +01:00
|
|
|
void begin();
|
|
|
|
|
uint16_t getBattMilliVolts() override;
|
2025-03-06 21:39:17 +01:00
|
|
|
|
|
|
|
|
const char* getManufacturerName() const override {
|
|
|
|
|
return "LilyGo T-Echo";
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-19 09:03:34 +02:00
|
|
|
void powerOff() override {
|
|
|
|
|
#ifdef LED_RED
|
2025-12-02 17:41:31 -07:00
|
|
|
digitalWrite(LED_RED, HIGH);
|
2025-08-19 09:03:34 +02:00
|
|
|
#endif
|
|
|
|
|
#ifdef LED_GREEN
|
2025-12-02 17:41:31 -07:00
|
|
|
digitalWrite(LED_GREEN, HIGH);
|
2025-08-19 09:03:34 +02:00
|
|
|
#endif
|
|
|
|
|
#ifdef LED_BLUE
|
2025-12-02 17:41:31 -07:00
|
|
|
digitalWrite(LED_BLUE, HIGH);
|
2025-08-19 09:03:34 +02:00
|
|
|
#endif
|
|
|
|
|
#ifdef DISP_BACKLIGHT
|
|
|
|
|
digitalWrite(DISP_BACKLIGHT, LOW);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef PIN_PWR_EN
|
|
|
|
|
digitalWrite(PIN_PWR_EN, LOW);
|
|
|
|
|
#endif
|
|
|
|
|
sd_power_system_off();
|
|
|
|
|
}
|
2025-03-06 21:39:17 +01:00
|
|
|
};
|