ThinkNodeM6Board.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 Nrf52BoardOTA {
  11. public:
  12. ThinkNodeM6Board() : NRF52BoardOTA("THINKNODE_M1_OTA") {}
  13. void begin();
  14. uint16_t getBattMilliVolts() override;
  15. #if defined(P_LORA_TX_LED)
  16. void onBeforeTransmit() override {
  17. digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on
  18. }
  19. void onAfterTransmit() override {
  20. digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off
  21. }
  22. #endif
  23. const char* getManufacturerName() const override {
  24. return "Elecrow ThinkNode-M6";
  25. }
  26. void powerOff() override {
  27. // turn off all leds, sd_power_system_off will not do this for us
  28. #ifdef P_LORA_TX_LED
  29. digitalWrite(P_LORA_TX_LED, LOW);
  30. #endif
  31. // power off board
  32. sd_power_system_off();
  33. }
  34. };