mirror of https://github.com/meshcore-dev/MeshCore
committed by
GitHub
11 changed files with 726 additions and 4 deletions
@ -0,0 +1,43 @@ |
|||
{ |
|||
"build": { |
|||
"arduino": { |
|||
"ldscript": "esp32s3_out.ld", |
|||
"partitions": "default_16MB.csv", |
|||
"memory_type": "qio_opi" |
|||
}, |
|||
"core": "esp32", |
|||
"extra_flags": [ |
|||
"-DBOARD_HAS_PSRAM", |
|||
"-DARDUINO_USB_CDC_ON_BOOT=1", |
|||
"-DARDUINO_USB_MODE=1", |
|||
"-DARDUINO_RUNNING_CORE=1", |
|||
"-DARDUINO_EVENT_RUNNING_CORE=1" |
|||
], |
|||
"f_cpu": "240000000L", |
|||
"f_flash": "80000000L", |
|||
"flash_mode": "qio", |
|||
"psram_type": "opi", |
|||
"hwids": [["0x303A", "0x1001"]], |
|||
"mcu": "esp32s3", |
|||
"variant": "heltec_v4_r8" |
|||
}, |
|||
"connectivity": ["wifi", "bluetooth", "lora"], |
|||
"debug": { |
|||
"default_tool": "esp-builtin", |
|||
"onboard_tools": ["esp-builtin"], |
|||
"openocd_target": "esp32s3.cfg" |
|||
}, |
|||
"frameworks": ["arduino", "espidf"], |
|||
"name": "heltec_wifi_lora_32 v4 r8 (16 MB FLASH, 8 MB PSRAM)", |
|||
"upload": { |
|||
"flash_size": "16MB", |
|||
"maximum_ram_size": 327680, |
|||
"maximum_size": 16777216, |
|||
"use_1200bps_touch": true, |
|||
"wait_for_upload_port": true, |
|||
"require_upload_port": true, |
|||
"speed": 921600 |
|||
}, |
|||
"url": "https://heltec.org/", |
|||
"vendor": "heltec" |
|||
} |
|||
@ -0,0 +1,86 @@ |
|||
#include "HeltecV4R8Board.h" |
|||
|
|||
void HeltecV4R8Board::begin() { |
|||
ESP32Board::begin(); |
|||
|
|||
periph_power.begin(); |
|||
periph_power.claim(); // R8 VEXT also feeds the LoRa antenna boost rail.
|
|||
|
|||
loRaFEMControl.init(); |
|||
|
|||
#ifdef PIN_TOUCH_RST |
|||
pinMode(PIN_TOUCH_RST, OUTPUT); |
|||
digitalWrite(PIN_TOUCH_RST, HIGH); |
|||
delay(10); |
|||
digitalWrite(PIN_TOUCH_RST, LOW); |
|||
delay(100); |
|||
digitalWrite(PIN_TOUCH_RST, HIGH); |
|||
#endif |
|||
|
|||
esp_reset_reason_t reason = esp_reset_reason(); |
|||
if (reason == ESP_RST_DEEPSLEEP) { |
|||
long wakeup_source = esp_sleep_get_ext1_wakeup_status(); |
|||
if (wakeup_source & (1 << P_LORA_DIO_1)) { |
|||
startup_reason = BD_STARTUP_RX_PACKET; |
|||
} |
|||
|
|||
rtc_gpio_hold_dis((gpio_num_t)P_LORA_NSS); |
|||
rtc_gpio_deinit((gpio_num_t)P_LORA_DIO_1); |
|||
} |
|||
} |
|||
|
|||
void HeltecV4R8Board::onBeforeTransmit(void) { |
|||
digitalWrite(P_LORA_TX_LED, HIGH); |
|||
loRaFEMControl.setTxModeEnable(); |
|||
} |
|||
|
|||
void HeltecV4R8Board::onAfterTransmit(void) { |
|||
digitalWrite(P_LORA_TX_LED, LOW); |
|||
loRaFEMControl.setRxModeEnable(); |
|||
} |
|||
|
|||
void HeltecV4R8Board::enterDeepSleep(uint32_t secs, int pin_wake_btn) { |
|||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); |
|||
|
|||
rtc_gpio_set_direction((gpio_num_t)P_LORA_DIO_1, RTC_GPIO_MODE_INPUT_ONLY); |
|||
rtc_gpio_pulldown_en((gpio_num_t)P_LORA_DIO_1); |
|||
|
|||
rtc_gpio_hold_en((gpio_num_t)P_LORA_NSS); |
|||
loRaFEMControl.setRxModeEnableWhenMCUSleep(); |
|||
|
|||
if (pin_wake_btn < 0) { |
|||
esp_sleep_enable_ext1_wakeup((1L << P_LORA_DIO_1), ESP_EXT1_WAKEUP_ANY_HIGH); |
|||
} else { |
|||
esp_sleep_enable_ext1_wakeup((1L << P_LORA_DIO_1) | (1L << pin_wake_btn), ESP_EXT1_WAKEUP_ANY_HIGH); |
|||
} |
|||
|
|||
if (secs > 0) { |
|||
esp_sleep_enable_timer_wakeup(secs * 1000000); |
|||
} |
|||
|
|||
esp_deep_sleep_start(); |
|||
} |
|||
|
|||
void HeltecV4R8Board::powerOff() { |
|||
enterDeepSleep(0); |
|||
} |
|||
|
|||
uint16_t HeltecV4R8Board::getBattMilliVolts() { |
|||
analogReadResolution(12); |
|||
|
|||
uint32_t raw = 0; |
|||
for (int i = 0; i < 8; i++) { |
|||
raw += analogReadMilliVolts(PIN_VBAT_READ); |
|||
} |
|||
raw = raw / 8; |
|||
|
|||
return (adc_mult * raw); |
|||
} |
|||
|
|||
const char* HeltecV4R8Board::getManufacturerName() const { |
|||
#ifdef HELTEC_V4_R8_TFT |
|||
return "Heltec V4 R8 TFT"; |
|||
#else |
|||
return "Heltec V4 R8 OLED"; |
|||
#endif |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
#pragma once |
|||
|
|||
#include <Arduino.h> |
|||
#include <driver/rtc_io.h> |
|||
#include <helpers/ESP32Board.h> |
|||
#include <helpers/RefCountedDigitalPin.h> |
|||
#include "LoRaFEMControl.h" |
|||
|
|||
#ifndef ADC_MULTIPLIER |
|||
#define ADC_MULTIPLIER (4.9f * 1.035f) |
|||
#endif |
|||
|
|||
class HeltecV4R8Board : public ESP32Board { |
|||
protected: |
|||
float adc_mult = ADC_MULTIPLIER; |
|||
|
|||
public: |
|||
RefCountedDigitalPin periph_power; |
|||
LoRaFEMControl loRaFEMControl; |
|||
|
|||
HeltecV4R8Board() : periph_power(PIN_VEXT_EN, PIN_VEXT_EN_ACTIVE) { } |
|||
|
|||
void begin(); |
|||
void onBeforeTransmit(void) override; |
|||
void onAfterTransmit(void) override; |
|||
void enterDeepSleep(uint32_t secs, int pin_wake_btn = -1); |
|||
void powerOff() override; |
|||
uint16_t getBattMilliVolts() override; |
|||
bool setAdcMultiplier(float multiplier) override { |
|||
if (multiplier == 0.0f) { |
|||
adc_mult = ADC_MULTIPLIER; |
|||
} else { |
|||
adc_mult = multiplier; |
|||
} |
|||
return true; |
|||
} |
|||
float getAdcMultiplier() const override { return adc_mult; } |
|||
const char* getManufacturerName() const override; |
|||
}; |
|||
@ -0,0 +1,52 @@ |
|||
#include "LoRaFEMControl.h" |
|||
|
|||
#include <Arduino.h> |
|||
#include <driver/rtc_io.h> |
|||
#include <esp_sleep.h> |
|||
|
|||
void LoRaFEMControl::init(void) { |
|||
pinMode(P_LORA_PA_POWER, OUTPUT); |
|||
digitalWrite(P_LORA_PA_POWER, HIGH); |
|||
rtc_gpio_hold_dis((gpio_num_t)P_LORA_PA_POWER); |
|||
|
|||
esp_reset_reason_t reason = esp_reset_reason(); |
|||
if (reason != ESP_RST_DEEPSLEEP) { |
|||
delay(1); |
|||
} |
|||
|
|||
rtc_gpio_hold_dis((gpio_num_t)P_LORA_KCT8103L_PA_CSD); |
|||
rtc_gpio_hold_dis((gpio_num_t)P_LORA_KCT8103L_PA_CTX); |
|||
|
|||
pinMode(P_LORA_KCT8103L_PA_CSD, OUTPUT); |
|||
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH); |
|||
pinMode(P_LORA_KCT8103L_PA_CTX, OUTPUT); |
|||
digitalWrite(P_LORA_KCT8103L_PA_CTX, lna_enabled ? LOW : HIGH); |
|||
} |
|||
|
|||
void LoRaFEMControl::setSleepModeEnable(void) { |
|||
digitalWrite(P_LORA_KCT8103L_PA_CSD, LOW); |
|||
} |
|||
|
|||
void LoRaFEMControl::setTxModeEnable(void) { |
|||
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH); |
|||
digitalWrite(P_LORA_KCT8103L_PA_CTX, HIGH); |
|||
} |
|||
|
|||
void LoRaFEMControl::setRxModeEnable(void) { |
|||
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH); |
|||
digitalWrite(P_LORA_KCT8103L_PA_CTX, lna_enabled ? LOW : HIGH); |
|||
} |
|||
|
|||
void LoRaFEMControl::setRxModeEnableWhenMCUSleep(void) { |
|||
digitalWrite(P_LORA_PA_POWER, HIGH); |
|||
rtc_gpio_hold_en((gpio_num_t)P_LORA_PA_POWER); |
|||
|
|||
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH); |
|||
rtc_gpio_hold_en((gpio_num_t)P_LORA_KCT8103L_PA_CSD); |
|||
digitalWrite(P_LORA_KCT8103L_PA_CTX, lna_enabled ? LOW : HIGH); |
|||
rtc_gpio_hold_en((gpio_num_t)P_LORA_KCT8103L_PA_CTX); |
|||
} |
|||
|
|||
void LoRaFEMControl::setLNAEnable(bool enabled) { |
|||
lna_enabled = enabled; |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
#pragma once |
|||
|
|||
typedef enum { |
|||
KCT8103L_PA, |
|||
OTHER_FEM_TYPES |
|||
} LoRaFEMType; |
|||
|
|||
class LoRaFEMControl { |
|||
public: |
|||
LoRaFEMControl() { } |
|||
virtual ~LoRaFEMControl() { } |
|||
void init(void); |
|||
void setSleepModeEnable(void); |
|||
void setTxModeEnable(void); |
|||
void setRxModeEnable(void); |
|||
void setRxModeEnableWhenMCUSleep(void); |
|||
void setLNAEnable(bool enabled); |
|||
bool isLnaCanControl(void) { return true; } |
|||
void setLnaCanControl(bool can_control) { } |
|||
LoRaFEMType getFEMType(void) const { return KCT8103L_PA; } |
|||
|
|||
private: |
|||
bool lna_enabled = false; |
|||
}; |
|||
@ -0,0 +1,56 @@ |
|||
#ifndef Pins_Arduino_h |
|||
#define Pins_Arduino_h |
|||
|
|||
#include <stdint.h> |
|||
|
|||
#define USB_VID 0x303a |
|||
#define USB_PID 0x1001 |
|||
|
|||
static const uint8_t TX = 43; |
|||
static const uint8_t RX = 44; |
|||
|
|||
static const uint8_t SDA = 17; |
|||
static const uint8_t SCL = 18; |
|||
|
|||
static const uint8_t SS = 8; |
|||
static const uint8_t MOSI = 10; |
|||
static const uint8_t MISO = 11; |
|||
static const uint8_t SCK = 9; |
|||
|
|||
static const uint8_t A0 = 1; |
|||
static const uint8_t A1 = 2; |
|||
static const uint8_t A2 = 3; |
|||
static const uint8_t A3 = 4; |
|||
static const uint8_t A4 = 5; |
|||
static const uint8_t A5 = 6; |
|||
static const uint8_t A6 = 7; |
|||
static const uint8_t A7 = 8; |
|||
static const uint8_t A8 = 9; |
|||
static const uint8_t A9 = 10; |
|||
static const uint8_t A10 = 11; |
|||
static const uint8_t A11 = 12; |
|||
static const uint8_t A12 = 13; |
|||
static const uint8_t A13 = 14; |
|||
static const uint8_t A14 = 15; |
|||
static const uint8_t A15 = 16; |
|||
static const uint8_t A16 = 17; |
|||
static const uint8_t A17 = 18; |
|||
static const uint8_t A18 = 19; |
|||
static const uint8_t A19 = 20; |
|||
|
|||
static const uint8_t T1 = 1; |
|||
static const uint8_t T2 = 2; |
|||
static const uint8_t T3 = 3; |
|||
static const uint8_t T4 = 4; |
|||
static const uint8_t T5 = 5; |
|||
static const uint8_t T6 = 6; |
|||
static const uint8_t T7 = 7; |
|||
static const uint8_t T8 = 8; |
|||
static const uint8_t T9 = 9; |
|||
static const uint8_t T10 = 10; |
|||
static const uint8_t T11 = 11; |
|||
static const uint8_t T12 = 12; |
|||
static const uint8_t T13 = 13; |
|||
static const uint8_t T14 = 14; |
|||
|
|||
#endif |
|||
@ -0,0 +1,342 @@ |
|||
[Heltec_v4_r8] |
|||
extends = esp32_base |
|||
board = heltec_v4_r8 |
|||
build_flags = |
|||
${esp32_base.build_flags} |
|||
${sensor_base.build_flags} |
|||
-I variants/heltec_v4_r8 |
|||
-D HELTEC_V4_R8 |
|||
-D USE_SX1262 |
|||
-D ESP32_CPU_FREQ=80 |
|||
-D RADIO_CLASS=CustomSX1262 |
|||
-D WRAPPER_CLASS=CustomSX1262Wrapper |
|||
-D P_LORA_DIO_1=14 |
|||
-D P_LORA_NSS=8 |
|||
-D P_LORA_RESET=12 |
|||
-D P_LORA_BUSY=13 |
|||
-D P_LORA_SCLK=9 |
|||
-D P_LORA_MISO=11 |
|||
-D P_LORA_MOSI=10 |
|||
-D P_LORA_PA_POWER=7 |
|||
-D P_LORA_KCT8103L_PA_CSD=2 |
|||
-D P_LORA_KCT8103L_PA_CTX=5 |
|||
-D P_LORA_TX_LED=46 |
|||
-D PIN_USER_BTN=0 |
|||
-D PIN_VEXT_EN=40 |
|||
-D PIN_VEXT_EN_ACTIVE=LOW |
|||
-D ADC_MULTIPLIER=5.0715f |
|||
-D PIN_VBAT_READ=1 |
|||
-D LORA_TX_POWER=10 |
|||
-D MAX_LORA_TX_POWER=22 |
|||
-D SX126X_REGISTER_PATCH=1 |
|||
-D SX126X_DIO2_AS_RF_SWITCH=true |
|||
-D SX126X_DIO3_TCXO_VOLTAGE=1.8 |
|||
-D SX126X_CURRENT_LIMIT=140 |
|||
-D SX126X_RX_BOOSTED_GAIN=1 |
|||
-D PIN_GPS_RX=38 |
|||
-D PIN_GPS_TX=39 |
|||
-D PIN_GPS_EN=42 |
|||
-D PIN_GPS_EN_ACTIVE=LOW |
|||
-D ENV_INCLUDE_GPS=1 |
|||
build_src_filter = ${esp32_base.build_src_filter} |
|||
+<../variants/heltec_v4_r8> |
|||
+<helpers/sensors> |
|||
lib_deps = |
|||
${esp32_base.lib_deps} |
|||
${sensor_base.lib_deps} |
|||
|
|||
[heltec_v4_r8_oled] |
|||
extends = Heltec_v4_r8 |
|||
build_flags = |
|||
${Heltec_v4_r8.build_flags} |
|||
-D HELTEC_V4_R8_OLED |
|||
-D PIN_BOARD_SDA=17 |
|||
-D PIN_BOARD_SCL=18 |
|||
-D PIN_OLED_RESET=21 |
|||
build_src_filter = ${Heltec_v4_r8.build_src_filter} |
|||
lib_deps = ${Heltec_v4_r8.lib_deps} |
|||
|
|||
[heltec_v4_r8_tft] |
|||
extends = Heltec_v4_r8 |
|||
build_flags = |
|||
${Heltec_v4_r8.build_flags} |
|||
-D HELTEC_V4_R8_TFT |
|||
-D PIN_BOARD_SDA=17 |
|||
-D PIN_BOARD_SCL=18 |
|||
-D DISPLAY_SCALE_X=2.5 |
|||
-D DISPLAY_SCALE_Y=3.75 |
|||
-D PIN_TFT_RST=-1 |
|||
-D PIN_TFT_VDD_CTL=-1 |
|||
-D PIN_TFT_LEDA_CTL=44 |
|||
-D PIN_TFT_LEDA_CTL_ACTIVE=HIGH |
|||
-D PIN_TFT_CS=47 |
|||
-D PIN_TFT_DC=48 |
|||
-D PIN_TFT_SCL=16 |
|||
-D PIN_TFT_SDA=15 |
|||
-D PIN_TFT_MISO=45 |
|||
-D PIN_BUZZER=4 |
|||
-D PIN_TOUCH_RST=21 |
|||
build_src_filter = ${Heltec_v4_r8.build_src_filter} |
|||
+<helpers/ui/buzzer.cpp> |
|||
lib_deps = |
|||
${Heltec_v4_r8.lib_deps} |
|||
adafruit/Adafruit ST7735 and ST7789 Library @ ^1.11.0 |
|||
end2endzone/NonBlockingRTTTL@^1.3.0 |
|||
|
|||
[env:heltec_v4_r8_repeater] |
|||
extends = heltec_v4_r8_oled |
|||
build_flags = |
|||
${heltec_v4_r8_oled.build_flags} |
|||
-D DISPLAY_CLASS=SSD1306Display |
|||
-D ADVERT_NAME='"Heltec R8 Repeater"' |
|||
-D ADVERT_LAT=0.0 |
|||
-D ADVERT_LON=0.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
-D MAX_NEIGHBOURS=50 |
|||
build_src_filter = ${heltec_v4_r8_oled.build_src_filter} |
|||
+<helpers/ui/SSD1306Display.cpp> |
|||
+<../examples/simple_repeater> |
|||
lib_deps = |
|||
${heltec_v4_r8_oled.lib_deps} |
|||
${esp32_ota.lib_deps} |
|||
bakercp/CRC32 @ ^2.0.0 |
|||
|
|||
[env:heltec_v4_r8_room_server] |
|||
extends = heltec_v4_r8_oled |
|||
build_flags = |
|||
${heltec_v4_r8_oled.build_flags} |
|||
-D DISPLAY_CLASS=SSD1306Display |
|||
-D ADVERT_NAME='"Heltec R8 Room"' |
|||
-D ADVERT_LAT=0.0 |
|||
-D ADVERT_LON=0.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
-D ROOM_PASSWORD='"hello"' |
|||
build_src_filter = ${heltec_v4_r8_oled.build_src_filter} |
|||
+<helpers/ui/SSD1306Display.cpp> |
|||
+<../examples/simple_room_server> |
|||
lib_deps = |
|||
${heltec_v4_r8_oled.lib_deps} |
|||
${esp32_ota.lib_deps} |
|||
|
|||
[env:heltec_v4_r8_terminal_chat] |
|||
extends = heltec_v4_r8_oled |
|||
build_flags = |
|||
${heltec_v4_r8_oled.build_flags} |
|||
-D MAX_CONTACTS=350 |
|||
-D MAX_GROUP_CHANNELS=1 |
|||
build_src_filter = ${heltec_v4_r8_oled.build_src_filter} |
|||
+<../examples/simple_secure_chat/main.cpp> |
|||
lib_deps = |
|||
${heltec_v4_r8_oled.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
|
|||
[env:heltec_v4_r8_companion_radio_usb] |
|||
extends = heltec_v4_r8_oled |
|||
build_flags = |
|||
${heltec_v4_r8_oled.build_flags} |
|||
-I examples/companion_radio/ui-new |
|||
-D MAX_CONTACTS=350 |
|||
-D MAX_GROUP_CHANNELS=40 |
|||
-D DISPLAY_CLASS=SSD1306Display |
|||
build_src_filter = ${heltec_v4_r8_oled.build_src_filter} |
|||
+<helpers/ui/SSD1306Display.cpp> |
|||
+<helpers/ui/MomentaryButton.cpp> |
|||
+<../examples/companion_radio/*.cpp> |
|||
+<../examples/companion_radio/ui-new/*.cpp> |
|||
lib_deps = |
|||
${heltec_v4_r8_oled.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
|
|||
[env:heltec_v4_r8_companion_radio_ble] |
|||
extends = heltec_v4_r8_oled |
|||
build_flags = |
|||
${heltec_v4_r8_oled.build_flags} |
|||
-I examples/companion_radio/ui-new |
|||
-D MAX_CONTACTS=350 |
|||
-D MAX_GROUP_CHANNELS=40 |
|||
-D DISPLAY_CLASS=SSD1306Display |
|||
-D BLE_PIN_CODE=123456 |
|||
-D AUTO_SHUTDOWN_MILLIVOLTS=3400 |
|||
-D BLE_DEBUG_LOGGING=1 |
|||
-D OFFLINE_QUEUE_SIZE=256 |
|||
build_src_filter = ${heltec_v4_r8_oled.build_src_filter} |
|||
+<helpers/ui/SSD1306Display.cpp> |
|||
+<helpers/ui/MomentaryButton.cpp> |
|||
+<helpers/esp32/*.cpp> |
|||
+<../examples/companion_radio/*.cpp> |
|||
+<../examples/companion_radio/ui-new/*.cpp> |
|||
lib_deps = |
|||
${heltec_v4_r8_oled.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
|
|||
[env:heltec_v4_r8_companion_radio_wifi] |
|||
extends = heltec_v4_r8_oled |
|||
build_flags = |
|||
${heltec_v4_r8_oled.build_flags} |
|||
-I examples/companion_radio/ui-new |
|||
-D MAX_CONTACTS=350 |
|||
-D MAX_GROUP_CHANNELS=40 |
|||
-D OFFLINE_QUEUE_SIZE=256 |
|||
-D DISPLAY_CLASS=SSD1306Display |
|||
-D WIFI_DEBUG_LOGGING=1 |
|||
-D WIFI_SSID='"myssid"' |
|||
-D WIFI_PWD='"mypwd"' |
|||
build_src_filter = ${heltec_v4_r8_oled.build_src_filter} |
|||
+<helpers/ui/SSD1306Display.cpp> |
|||
+<helpers/ui/MomentaryButton.cpp> |
|||
+<helpers/esp32/*.cpp> |
|||
+<../examples/companion_radio/*.cpp> |
|||
+<../examples/companion_radio/ui-new/*.cpp> |
|||
lib_deps = |
|||
${heltec_v4_r8_oled.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
|
|||
[env:heltec_v4_r8_sensor] |
|||
extends = heltec_v4_r8_oled |
|||
build_flags = |
|||
${heltec_v4_r8_oled.build_flags} |
|||
-D ADVERT_NAME='"Heltec R8 Sensor"' |
|||
-D ADVERT_LAT=0.0 |
|||
-D ADVERT_LON=0.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
-D DISPLAY_CLASS=SSD1306Display |
|||
build_src_filter = ${heltec_v4_r8_oled.build_src_filter} |
|||
+<helpers/ui/SSD1306Display.cpp> |
|||
+<../examples/simple_sensor> |
|||
lib_deps = |
|||
${heltec_v4_r8_oled.lib_deps} |
|||
${esp32_ota.lib_deps} |
|||
|
|||
[env:heltec_v4_r8_tft_repeater] |
|||
extends = heltec_v4_r8_tft |
|||
build_flags = |
|||
${heltec_v4_r8_tft.build_flags} |
|||
-D DISPLAY_CLASS=ST7789LCDDisplay |
|||
-D ADVERT_NAME='"Heltec R8 Repeater"' |
|||
-D ADVERT_LAT=0.0 |
|||
-D ADVERT_LON=0.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
-D MAX_NEIGHBOURS=50 |
|||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter} |
|||
+<helpers/ui/ST7789LCDDisplay.cpp> |
|||
+<../examples/simple_repeater> |
|||
lib_deps = |
|||
${heltec_v4_r8_tft.lib_deps} |
|||
${esp32_ota.lib_deps} |
|||
bakercp/CRC32 @ ^2.0.0 |
|||
|
|||
[env:heltec_v4_r8_tft_room_server] |
|||
extends = heltec_v4_r8_tft |
|||
build_flags = |
|||
${heltec_v4_r8_tft.build_flags} |
|||
-D DISPLAY_CLASS=ST7789LCDDisplay |
|||
-D ADVERT_NAME='"Heltec R8 Room"' |
|||
-D ADVERT_LAT=0.0 |
|||
-D ADVERT_LON=0.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
-D ROOM_PASSWORD='"hello"' |
|||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter} |
|||
+<helpers/ui/ST7789LCDDisplay.cpp> |
|||
+<../examples/simple_room_server> |
|||
lib_deps = |
|||
${heltec_v4_r8_tft.lib_deps} |
|||
${esp32_ota.lib_deps} |
|||
|
|||
[env:heltec_v4_r8_tft_terminal_chat] |
|||
extends = heltec_v4_r8_tft |
|||
build_flags = |
|||
${heltec_v4_r8_tft.build_flags} |
|||
-D MAX_CONTACTS=350 |
|||
-D MAX_GROUP_CHANNELS=1 |
|||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter} |
|||
+<../examples/simple_secure_chat/main.cpp> |
|||
lib_deps = |
|||
${heltec_v4_r8_tft.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
|
|||
[env:heltec_v4_r8_tft_companion_radio_usb] |
|||
extends = heltec_v4_r8_tft |
|||
build_flags = |
|||
${heltec_v4_r8_tft.build_flags} |
|||
-I examples/companion_radio/ui-new |
|||
-D MAX_CONTACTS=350 |
|||
-D MAX_GROUP_CHANNELS=40 |
|||
-D DISPLAY_CLASS=ST7789LCDDisplay |
|||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter} |
|||
+<helpers/ui/ST7789LCDDisplay.cpp> |
|||
+<helpers/ui/MomentaryButton.cpp> |
|||
+<../examples/companion_radio/*.cpp> |
|||
+<../examples/companion_radio/ui-new/*.cpp> |
|||
lib_deps = |
|||
${heltec_v4_r8_tft.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
|
|||
[env:heltec_v4_r8_tft_companion_radio_ble] |
|||
extends = heltec_v4_r8_tft |
|||
build_flags = |
|||
${heltec_v4_r8_tft.build_flags} |
|||
-I examples/companion_radio/ui-new |
|||
-D DISPLAY_CLASS=ST7789LCDDisplay |
|||
-D MAX_CONTACTS=350 |
|||
-D MAX_GROUP_CHANNELS=40 |
|||
-D BLE_PIN_CODE=123456 |
|||
-D AUTO_SHUTDOWN_MILLIVOLTS=3400 |
|||
-D BLE_DEBUG_LOGGING=1 |
|||
-D OFFLINE_QUEUE_SIZE=256 |
|||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter} |
|||
+<helpers/ui/ST7789LCDDisplay.cpp> |
|||
+<helpers/ui/MomentaryButton.cpp> |
|||
+<helpers/esp32/*.cpp> |
|||
+<../examples/companion_radio/*.cpp> |
|||
+<../examples/companion_radio/ui-new/*.cpp> |
|||
lib_deps = |
|||
${heltec_v4_r8_tft.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
|
|||
[env:heltec_v4_r8_tft_companion_radio_wifi] |
|||
extends = heltec_v4_r8_tft |
|||
build_flags = |
|||
${heltec_v4_r8_tft.build_flags} |
|||
-I examples/companion_radio/ui-new |
|||
-D MAX_CONTACTS=350 |
|||
-D MAX_GROUP_CHANNELS=40 |
|||
-D OFFLINE_QUEUE_SIZE=256 |
|||
-D DISPLAY_CLASS=ST7789LCDDisplay |
|||
-D WIFI_DEBUG_LOGGING=1 |
|||
-D WIFI_SSID='"myssid"' |
|||
-D WIFI_PWD='"mypwd"' |
|||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter} |
|||
+<helpers/ui/ST7789LCDDisplay.cpp> |
|||
+<helpers/ui/MomentaryButton.cpp> |
|||
+<helpers/esp32/*.cpp> |
|||
+<../examples/companion_radio/*.cpp> |
|||
+<../examples/companion_radio/ui-new/*.cpp> |
|||
lib_deps = |
|||
${heltec_v4_r8_tft.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
|
|||
[env:heltec_v4_r8_tft_sensor] |
|||
extends = heltec_v4_r8_tft |
|||
build_flags = |
|||
${heltec_v4_r8_tft.build_flags} |
|||
-D ADVERT_NAME='"Heltec R8 Sensor"' |
|||
-D ADVERT_LAT=0.0 |
|||
-D ADVERT_LON=0.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
-D DISPLAY_CLASS=ST7789LCDDisplay |
|||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter} |
|||
+<helpers/ui/ST7789LCDDisplay.cpp> |
|||
+<../examples/simple_sensor> |
|||
lib_deps = |
|||
${heltec_v4_r8_tft.lib_deps} |
|||
${esp32_ota.lib_deps} |
|||
|
|||
[env:heltec_v4_r8_kiss_modem] |
|||
extends = Heltec_v4_r8 |
|||
build_src_filter = ${Heltec_v4_r8.build_src_filter} |
|||
+<../examples/kiss_modem/> |
|||
|
|||
[env:heltec_v4_r8_tft_kiss_modem] |
|||
extends = heltec_v4_r8_tft |
|||
build_src_filter = ${heltec_v4_r8_tft.build_src_filter} |
|||
+<../examples/kiss_modem/> |
|||
@ -0,0 +1,45 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
HeltecV4R8Board board; |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
static SPIClass spi; |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi); |
|||
#else |
|||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY); |
|||
#endif |
|||
|
|||
WRAPPER_CLASS radio_driver(radio, board); |
|||
|
|||
ESP32RTCClock fallback_clock; |
|||
AutoDiscoverRTCClock rtc_clock(fallback_clock); |
|||
|
|||
#if ENV_INCLUDE_GPS |
|||
#include <helpers/sensors/MicroNMEALocationProvider.h> |
|||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock, GPS_RESET, GPS_EN, &board.periph_power); |
|||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea); |
|||
#else |
|||
EnvironmentSensorManager sensors; |
|||
#endif |
|||
|
|||
#ifdef DISPLAY_CLASS |
|||
DISPLAY_CLASS display(&board.periph_power); |
|||
MomentaryButton user_btn(PIN_USER_BTN, 1000, true); |
|||
#endif |
|||
|
|||
bool radio_init() { |
|||
fallback_clock.begin(); |
|||
rtc_clock.begin(Wire); |
|||
|
|||
#if defined(P_LORA_SCLK) |
|||
return radio.std_init(&spi); |
|||
#else |
|||
return radio.std_init(); |
|||
#endif |
|||
} |
|||
|
|||
mesh::LocalIdentity radio_new_identity() { |
|||
RadioNoiseListener rng(radio); |
|||
return mesh::LocalIdentity(&rng); |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <HeltecV4R8Board.h> |
|||
#include <helpers/AutoDiscoverRTCClock.h> |
|||
#include <helpers/SensorManager.h> |
|||
#include <helpers/radiolib/CustomSX1262Wrapper.h> |
|||
#include <helpers/radiolib/RadioLibWrappers.h> |
|||
#include <helpers/sensors/EnvironmentSensorManager.h> |
|||
#ifdef DISPLAY_CLASS |
|||
#ifdef HELTEC_V4_R8_OLED |
|||
#include <helpers/ui/SSD1306Display.h> |
|||
#elif defined(HELTEC_V4_R8_TFT) |
|||
#include <helpers/ui/ST7789LCDDisplay.h> |
|||
#endif |
|||
#include <helpers/ui/MomentaryButton.h> |
|||
#endif |
|||
|
|||
extern HeltecV4R8Board board; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
extern AutoDiscoverRTCClock rtc_clock; |
|||
extern EnvironmentSensorManager sensors; |
|||
|
|||
#ifdef DISPLAY_CLASS |
|||
extern DISPLAY_CLASS display; |
|||
extern MomentaryButton user_btn; |
|||
#endif |
|||
|
|||
bool radio_init(); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
Loading…
Reference in new issue