KeepteenLT1Board.h 933 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include <MeshCore.h>
  3. #include <Arduino.h>
  4. #include <helpers/NRF52Board.h>
  5. class KeepteenLT1Board : public NRF52BoardOTA {
  6. protected:
  7. uint8_t btn_prev_state;
  8. public:
  9. KeepteenLT1Board() : NRF52BoardOTA("KeepteenLT1_OTA") {}
  10. void begin();
  11. #define BATTERY_SAMPLES 8
  12. uint16_t getBattMilliVolts() override {
  13. analogReadResolution(12);
  14. uint32_t raw = 0;
  15. for (int i = 0; i < BATTERY_SAMPLES; i++) {
  16. raw += analogRead(PIN_VBAT_READ);
  17. }
  18. raw = raw / BATTERY_SAMPLES;
  19. return (ADC_MULTIPLIER * raw);
  20. }
  21. const char* getManufacturerName() const override {
  22. return "Keepteen LT1";
  23. }
  24. #if defined(P_LORA_TX_LED)
  25. void onBeforeTransmit() override {
  26. digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on
  27. }
  28. void onAfterTransmit() override {
  29. digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off
  30. }
  31. #endif
  32. void powerOff() override {
  33. sd_power_system_off();
  34. }
  35. };