diff options
| author | Tomas P <tpp@idx.sk> | 2025-10-19 20:44:27 +0200 |
|---|---|---|
| committer | Tomas P <tpp@idx.sk> | 2025-10-19 20:44:27 +0200 |
| commit | 31b8f7252a6078782818cd39a657ba740dcba130 (patch) | |
| tree | ef33739944308000c3cab98fbb077dc2ac9c9e67 /variants/thinknode_m2/ThinknodeM2Board.cpp | |
| parent | 99e44f499e57eb2c26b8797e43fc9b2ac86f53a9 (diff) | |
Support for Elecrow Thinknode M2
Diffstat (limited to 'variants/thinknode_m2/ThinknodeM2Board.cpp')
| -rw-r--r-- | variants/thinknode_m2/ThinknodeM2Board.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/variants/thinknode_m2/ThinknodeM2Board.cpp b/variants/thinknode_m2/ThinknodeM2Board.cpp new file mode 100644 index 00000000..3a2f067e --- /dev/null +++ b/variants/thinknode_m2/ThinknodeM2Board.cpp @@ -0,0 +1,32 @@ +#include "ThinknodeM2Board.h" + + + +void ThinknodeM2Board::begin() { + ESP32Board::begin(); + pinMode(PIN_VEXT_EN, OUTPUT); // init display + digitalWrite(PIN_VEXT_EN, PIN_VEXT_EN_ACTIVE); // pin needs to be high + delay(10); + digitalWrite(PIN_VEXT_EN, PIN_VEXT_EN_ACTIVE); // need to do this twice. do not know why.. + pinMode(PIN_STATUS_LED, OUTPUT); // init power led + } + + void ThinknodeM2Board::enterDeepSleep(uint32_t secs, int pin_wake_btn) { + esp_deep_sleep_start(); + } + + void ThinknodeM2Board::powerOff() { + enterDeepSleep(0); + } + + uint16_t ThinknodeM2Board::getBattMilliVolts() { + analogReadResolution(12); + delay(10); + float volts = (analogRead(PIN_VBAT_READ) * ADC_MULTIPLIER * AREF_VOLTAGE) / 4096; + analogReadResolution(10); + return volts * 1000; + } + + const char* ThinknodeM2Board::getManufacturerName() const { + return "Elecrow ThinkNode M2"; + }
\ No newline at end of file |
