ThinkNodeM1Board.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include <MeshCore.h>
  3. #include <Arduino.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 (0.5F) // 150K + 150K voltage divider on VBAT
  8. #define VBAT_DIVIDER_COMP (2.0F) // Compensation factor for the VBAT divider
  9. #define PIN_VBAT_READ (4)
  10. #define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
  11. class ThinkNodeM1Board : public NRF52Board {
  12. public:
  13. void begin();
  14. uint16_t getBattMilliVolts() override;
  15. bool startOTAUpdate(const char* id, char reply[]) override;
  16. #if defined(P_LORA_TX_LED)
  17. void onBeforeTransmit() override {
  18. digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on
  19. }
  20. void onAfterTransmit() override {
  21. digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off
  22. }
  23. #endif
  24. const char* getManufacturerName() const override {
  25. return "Elecrow ThinkNode-M1";
  26. }
  27. void powerOff() override {
  28. // turn off all leds, sd_power_system_off will not do this for us
  29. #ifdef P_LORA_TX_LED
  30. digitalWrite(P_LORA_TX_LED, LOW);
  31. #endif
  32. // power off board
  33. sd_power_system_off();
  34. }
  35. };