target.h 1.4 KB

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