ThinkNodeM6Board.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #pragma once
  2. #include <Arduino.h>
  3. #include <MeshCore.h>
  4. #include <helpers/NRF52Board.h>
  5. // built-ins
  6. #define VBAT_MV_PER_LSB (0.73242188F) // 3.0V ADC range and 12-bit ADC resolution = 3000mV/4096
  7. #define VBAT_DIVIDER_COMP ADC_MULTIPLIER // Compensation factor for the VBAT divider
  8. #define PIN_VBAT_READ BATTERY_PIN
  9. #define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
  10. class ThinkNodeM6Board : public NRF52BoardDCDC {
  11. protected:
  12. #if NRF52_POWER_MANAGEMENT
  13. void initiateShutdown(uint8_t reason) override;
  14. #endif
  15. public:
  16. ThinkNodeM6Board() : NRF52Board("THINKNODE_M6_OTA") {}
  17. void begin();
  18. uint16_t getBattMilliVolts() override;
  19. #if defined(P_LORA_TX_LED)
  20. void onBeforeTransmit() override {
  21. digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on
  22. }
  23. void onAfterTransmit() override {
  24. digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off
  25. }
  26. #endif
  27. const char* getManufacturerName() const override {
  28. return "Elecrow ThinkNode M6";
  29. }
  30. void powerOff() override {
  31. // turn off all leds, sd_power_system_off will not do this for us
  32. #ifdef P_LORA_TX_LED
  33. digitalWrite(P_LORA_TX_LED, LOW);
  34. #endif
  35. // power off board
  36. sd_power_system_off();
  37. }
  38. };