target.cpp 954 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include <Arduino.h>
  2. #include "target.h"
  3. #include <helpers/ArduinoHelpers.h>
  4. #include <helpers/sensors/MicroNMEALocationProvider.h>
  5. TechoBoard 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);
  19. #endif
  20. bool radio_init() {
  21. rtc_clock.begin(Wire);
  22. return radio.std_init(&SPI);
  23. }
  24. mesh::LocalIdentity radio_new_identity() {
  25. RadioNoiseListener rng(radio);
  26. return mesh::LocalIdentity(&rng); // create new random identity
  27. }