WioWM1110Board.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #include <MeshCore.h>
  3. #include <Arduino.h>
  4. #include <helpers/NRF52Board.h>
  5. #ifdef WIO_WM1110
  6. #ifdef Serial
  7. #undef Serial
  8. #endif
  9. #define Serial Serial1
  10. class WioWM1110Board : public NRF52BoardDCDC, public NRF52BoardOTA {
  11. public:
  12. WioWM1110Board() : NRF52BoardOTA("WM1110_OTA") {}
  13. void begin();
  14. #if defined(LED_GREEN)
  15. void onBeforeTransmit() override {
  16. digitalWrite(LED_RED, HIGH);
  17. }
  18. void onAfterTransmit() override {
  19. digitalWrite(LED_RED, LOW);
  20. }
  21. #endif
  22. uint16_t getBattMilliVolts() override {
  23. int adcvalue = 0;
  24. analogReadResolution(12);
  25. analogReference(AR_INTERNAL_3_0);
  26. delay(10);
  27. adcvalue = analogRead(BATTERY_PIN);
  28. return (adcvalue * ADC_MULTIPLIER * AREF_VOLTAGE * 1000.0) / 4096.0;
  29. }
  30. const char* getManufacturerName() const override {
  31. return "Seeed Wio WM1110";
  32. }
  33. void enableSensorPower(bool enable) {
  34. digitalWrite(SENSOR_POWER_PIN, enable ? HIGH : LOW);
  35. if (enable) {
  36. delay(100);
  37. }
  38. }
  39. };
  40. #endif