target.cpp 1009 B

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