target.cpp 759 B

12345678910111213141516171819202122232425262728293031323334
  1. #include <Arduino.h>
  2. #include "target.h"
  3. LilyGoTLoraBoard board;
  4. static SPIClass spi;
  5. RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
  6. WRAPPER_CLASS radio_driver(radio, board);
  7. ESP32RTCClock fallback_clock;
  8. AutoDiscoverRTCClock rtc_clock(fallback_clock);
  9. EnvironmentSensorManager sensors;
  10. #ifdef DISPLAY_CLASS
  11. DISPLAY_CLASS display;
  12. MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
  13. #endif
  14. bool radio_init() {
  15. fallback_clock.begin();
  16. rtc_clock.begin(Wire);
  17. #if defined(P_LORA_SCLK)
  18. return radio.std_init(&spi);
  19. #else
  20. return radio.std_init();
  21. #endif
  22. }
  23. mesh::LocalIdentity radio_new_identity() {
  24. RadioNoiseListener rng(radio);
  25. return mesh::LocalIdentity(&rng); // create new random identity
  26. }