* BIG refactor: 'board' and 'radio' objects now defined in 'target.h/.cpp'
* mesh::RTCClock class moved to MeshCore.h
This commit is contained in:
@@ -6,6 +6,7 @@ build_type = release ; Set build type to release
|
||||
board_build.partitions = min_spiffs.csv ; get around 4mb flash limit
|
||||
build_flags =
|
||||
${esp32_base.build_flags}
|
||||
-I variants/lilygo_tlora_v2_1
|
||||
-Os -ffunction-sections -fdata-sections ; Optimize for size
|
||||
-D LILYGO_TLORA ; LILYGO T-LoRa V2.1-1.6 ESP32 with SX1276
|
||||
-D P_LORA_DIO_0=26 ; SX1276 DIO0 interrupt pin
|
||||
@@ -23,6 +24,8 @@ build_flags =
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D WRAPPER_CLASS=CustomSX1276Wrapper
|
||||
-D LORA_TX_POWER=20
|
||||
build_src_filter = ${esp32_base.build_src_filter}
|
||||
+<../variants/lilygo_tlora_v2_1>
|
||||
lib_deps =
|
||||
${esp32_base.lib_deps}
|
||||
adafruit/Adafruit SSD1306 @ ^2.5.13
|
||||
|
||||
25
variants/lilygo_tlora_v2_1/target.cpp
Normal file
25
variants/lilygo_tlora_v2_1/target.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <Arduino.h>
|
||||
#include "target.h"
|
||||
|
||||
LilyGoTLoraBoard board;
|
||||
|
||||
static SPIClass spi;
|
||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
|
||||
|
||||
#ifndef LORA_CR
|
||||
#define LORA_CR 5
|
||||
#endif
|
||||
|
||||
bool radio_init() {
|
||||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
|
||||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8);
|
||||
if (status != RADIOLIB_ERR_NONE) {
|
||||
Serial.print("ERROR: radio init failed: ");
|
||||
Serial.println(status);
|
||||
return false; // fail
|
||||
}
|
||||
|
||||
radio.setCRC(1);
|
||||
|
||||
return true; // success
|
||||
}
|
||||
9
variants/lilygo_tlora_v2_1/target.h
Normal file
9
variants/lilygo_tlora_v2_1/target.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <helpers/LilyGoTLoraBoard.h>
|
||||
#include <helpers/CustomSX1276Wrapper.h>
|
||||
|
||||
extern LilyGoTLoraBoard board;
|
||||
extern RADIO_CLASS radio;
|
||||
|
||||
bool radio_init();
|
||||
Reference in New Issue
Block a user