target.cpp 882 B

1234567891011121314151617181920212223242526272829303132
  1. #include <Arduino.h>
  2. #include "target.h"
  3. #include <helpers/ArduinoHelpers.h>
  4. #ifdef ENV_INCLUDE_GPS
  5. #include <helpers/sensors/MicroNMEALocationProvider.h>
  6. #endif
  7. SenseCapSolarBoard board;
  8. RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
  9. WRAPPER_CLASS radio_driver(radio, board);
  10. VolatileRTCClock fallback_clock;
  11. AutoDiscoverRTCClock rtc_clock(fallback_clock);
  12. #ifdef ENV_INCLUDE_GPS
  13. MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
  14. EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
  15. #else
  16. EnvironmentSensorManager sensors = EnvironmentSensorManager();
  17. #endif
  18. bool radio_init() {
  19. rtc_clock.begin(Wire);
  20. return radio.std_init(&SPI);
  21. }
  22. mesh::LocalIdentity radio_new_identity() {
  23. RadioNoiseListener rng(radio);
  24. return mesh::LocalIdentity(&rng); // create new random identity
  25. }