target.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #define RADIOLIB_STATIC_ONLY 1
  3. #include <RadioLib.h>
  4. #include <helpers/radiolib/RadioLibWrappers.h>
  5. #include <helpers/nrf52/ThinkNodeM1Board.h>
  6. #include <helpers/radiolib/CustomSX1262Wrapper.h>
  7. #include <helpers/AutoDiscoverRTCClock.h>
  8. #include <helpers/SensorManager.h>
  9. #include <helpers/sensors/LocationProvider.h>
  10. #ifdef DISPLAY_CLASS
  11. #include <helpers/ui/GxEPDDisplay.h>
  12. #include <helpers/ui/MomentaryButton.h>
  13. #endif
  14. class ThinkNodeM1SensorManager : public SensorManager {
  15. bool gps_active = false;
  16. bool last_gps_switch_state = false;
  17. LocationProvider* _location;
  18. void start_gps();
  19. void stop_gps();
  20. public:
  21. ThinkNodeM1SensorManager(LocationProvider &location): _location(&location) { }
  22. bool begin() override;
  23. bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
  24. void loop() override;
  25. int getNumSettings() const override;
  26. const char* getSettingName(int i) const override;
  27. const char* getSettingValue(int i) const override;
  28. bool setSettingValue(const char* name, const char* value) override;
  29. };
  30. extern ThinkNodeM1Board board;
  31. extern WRAPPER_CLASS radio_driver;
  32. extern AutoDiscoverRTCClock rtc_clock;
  33. extern ThinkNodeM1SensorManager sensors;
  34. #ifdef DISPLAY_CLASS
  35. extern DISPLAY_CLASS display;
  36. extern MomentaryButton user_btn;
  37. #endif
  38. bool radio_init();
  39. uint32_t radio_get_rng_seed();
  40. void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
  41. void radio_set_tx_power(uint8_t dbm);
  42. mesh::LocalIdentity radio_new_identity();