target.cpp 910 B

1234567891011121314151617181920212223242526272829303132
  1. #include "target.h"
  2. #include <Arduino.h>
  3. #include <helpers/ArduinoHelpers.h>
  4. MeshtinyBoard board;
  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. VolatileRTCClock fallback_clock;
  8. AutoDiscoverRTCClock rtc_clock(fallback_clock);
  9. EnvironmentSensorManager sensors = EnvironmentSensorManager();
  10. #ifdef DISPLAY_CLASS
  11. DISPLAY_CLASS display;
  12. MomentaryButton user_btn(ENCODER_PRESS, 1000, true, true);
  13. MomentaryButton joystick_left(ENCODER_LEFT, 1000, true, true);
  14. MomentaryButton joystick_right(ENCODER_RIGHT, 1000, true, true);
  15. MomentaryButton back_btn(PIN_SIDE_BUTTON, 1000, true, true);
  16. #endif
  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. }