target.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include <Arduino.h>
  2. #include "target.h"
  3. #include <helpers/ArduinoHelpers.h>
  4. #include <helpers/sensors/MicroNMEALocationProvider.h>
  5. WioTrackerL1Board board;
  6. RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
  7. WRAPPER_CLASS radio_driver(radio, board);
  8. VolatileRTCClock fallback_clock;
  9. AutoDiscoverRTCClock rtc_clock(fallback_clock);
  10. #ifdef ENV_INCLUDE_GPS
  11. MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
  12. EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
  13. #else
  14. EnvironmentSensorManager sensors = EnvironmentSensorManager();
  15. #endif
  16. #ifdef DISPLAY_CLASS
  17. DISPLAY_CLASS display;
  18. MomentaryButton user_btn(PIN_USER_BTN, 1000, true, false, false);
  19. MomentaryButton joystick_left(JOYSTICK_LEFT, 1000, true, false, false);
  20. MomentaryButton joystick_right(JOYSTICK_RIGHT, 1000, true, false, false);
  21. MomentaryButton back_btn(PIN_BACK_BTN, 1000, true, false, true);
  22. #endif
  23. bool radio_init() {
  24. rtc_clock.begin(Wire);
  25. return radio.std_init(&SPI);
  26. }
  27. mesh::LocalIdentity radio_new_identity() {
  28. RadioNoiseListener rng(radio);
  29. return mesh::LocalIdentity(&rng); // create new random identity
  30. }