target.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #define RADIOLIB_STATIC_ONLY 1
  3. #include <RadioLib.h>
  4. #include <helpers/radiolib/RadioLibWrappers.h>
  5. #include <T114Board.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/MomentaryButton.h>
  12. #ifdef HELTEC_T114_WITH_DISPLAY
  13. #include <helpers/ui/ST7789Display.h>
  14. #else
  15. #include "helpers/ui/NullDisplayDriver.h"
  16. #endif
  17. #endif
  18. class T114SensorManager : public SensorManager {
  19. bool gps_active = false;
  20. bool gps_detected = false;
  21. LocationProvider* _location;
  22. void start_gps();
  23. void stop_gps();
  24. public:
  25. T114SensorManager(LocationProvider &location): _location(&location) { }
  26. bool begin() override;
  27. bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
  28. void loop() override;
  29. LocationProvider* getLocationProvider() override { return gps_detected ? _location : NULL; }
  30. int getNumSettings() const override;
  31. const char* getSettingName(int i) const override;
  32. const char* getSettingValue(int i) const override;
  33. bool setSettingValue(const char* name, const char* value) override;
  34. };
  35. extern T114Board board;
  36. extern WRAPPER_CLASS radio_driver;
  37. extern AutoDiscoverRTCClock rtc_clock;
  38. extern T114SensorManager sensors;
  39. #ifdef DISPLAY_CLASS
  40. extern DISPLAY_CLASS display;
  41. extern MomentaryButton user_btn;
  42. #endif
  43. bool radio_init();
  44. uint32_t radio_get_rng_seed();
  45. void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
  46. void radio_set_tx_power(uint8_t dbm);
  47. mesh::LocalIdentity radio_new_identity();