target.cpp 763 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <Arduino.h>
  2. #include "target.h"
  3. #include <helpers/ArduinoHelpers.h>
  4. GAT56MeshWatch13Board board;
  5. #ifndef PIN_USER_BTN
  6. #define PIN_USER_BTN (-1)
  7. #endif
  8. #ifdef DISPLAY_CLASS
  9. DISPLAY_CLASS display;
  10. MomentaryButton user_btn(PIN_USER_BTN, 1000, true, false, true);
  11. #endif
  12. RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
  13. WRAPPER_CLASS radio_driver(radio, board);
  14. VolatileRTCClock fallback_clock;
  15. AutoDiscoverRTCClock rtc_clock(fallback_clock);
  16. EnvironmentSensorManager sensors;
  17. bool radio_init() {
  18. rtc_clock.begin(Wire);
  19. return radio.std_init(&SPI);
  20. }
  21. mesh::LocalIdentity radio_new_identity() {
  22. RadioNoiseListener rng(radio);
  23. return mesh::LocalIdentity(&rng); // create new random identity
  24. }