target.cpp 731 B

12345678910111213141516171819202122232425262728293031323334
  1. #include <Arduino.h>
  2. #include "target.h"
  3. ESP32Board board;
  4. static SPIClass spi;
  5. RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);
  6. WRAPPER_CLASS radio_driver(radio, board);
  7. ESP32RTCClock fallback_clock;
  8. AutoDiscoverRTCClock rtc_clock(fallback_clock);
  9. SensorManager sensors;
  10. #ifdef DISPLAY_CLASS
  11. DISPLAY_CLASS display;
  12. MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
  13. #endif
  14. #ifndef LORA_CR
  15. #define LORA_CR 5
  16. #endif
  17. bool radio_init() {
  18. fallback_clock.begin();
  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);
  25. }