kopia lustrzana https://github.com/sh123/esp32_loraprs
Make LED and LORA pinouts work natively if board defines them
rodzic
ef71be3778
commit
efb35bdaf3
|
@ -39,12 +39,9 @@ All work was done on ESP32-WROOM with custom made LoRa shield, if your ESP32 boa
|
||||||
- MISO: GPIO_19/VSPI_MISO
|
- MISO: GPIO_19/VSPI_MISO
|
||||||
- SCK: GPIO_18/VSPI_SCK
|
- SCK: GPIO_18/VSPI_SCK
|
||||||
|
|
||||||
Supported:
|
Supported/Tested:
|
||||||
- **T-Beam LoRa**, **WIFI LoRa 32 (V2)**, uncomment `#define BOARD_T_BEAM` in `esp32_loraprs.ino` see [Discussion](https://github.com/sh123/esp32_loraprs/issues/11)
|
- **T-Beam LoRa**,
|
||||||
- Uses different pinout mapping as
|
- **WIFI LoRa 32 (V2)**
|
||||||
- SS: GPIO_18
|
|
||||||
- RST: GPIO_23
|
|
||||||
- DIO0: GPIO_26
|
|
||||||
|
|
||||||
# Software Dependencies
|
# Software Dependencies
|
||||||
Install via libraries:
|
Install via libraries:
|
||||||
|
|
23
config.h
23
config.h
|
@ -1,14 +1,19 @@
|
||||||
|
// change pinouts if not defined through native board LORA_* definitions
|
||||||
|
#ifndef LORA_CS
|
||||||
|
#define LORA_CS 5
|
||||||
|
#define LORA_RST 26
|
||||||
|
#define LORA_IRQ 14
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BUILTIN_LED
|
||||||
|
#define BUILTIN_LED 2
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CFG_IS_CLIENT_MODE true
|
#define CFG_IS_CLIENT_MODE true
|
||||||
|
|
||||||
#ifdef BOARD_T_BEAM
|
#define CFG_LORA_PIN_SS LORA_CS
|
||||||
#define CFG_LORA_PIN_SS 18
|
#define CFG_LORA_PIN_RST LORA_RST
|
||||||
#define CFG_LORA_PIN_RST 23
|
#define CFG_LORA_PIN_DIO0 LORA_IRQ
|
||||||
#define CFG_LORA_PIN_DIO0 26
|
|
||||||
#else
|
|
||||||
#define CFG_LORA_PIN_SS 5
|
|
||||||
#define CFG_LORA_PIN_RST 26
|
|
||||||
#define CFG_LORA_PIN_DIO0 14
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CFG_LORA_FREQ 433.775E6
|
#define CFG_LORA_FREQ 433.775E6
|
||||||
#define CFG_LORA_BW 125e3
|
#define CFG_LORA_BW 125e3
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
#define LED_TOGGLE_PERIOD 1000
|
#define LED_TOGGLE_PERIOD 1000
|
||||||
|
|
||||||
//#define BOARD_T_BEAM // enable for TTG T-Beam board support
|
|
||||||
|
|
||||||
#if __has_include("/tmp/esp32_loraprs_config.h")
|
#if __has_include("/tmp/esp32_loraprs_config.h")
|
||||||
#pragma message("Using external config")
|
#pragma message("Using external config")
|
||||||
#include "/tmp/esp32_loraprs_config.h"
|
#include "/tmp/esp32_loraprs_config.h"
|
||||||
|
@ -20,10 +18,6 @@
|
||||||
#pragma message("Configured for server mode")
|
#pragma message("Configured for server mode")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LED_BUILTIN
|
|
||||||
#define LED_BUILTIN 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void initializeConfig(LoraPrs::Config &cfg) {
|
void initializeConfig(LoraPrs::Config &cfg) {
|
||||||
|
|
||||||
// client/server mode switch
|
// client/server mode switch
|
||||||
|
@ -75,8 +69,8 @@ LoraPrs::Service loraPrsService;
|
||||||
auto watchdogLedTimer = timer_create_default();
|
auto watchdogLedTimer = timer_create_default();
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
pinMode(LED_BUILTIN, OUTPUT);
|
pinMode(BUILTIN_LED, OUTPUT);
|
||||||
digitalWrite(LED_BUILTIN, 1);
|
digitalWrite(BUILTIN_LED, 1);
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
while (!Serial);
|
while (!Serial);
|
||||||
|
@ -95,6 +89,6 @@ void loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool toggleWatchdogLed(void *) {
|
bool toggleWatchdogLed(void *) {
|
||||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
digitalWrite(BUILTIN_LED, !digitalRead(BUILTIN_LED));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue