mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-09-14 15:16:40 +00:00
Merge pull request #2966 from Quency-D/heltec-rc32
Add Heltec rc32 board
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
#include "HeltecRC32Board.h"
|
||||
|
||||
void HeltecRC32Board::begin() {
|
||||
ESP32Board::begin();
|
||||
|
||||
pinMode(PIN_ADC_CTRL, OUTPUT);
|
||||
digitalWrite(PIN_ADC_CTRL, !ADC_CTRL_ENABLED);
|
||||
|
||||
#ifdef SENSOR_RST_PIN
|
||||
pinMode(SENSOR_RST_PIN, OUTPUT);
|
||||
digitalWrite(SENSOR_RST_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
#ifdef LED_POWER
|
||||
pinMode(LED_POWER, OUTPUT);
|
||||
digitalWrite(LED_POWER, LOW);
|
||||
#endif
|
||||
|
||||
periph_power.begin();
|
||||
periph_power.claim();
|
||||
|
||||
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 & (1L << 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 HeltecRC32Board::powerOff() {
|
||||
enterDeepSleep(0);
|
||||
}
|
||||
|
||||
void HeltecRC32Board::onBeforeTransmit() {
|
||||
digitalWrite(P_LORA_TX_LED, HIGH);
|
||||
}
|
||||
|
||||
void HeltecRC32Board::onAfterTransmit() {
|
||||
digitalWrite(P_LORA_TX_LED, LOW);
|
||||
}
|
||||
|
||||
uint16_t HeltecRC32Board::getBattMilliVolts() {
|
||||
analogReadResolution(12);
|
||||
analogSetAttenuation(ADC_2_5db);
|
||||
digitalWrite(PIN_ADC_CTRL, ADC_CTRL_ENABLED);
|
||||
delay(10);
|
||||
uint32_t raw = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
raw += analogReadMilliVolts(PIN_VBAT_READ);
|
||||
}
|
||||
raw = raw / 8;
|
||||
digitalWrite(PIN_ADC_CTRL, !ADC_CTRL_ENABLED);
|
||||
|
||||
return (adc_mult * raw);
|
||||
}
|
||||
|
||||
bool HeltecRC32Board::setAdcMultiplier(float multiplier) {
|
||||
adc_mult = multiplier == 0.0f ? ADC_MULTIPLIER : multiplier;
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* HeltecRC32Board::getManufacturerName() const {
|
||||
return "Heltec RC32";
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <driver/rtc_io.h>
|
||||
#include <helpers/ESP32Board.h>
|
||||
#include <helpers/RefCountedDigitalPin.h>
|
||||
|
||||
#ifndef ADC_MULTIPLIER
|
||||
#define ADC_MULTIPLIER 4.9f
|
||||
#endif
|
||||
|
||||
class HeltecRC32Board : public ESP32Board {
|
||||
protected:
|
||||
float adc_mult = ADC_MULTIPLIER;
|
||||
|
||||
public:
|
||||
RefCountedDigitalPin periph_power;
|
||||
|
||||
HeltecRC32Board() : periph_power(SENSOR_POWER_CTRL_PIN, SENSOR_POWER_ON){}
|
||||
|
||||
void begin();
|
||||
void onBeforeTransmit() override;
|
||||
void onAfterTransmit() override;
|
||||
void powerOff() override;
|
||||
uint16_t getBattMilliVolts() override;
|
||||
bool setAdcMultiplier(float multiplier) override;
|
||||
float getAdcMultiplier() const override { return adc_mult; }
|
||||
const char* getManufacturerName() const override;
|
||||
};
|
||||
@@ -0,0 +1,122 @@
|
||||
#include "HeltecRC32RotaryInput.h"
|
||||
|
||||
#include <Wire.h>
|
||||
|
||||
namespace {
|
||||
constexpr uint8_t TCA6408_ADDR = 0x20;
|
||||
constexpr uint8_t TCA6408_INPUT_REG = 0x00;
|
||||
constexpr uint8_t TCA6408_POLARITY_REG = 0x02;
|
||||
constexpr uint8_t TCA6408_CONFIG_REG = 0x03;
|
||||
constexpr uint8_t TCA6408_ROTARY_A_MASK = 0x01;
|
||||
constexpr uint8_t TCA6408_ROTARY_B_MASK = 0x02;
|
||||
constexpr uint8_t TCA6408_ROTARY_MASK = TCA6408_ROTARY_A_MASK | TCA6408_ROTARY_B_MASK;
|
||||
constexpr uint32_t TCA6408_DEBOUNCE_MS = 5;
|
||||
}
|
||||
|
||||
bool HeltecRC32RotaryInput::begin() {
|
||||
initialized = true;
|
||||
ready = false;
|
||||
input_state = TCA6408_ROTARY_MASK;
|
||||
active_low_phase = false;
|
||||
|
||||
if (periph_power && !power_claimed) {
|
||||
periph_power->claim();
|
||||
power_claimed = true;
|
||||
delay(12);
|
||||
}
|
||||
|
||||
if (!writeRegister(TCA6408_POLARITY_REG, 0x00) || !writeRegister(TCA6408_CONFIG_REG, 0xFF)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t state = 0;
|
||||
if (!readInput(state)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
input_state = state & TCA6408_ROTARY_MASK;
|
||||
ready = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
RotaryInputEvent HeltecRC32RotaryInput::poll() {
|
||||
if (!initialized) {
|
||||
begin();
|
||||
return RotaryInputEvent::None;
|
||||
}
|
||||
|
||||
if (!ready) {
|
||||
return RotaryInputEvent::None;
|
||||
}
|
||||
|
||||
uint8_t new_state = 0;
|
||||
if (!readInput(new_state)) {
|
||||
return RotaryInputEvent::None;
|
||||
}
|
||||
|
||||
new_state &= TCA6408_ROTARY_MASK;
|
||||
RotaryInputEvent event = handleTransition(new_state);
|
||||
input_state = new_state;
|
||||
return event;
|
||||
}
|
||||
|
||||
bool HeltecRC32RotaryInput::writeRegister(uint8_t reg, uint8_t value) {
|
||||
Wire.beginTransmission(TCA6408_ADDR);
|
||||
Wire.write(reg);
|
||||
Wire.write(value);
|
||||
return Wire.endTransmission() == 0;
|
||||
}
|
||||
|
||||
bool HeltecRC32RotaryInput::readInput(uint8_t& value) {
|
||||
Wire.beginTransmission(TCA6408_ADDR);
|
||||
Wire.write(TCA6408_INPUT_REG);
|
||||
if (Wire.endTransmission(false) != 0) {
|
||||
return false;
|
||||
}
|
||||
if (Wire.requestFrom(TCA6408_ADDR, static_cast<uint8_t>(1)) != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = Wire.read();
|
||||
return true;
|
||||
}
|
||||
|
||||
RotaryInputEvent HeltecRC32RotaryInput::handleTransition(uint8_t newState) {
|
||||
uint8_t changed = (input_state ^ newState) & TCA6408_ROTARY_MASK;
|
||||
RotaryInputEvent event = RotaryInputEvent::None;
|
||||
bool a_low = (newState & TCA6408_ROTARY_A_MASK) == 0;
|
||||
bool b_low = (newState & TCA6408_ROTARY_B_MASK) == 0;
|
||||
|
||||
if (!a_low && !b_low) {
|
||||
active_low_phase = false;
|
||||
}
|
||||
|
||||
if (!active_low_phase && (changed & TCA6408_ROTARY_A_MASK) && a_low && !b_low) {
|
||||
event = RotaryInputEvent::Prev;
|
||||
active_low_phase = true;
|
||||
} else if (!active_low_phase && (changed & TCA6408_ROTARY_B_MASK) && b_low && !a_low) {
|
||||
event = RotaryInputEvent::Next;
|
||||
active_low_phase = true;
|
||||
}
|
||||
|
||||
if (event == RotaryInputEvent::None && !active_low_phase && (changed & TCA6408_ROTARY_A_MASK)) {
|
||||
bool a_rising = (newState & TCA6408_ROTARY_A_MASK) != 0;
|
||||
if (a_rising && b_low) {
|
||||
event = RotaryInputEvent::Prev;
|
||||
}
|
||||
}
|
||||
|
||||
if (event == RotaryInputEvent::None && !active_low_phase && (changed & TCA6408_ROTARY_B_MASK)) {
|
||||
bool b_rising = (newState & TCA6408_ROTARY_B_MASK) != 0;
|
||||
if (b_rising && a_low) {
|
||||
event = RotaryInputEvent::Next;
|
||||
}
|
||||
}
|
||||
|
||||
if (event == RotaryInputEvent::None || (millis() - last_event_ms) < TCA6408_DEBOUNCE_MS) {
|
||||
return RotaryInputEvent::None;
|
||||
}
|
||||
|
||||
last_event_ms = millis();
|
||||
return event;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <helpers/RefCountedDigitalPin.h>
|
||||
#include <helpers/ui/RotaryInput.h>
|
||||
|
||||
class HeltecRC32RotaryInput : public RotaryInput {
|
||||
public:
|
||||
explicit HeltecRC32RotaryInput(RefCountedDigitalPin* periphPower = nullptr) : periph_power(periphPower) { }
|
||||
|
||||
bool begin() override;
|
||||
RotaryInputEvent poll() override;
|
||||
bool isReady() const override { return ready; }
|
||||
|
||||
private:
|
||||
bool writeRegister(uint8_t reg, uint8_t value);
|
||||
bool readInput(uint8_t& value);
|
||||
RotaryInputEvent handleTransition(uint8_t newState);
|
||||
|
||||
uint8_t input_state = 0x03;
|
||||
uint32_t last_event_ms = 0;
|
||||
bool ready = false;
|
||||
bool initialized = false;
|
||||
bool power_claimed = false;
|
||||
bool active_low_phase = false;
|
||||
RefCountedDigitalPin* periph_power = nullptr;
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
#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 = 21;
|
||||
static const uint8_t SCL = 18;
|
||||
|
||||
static const uint8_t SS = 10;
|
||||
static const uint8_t MOSI = 12;
|
||||
static const uint8_t MISO = 13;
|
||||
static const uint8_t SCK = 11;
|
||||
|
||||
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;
|
||||
|
||||
static const uint8_t RST_LoRa = 9;
|
||||
static const uint8_t BUSY_LoRa = 1;
|
||||
static const uint8_t DIO1_LoRa = 14;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,348 @@
|
||||
[Heltec_RC32]
|
||||
extends = esp32_base
|
||||
board = heltec-rc32
|
||||
board_build.partitions = default_16MB.csv
|
||||
build_flags =
|
||||
${esp32_base.build_flags}
|
||||
${sensor_base.build_flags}
|
||||
-I variants/heltec_rc32
|
||||
-I src/helpers/ui
|
||||
-D HELTEC_RC32
|
||||
-D USE_SX1262
|
||||
-D ESP32_CPU_FREQ=160
|
||||
-D RADIO_CLASS=CustomSX1262
|
||||
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||
-D P_LORA_DIO_1=14
|
||||
-D P_LORA_NSS=10
|
||||
-D P_LORA_RESET=9
|
||||
-D P_LORA_BUSY=1
|
||||
-D P_LORA_SCLK=11
|
||||
-D P_LORA_MISO=13
|
||||
-D P_LORA_MOSI=12
|
||||
-D LORA_TX_POWER=22
|
||||
-D PIN_USER_BTN=0
|
||||
-D PIN_BOARD_SDA=21
|
||||
-D PIN_BOARD_SCL=18
|
||||
-D SENSOR_POWER_CTRL_PIN=46
|
||||
-D SENSOR_POWER_ON=HIGH
|
||||
-D SENSOR_RST_PIN=2
|
||||
-D P_LORA_TX_LED=47
|
||||
-D PIN_BUZZER=48
|
||||
-D PIN_TFT_SCL=17
|
||||
-D PIN_TFT_SDA=38
|
||||
-D PIN_TFT_CS=39
|
||||
-D PIN_TFT_DC=16
|
||||
-D PIN_TFT_RST=4
|
||||
-D PIN_TFT_EN=6
|
||||
-D PIN_TFT_EN_ACTIVE=LOW
|
||||
-D PIN_TFT_BL=5
|
||||
-D PIN_TFT_BL_ACTIVE=HIGH
|
||||
-D SPI_FREQUENCY=8000000
|
||||
-D PIN_GPS_TX=44
|
||||
-D PIN_GPS_RX=43
|
||||
-D PIN_GPS_EN=45
|
||||
-D PIN_GPS_EN_ACTIVE=HIGH
|
||||
-D PIN_GPS_RESET=40
|
||||
-D PIN_GPS_RESET_ACTIVE=LOW
|
||||
-D PIN_GPS_PPS=41
|
||||
-D GPS_BAUD_RATE=9600
|
||||
-D ENV_INCLUDE_GPS=1
|
||||
-D PIN_ADC_CTRL=15
|
||||
-D PIN_VBAT_READ=7
|
||||
-D ADC_CTRL_ENABLED=HIGH
|
||||
-D ADC_MULTIPLIER=4.9
|
||||
-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 SX126X_REGISTER_PATCH=1 ; Patch register 0x8B5 for improved RX
|
||||
build_src_filter = ${esp32_base.build_src_filter}
|
||||
+<../variants/heltec_rc32>
|
||||
+<helpers/sensors>
|
||||
lib_deps =
|
||||
${esp32_base.lib_deps}
|
||||
${sensor_base.lib_deps}
|
||||
|
||||
[Heltec_RC32_with_display]
|
||||
extends = Heltec_RC32
|
||||
build_flags =
|
||||
${Heltec_RC32.build_flags}
|
||||
-D HELTEC_RC32_WITH_DISPLAY
|
||||
-D DISPLAY_CLASS=NV3001BDisplay
|
||||
build_src_filter = ${Heltec_RC32.build_src_filter}
|
||||
+<helpers/ui/NV3001BDisplay.cpp>
|
||||
+<helpers/ui/MomentaryButton.cpp>
|
||||
lib_deps =
|
||||
${Heltec_RC32.lib_deps}
|
||||
|
||||
[env:heltec_rc32_without_display_repeater]
|
||||
extends = Heltec_RC32
|
||||
build_flags =
|
||||
${Heltec_RC32.build_flags}
|
||||
-D ADVERT_NAME='"Heltec RC32 Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=50
|
||||
build_src_filter = ${Heltec_RC32.build_src_filter}
|
||||
+<../examples/simple_repeater>
|
||||
lib_deps =
|
||||
${Heltec_RC32.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
bakercp/CRC32 @ ^2.0.0
|
||||
|
||||
[env:heltec_rc32_without_display_repeater_bridge_espnow]
|
||||
extends = Heltec_RC32
|
||||
build_flags =
|
||||
${Heltec_RC32.build_flags}
|
||||
-D ADVERT_NAME='"ESPNow Bridge"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=50
|
||||
-D WITH_ESPNOW_BRIDGE=1
|
||||
build_src_filter = ${Heltec_RC32.build_src_filter}
|
||||
+<helpers/bridges/ESPNowBridge.cpp>
|
||||
+<../examples/simple_repeater>
|
||||
lib_deps =
|
||||
${Heltec_RC32.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:heltec_rc32_without_display_room_server]
|
||||
extends = Heltec_RC32
|
||||
build_flags =
|
||||
${Heltec_RC32.build_flags}
|
||||
-D ADVERT_NAME='"Heltec RC32 Room"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D ROOM_PASSWORD='"hello"'
|
||||
build_src_filter = ${Heltec_RC32.build_src_filter}
|
||||
+<../examples/simple_room_server>
|
||||
lib_deps =
|
||||
${Heltec_RC32.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:heltec_rc32_without_display_companion_radio_usb]
|
||||
extends = Heltec_RC32
|
||||
build_flags =
|
||||
${Heltec_RC32.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D DISPLAY_CLASS=NullDisplayDriver
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
build_src_filter = ${Heltec_RC32.build_src_filter}
|
||||
+<helpers/ui/MomentaryButton.cpp>
|
||||
+<helpers/ui/buzzer.cpp>
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
lib_deps =
|
||||
${Heltec_RC32.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
end2endzone/NonBlockingRTTTL@^1.3.0
|
||||
|
||||
[env:heltec_rc32_without_display_companion_radio_ble]
|
||||
extends = Heltec_RC32
|
||||
build_flags =
|
||||
${Heltec_RC32.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D DISPLAY_CLASS=NullDisplayDriver
|
||||
-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_RC32.build_src_filter}
|
||||
+<helpers/ui/MomentaryButton.cpp>
|
||||
+<helpers/ui/buzzer.cpp>
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
lib_deps =
|
||||
${Heltec_RC32.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
end2endzone/NonBlockingRTTTL@^1.3.0
|
||||
|
||||
[env:heltec_rc32_without_display_companion_radio_wifi]
|
||||
extends = Heltec_RC32
|
||||
build_flags =
|
||||
${Heltec_RC32.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D DISPLAY_CLASS=NullDisplayDriver
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D WIFI_DEBUG_LOGGING=1
|
||||
-D WIFI_SSID='"myssid"'
|
||||
-D WIFI_PWD='"mypwd"'
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
build_src_filter = ${Heltec_RC32.build_src_filter}
|
||||
+<helpers/ui/MomentaryButton.cpp>
|
||||
+<helpers/ui/buzzer.cpp>
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
lib_deps =
|
||||
${Heltec_RC32.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
end2endzone/NonBlockingRTTTL@^1.3.0
|
||||
|
||||
[env:heltec_rc32_without_display_sensor]
|
||||
extends = Heltec_RC32
|
||||
build_flags =
|
||||
${Heltec_RC32.build_flags}
|
||||
-D ADVERT_NAME='"Heltec RC32 Sensor"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D ENV_PIN_SDA=21
|
||||
-D ENV_PIN_SCL=18
|
||||
build_src_filter = ${Heltec_RC32.build_src_filter}
|
||||
+<../examples/simple_sensor>
|
||||
lib_deps =
|
||||
${Heltec_RC32.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:heltec_rc32_repeater]
|
||||
extends = Heltec_RC32_with_display
|
||||
build_flags =
|
||||
${Heltec_RC32_with_display.build_flags}
|
||||
-D ADVERT_NAME='"Heltec RC32 Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=50
|
||||
build_src_filter = ${Heltec_RC32_with_display.build_src_filter}
|
||||
+<../examples/simple_repeater>
|
||||
lib_deps =
|
||||
${Heltec_RC32_with_display.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
bakercp/CRC32 @ ^2.0.0
|
||||
|
||||
[env:heltec_rc32_repeater_bridge_espnow]
|
||||
extends = Heltec_RC32_with_display
|
||||
build_flags =
|
||||
${Heltec_RC32_with_display.build_flags}
|
||||
-D ADVERT_NAME='"ESPNow Bridge"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=50
|
||||
-D WITH_ESPNOW_BRIDGE=1
|
||||
build_src_filter = ${Heltec_RC32_with_display.build_src_filter}
|
||||
+<helpers/bridges/ESPNowBridge.cpp>
|
||||
+<../examples/simple_repeater>
|
||||
lib_deps =
|
||||
${Heltec_RC32_with_display.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:heltec_rc32_room_server]
|
||||
extends = Heltec_RC32_with_display
|
||||
build_flags =
|
||||
${Heltec_RC32_with_display.build_flags}
|
||||
-D ADVERT_NAME='"Heltec RC32 Room"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D ROOM_PASSWORD='"hello"'
|
||||
build_src_filter = ${Heltec_RC32_with_display.build_src_filter}
|
||||
+<../examples/simple_room_server>
|
||||
lib_deps =
|
||||
${Heltec_RC32_with_display.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:heltec_rc32_terminal_chat]
|
||||
extends = Heltec_RC32
|
||||
build_flags =
|
||||
${Heltec_RC32.build_flags}
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=1
|
||||
build_src_filter = ${Heltec_RC32.build_src_filter}
|
||||
+<../examples/simple_secure_chat/main.cpp>
|
||||
lib_deps =
|
||||
${Heltec_RC32.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:heltec_rc32_companion_radio_usb]
|
||||
extends = Heltec_RC32_with_display
|
||||
build_flags =
|
||||
${Heltec_RC32_with_display.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D UI_HAS_ROTARY_INPUT
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
build_src_filter = ${Heltec_RC32_with_display.build_src_filter}
|
||||
+<helpers/ui/buzzer.cpp>
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
lib_deps =
|
||||
${Heltec_RC32_with_display.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
end2endzone/NonBlockingRTTTL@^1.3.0
|
||||
|
||||
[env:heltec_rc32_companion_radio_ble]
|
||||
extends = Heltec_RC32_with_display
|
||||
build_flags =
|
||||
${Heltec_RC32_with_display.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D UI_HAS_ROTARY_INPUT
|
||||
-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_RC32_with_display.build_src_filter}
|
||||
+<helpers/ui/buzzer.cpp>
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
lib_deps =
|
||||
${Heltec_RC32_with_display.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
end2endzone/NonBlockingRTTTL@^1.3.0
|
||||
|
||||
[env:heltec_rc32_companion_radio_wifi]
|
||||
extends = Heltec_RC32_with_display
|
||||
build_flags =
|
||||
${Heltec_RC32_with_display.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D UI_HAS_ROTARY_INPUT
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D WIFI_DEBUG_LOGGING=1
|
||||
-D WIFI_SSID='"myssid"'
|
||||
-D WIFI_PWD='"mypwd"'
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
build_src_filter = ${Heltec_RC32_with_display.build_src_filter}
|
||||
+<helpers/ui/buzzer.cpp>
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
+<../examples/companion_radio/ui-new/*.cpp>
|
||||
lib_deps =
|
||||
${Heltec_RC32_with_display.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
end2endzone/NonBlockingRTTTL@^1.3.0
|
||||
|
||||
[env:heltec_rc32_sensor]
|
||||
extends = Heltec_RC32_with_display
|
||||
build_flags =
|
||||
${Heltec_RC32_with_display.build_flags}
|
||||
-D ADVERT_NAME='"Heltec RC32 Sensor"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D ENV_PIN_SDA=21
|
||||
-D ENV_PIN_SCL=18
|
||||
build_src_filter = ${Heltec_RC32_with_display.build_src_filter}
|
||||
+<../examples/simple_sensor>
|
||||
lib_deps =
|
||||
${Heltec_RC32_with_display.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:heltec_rc32_kiss_modem]
|
||||
extends = Heltec_RC32
|
||||
build_src_filter = ${Heltec_RC32.build_src_filter}
|
||||
+<../examples/kiss_modem/>
|
||||
@@ -0,0 +1,52 @@
|
||||
#include <Arduino.h>
|
||||
#include "target.h"
|
||||
#if defined(UI_HAS_ROTARY_INPUT)
|
||||
#include "HeltecRC32RotaryInput.h"
|
||||
#endif
|
||||
|
||||
HeltecRC32Board board;
|
||||
|
||||
#if defined(P_LORA_SCLK)
|
||||
static SPIClass spi(FSPI);
|
||||
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, PIN_GPS_RESET, PIN_GPS_EN);
|
||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||
#else
|
||||
EnvironmentSensorManager sensors;
|
||||
#endif
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
DISPLAY_CLASS display;
|
||||
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
|
||||
#if defined(UI_HAS_ROTARY_INPUT)
|
||||
static HeltecRC32RotaryInput rotaryInputImpl(&board.periph_power);
|
||||
RotaryInput& rotary_input = rotaryInputImpl;
|
||||
#endif
|
||||
#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,37 @@
|
||||
#pragma once
|
||||
|
||||
#define RADIOLIB_STATIC_ONLY 1
|
||||
#include <RadioLib.h>
|
||||
#include <HeltecRC32Board.h>
|
||||
#include <helpers/AutoDiscoverRTCClock.h>
|
||||
#include <helpers/radiolib/CustomSX1262Wrapper.h>
|
||||
#include <helpers/radiolib/RadioLibWrappers.h>
|
||||
#include <helpers/sensors/EnvironmentSensorManager.h>
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
#include <helpers/ui/MomentaryButton.h>
|
||||
#if defined(UI_HAS_ROTARY_INPUT)
|
||||
#include <helpers/ui/RotaryInput.h>
|
||||
#endif
|
||||
#ifdef HELTEC_RC32_WITH_DISPLAY
|
||||
#include <helpers/ui/NV3001BDisplay.h>
|
||||
#else
|
||||
#include <helpers/ui/NullDisplayDriver.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern HeltecRC32Board board;
|
||||
extern WRAPPER_CLASS radio_driver;
|
||||
extern AutoDiscoverRTCClock rtc_clock;
|
||||
extern EnvironmentSensorManager sensors;
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
extern DISPLAY_CLASS display;
|
||||
extern MomentaryButton user_btn;
|
||||
#if defined(UI_HAS_ROTARY_INPUT)
|
||||
extern RotaryInput& rotary_input;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool radio_init();
|
||||
mesh::LocalIdentity radio_new_identity();
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef _VARIANT_HELTEC_RC32_
|
||||
#define _VARIANT_HELTEC_RC32_
|
||||
|
||||
#define BUTTON_PIN 0
|
||||
|
||||
#define I2C_SCL 18
|
||||
#define I2C_SDA 21
|
||||
#define SENSOR_INT_PIN 42
|
||||
#define PERIPHERAL_WARMUP_MS 100
|
||||
|
||||
#define LORA_SCK 11
|
||||
#define LORA_MISO 13
|
||||
#define LORA_MOSI 12
|
||||
#define LORA_CS 10
|
||||
#define LORA_DIO0 RADIOLIB_NC
|
||||
#define LORA_DIO1 14
|
||||
#define LORA_RESET 9
|
||||
|
||||
#define SX126X_CS LORA_CS
|
||||
#define SX126X_DIO1 LORA_DIO1
|
||||
#define SX126X_BUSY 1
|
||||
#define SX126X_RESET LORA_RESET
|
||||
|
||||
#define BATTERY_PIN 7
|
||||
#define ADC_CHANNEL ADC_CHANNEL_6
|
||||
#define ADC_CTRL 15
|
||||
#define ADC_ATTENUATION ADC_ATTEN_DB_2_5
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user