TDeckBoard.cpp 914 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <Arduino.h>
  2. #include "TDeckBoard.h"
  3. uint32_t deviceOnline = 0x00;
  4. void TDeckBoard::begin() {
  5. ESP32Board::begin();
  6. // Enable peripheral power
  7. pinMode(PIN_PERF_POWERON, OUTPUT);
  8. digitalWrite(PIN_PERF_POWERON, HIGH);
  9. // Configure user button
  10. pinMode(PIN_USER_BTN, INPUT);
  11. // Configure LoRa Pins
  12. pinMode(P_LORA_MISO, INPUT_PULLUP);
  13. // pinMode(P_LORA_DIO_1, INPUT_PULLUP);
  14. #ifdef P_LORA_TX_LED
  15. digitalWrite(P_LORA_TX_LED, HIGH); // inverted pin for SX1276 - HIGH for off
  16. #endif
  17. esp_reset_reason_t reason = esp_reset_reason();
  18. if (reason == ESP_RST_DEEPSLEEP) {
  19. long wakeup_source = esp_sleep_get_ext1_wakeup_status();
  20. if (wakeup_source & (1 << P_LORA_DIO_1)) {
  21. startup_reason = BD_STARTUP_RX_PACKET; // received a LoRa packet (while in deep sleep)
  22. }
  23. rtc_gpio_hold_dis((gpio_num_t)P_LORA_NSS);
  24. rtc_gpio_deinit((gpio_num_t)P_LORA_DIO_1);
  25. }
  26. }