Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Esp32v3 initial support #113

Merged
merged 6 commits into from
Nov 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ web/node_modules
makeEspArduino/
lib/**
firmware/lib/**

hardware/board_esp32_v3/**
firmware/platformio.ini
.pio
.vscode
secrets.h
22 changes: 22 additions & 0 deletions firmware/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,26 @@
#define LORA2_CS 25
#endif

#ifdef ESP32_V3

#define LORA_IRQ 22
#define LORA_CS 16
#define LORA_IO1 26
#define LORA_IO2 NOT_A_PIN
#define LORA_RST NOT_A_PIN
#define LORA_SCK 18
#define LORA_MOSI 23
#define LORA_MISO 19
#define LORA_RXEN 17

//comment all LORA2 lines and -DDUAL_LORA build flag to disable second module

#define LORA2_CS 33
#define LORA2_IRQ 35
#define LORA2_RST NOT_A_PIN
#define LORA2_IO1 27
#define LORA2_IO2 NOT_A_PIN
#define LORA2_RXEN 21
#endif

#endif
19 changes: 16 additions & 3 deletions firmware/main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
#ifdef RL_SX1276
#include <Layer1_SX1276.h>
#endif
#ifdef RL_SX1262
#include <Layer1_SX126x.h>
#endif

#include <LoRaLayer2.h>

Expand Down Expand Up @@ -72,13 +75,21 @@ BleUartClient ble_client;
#ifdef ARDUINO_LORA
Layer1Class *Layer1 = new Layer1Class();
#endif

#ifdef RL_SX1276
SX1276 lora = new Module(LORA_CS, LORA_IRQ, LORA_RST, RADIOLIB_NC);
#ifdef DUAL_LORA
SX1276 lora2 = new Module(LORA2_CS, LORA2_IRQ, LORA2_RST, RADIOLIB_NC);
#endif
#endif

#ifdef RL_SX1262
SX1262 lora = new Module(LORA_CS, LORA_IRQ, LORA_RST, RADIOLIB_NC);
#ifdef DUAL_LORA
SX1262 lora2 = new Module(LORA2_CS, LORA2_IRQ, LORA2_RST, RADIOLIB_NC);
#endif
#endif

LL2Class *LL2;

#include "settings/settings.h"
Expand Down Expand Up @@ -348,14 +359,16 @@ void setupLoRa()
#ifdef LOPY4
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI); //LORA_CS);
#endif
#ifdef ARDUINO_LORA

#if defined (ARDUINO_LORA)
Layer1Class *Layer1_1 = new Layer1Class();
Layer1_1->setPins(LORA_CS, LORA_RST, LORA_IRQ);
Layer1_1->setLoRaFrequency(loraFrq*1E6);
Layer1_1->setTxPower(txPower);
Layer1_1->setSpreadingFactor(spreadingFactor);
#endif
#ifdef RL_SX1276

#if defined ( RL_SX1276 ) || defined ( RL_SX1262 )
pinMode(LORA_CS, OUTPUT);
digitalWrite(LORA_CS, LOW);
#ifdef DUAL_LORA
Expand All @@ -366,7 +379,7 @@ void setupLoRa()
#ifdef DUAL_LORA
digitalWrite(LORA_CS, HIGH);
digitalWrite(LORA2_CS, LOW);
Layer1Class *Layer1_2 = new Layer1Class(&lora2, 0, LORA2_CS, LORA2_RST, LORA2_IRQ, 7, 433, 17);
Layer1Class *Layer1_2 = new Layer1Class(&lora2, 0, LORA2_CS, LORA2_RST, LORA2_IRQ, 7, 915, 17);
digitalWrite(LORA_CS, LOW);
digitalWrite(LORA2_CS, HIGH);
#endif
Expand Down
15 changes: 12 additions & 3 deletions firmware/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ src_dir = .
data_dir = ../web/static
default_envs=
;ttgo-lora32-v1
ttgo-lora32-v2
;ttgo-lora32-v2
;ttgo-lora32-tbeam
;heltec-v2
;sparkfun-lora
;lopy4
; lopy4
esp32-v3

[env]
platform = https://github.com/platformio/platform-espressif32.git
Expand All @@ -34,7 +35,7 @@ lib_deps =
ESP Async [email protected]
[email protected]
https://github.com/jgromes/RadioLib#3682c6c9215891e3afb7672f1235fde1c3bd75fd
https://github.com/sudomesh/LoRaLayer2#efaa3fa73e3c8f6a7c66e335873c0bd81cc865e3
https://github.com/code8buster/LoRaLayer2.git#esp32v3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After merging both PRs, we should point this back at ""official" LoRaLayer2 latest commit.

https://github.com/paidforby/AsyncSDServer#13375c6be978cb34180378ecf4042a3a4a1f5eab
ESP8266 and ESP32 OLED driver for SSD1306 displays
[email protected]
Expand Down Expand Up @@ -92,3 +93,11 @@ build_flags = -DLOPY4
-I./src
; -DDUAL_LORA
; -DLL2_DEBUG
[env:esp32-v3]
board = esp32dev
board_upload.maximum_size = 4194304
board_upload.maximum_ram_size = 532480
build_flags = -DESP32_V3
-DRL_SX1262
-I./src
-DDUAL_LORA