mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-21 09:13:42 +00:00
Merge branch 'master' into esp-idf5
This commit is contained in:
commit
ec0914d245
@ -12,7 +12,7 @@ lint:
|
|||||||
- trufflehog@3.88.18
|
- trufflehog@3.88.18
|
||||||
- yamllint@1.37.0
|
- yamllint@1.37.0
|
||||||
- bandit@1.8.3
|
- bandit@1.8.3
|
||||||
- checkov@3.2.392
|
- checkov@3.2.394
|
||||||
- terrascan@1.19.9
|
- terrascan@1.19.9
|
||||||
- trivy@0.60.0
|
- trivy@0.60.0
|
||||||
- taplo@0.9.3
|
- taplo@0.9.3
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
; The Portduino based 'native' environment. Currently supported on Linux targets with real LoRa hardware (or simulated).
|
; The Portduino based 'native' environment. Currently supported on Linux targets with real LoRa hardware (or simulated).
|
||||||
[portduino_base]
|
[portduino_base]
|
||||||
platform = https://github.com/meshtastic/platform-native.git#e82ba1a19b6cd1dc55cbde29b33ea8dd0640014f
|
platform = https://github.com/meshtastic/platform-native.git#c5bd469ab9b5a6966321e09557b27d906961da63
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
|
53
boards/ThinkNode-M1.json
Normal file
53
boards/ThinkNode-M1.json
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino": {
|
||||||
|
"ldscript": "nrf52840_s140_v6.ld"
|
||||||
|
},
|
||||||
|
"core": "nRF5",
|
||||||
|
"cpu": "cortex-m4",
|
||||||
|
"extra_flags": "-DARDUINO_NRF52840_TTGO_EINK -DNRF52840_XXAA",
|
||||||
|
"f_cpu": "64000000L",
|
||||||
|
"hwids": [
|
||||||
|
["0x239A", "0x4405"],
|
||||||
|
["0x239A", "0x0029"],
|
||||||
|
["0x239A", "0x002A"]
|
||||||
|
],
|
||||||
|
"usb_product": "elecrow_eink",
|
||||||
|
"mcu": "nrf52840",
|
||||||
|
"variant": "ELECROW-ThinkNode-M1",
|
||||||
|
"variants_dir": "variants",
|
||||||
|
"bsp": {
|
||||||
|
"name": "adafruit"
|
||||||
|
},
|
||||||
|
"softdevice": {
|
||||||
|
"sd_flags": "-DS140",
|
||||||
|
"sd_name": "s140",
|
||||||
|
"sd_version": "6.1.1",
|
||||||
|
"sd_fwid": "0x00B6"
|
||||||
|
},
|
||||||
|
"bootloader": {
|
||||||
|
"settings_addr": "0xFF000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"connectivity": ["bluetooth"],
|
||||||
|
"debug": {
|
||||||
|
"jlink_device": "nRF52840_xxAA",
|
||||||
|
"onboard_tools": ["jlink"],
|
||||||
|
"svd_path": "nrf52840.svd",
|
||||||
|
"openocd_target": "nrf52840-mdk-rs"
|
||||||
|
},
|
||||||
|
"frameworks": ["arduino"],
|
||||||
|
"name": "elecrow eink",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 248832,
|
||||||
|
"maximum_size": 815104,
|
||||||
|
"speed": 115200,
|
||||||
|
"protocol": "nrfutil",
|
||||||
|
"protocols": ["jlink", "nrfjprog", "nrfutil", "stlink"],
|
||||||
|
"use_1200bps_touch": true,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"wait_for_upload_port": true
|
||||||
|
},
|
||||||
|
"url": "FIXME",
|
||||||
|
"vendor": "ELECROW"
|
||||||
|
}
|
@ -94,7 +94,7 @@ lib_deps =
|
|||||||
|
|
||||||
[device-ui_base]
|
[device-ui_base]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/meshtastic/device-ui.git#7a6ffba3c86901b0e3234b6c056aa803b4cd8854
|
https://github.com/meshtastic/device-ui.git#b1e862e8b2a604a8d911e9d7a27f6e80f1176c21
|
||||||
|
|
||||||
; Common libs for environmental measurements in telemetry module
|
; Common libs for environmental measurements in telemetry module
|
||||||
; (not included in native / portduino)
|
; (not included in native / portduino)
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit b4044f8f9f3681d4d20521dbe13ee42c96eae353
|
Subproject commit f00e96f12da48abfa9a992f8b5546fd75a370250
|
@ -73,23 +73,28 @@ ButtonThread::ButtonThread() : OSThread("Button")
|
|||||||
userButton.setDebounceMs(1);
|
userButton.setDebounceMs(1);
|
||||||
userButton.attachDoubleClick(userButtonDoublePressed);
|
userButton.attachDoubleClick(userButtonDoublePressed);
|
||||||
userButton.attachMultiClick(userButtonMultiPressed, this); // Reference to instance: get click count from non-static OneButton
|
userButton.attachMultiClick(userButtonMultiPressed, this); // Reference to instance: get click count from non-static OneButton
|
||||||
#ifndef T_DECK // T-Deck immediately wakes up after shutdown, so disable this function
|
#if !defined(T_DECK) && \
|
||||||
|
!defined( \
|
||||||
|
ELECROW_ThinkNode_M2) // T-Deck immediately wakes up after shutdown, Thinknode M2 has this on the smaller ALT button
|
||||||
userButton.attachLongPressStart(userButtonPressedLongStart);
|
userButton.attachLongPressStart(userButtonPressedLongStart);
|
||||||
userButton.attachLongPressStop(userButtonPressedLongStop);
|
userButton.attachLongPressStop(userButtonPressedLongStop);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BUTTON_PIN_ALT
|
#ifdef BUTTON_PIN_ALT
|
||||||
userButtonAlt = OneButton(BUTTON_PIN_ALT, true, true);
|
#if defined(ELECROW_ThinkNode_M2)
|
||||||
|
this->userButtonAlt = OneButton(BUTTON_PIN_ALT, false, false);
|
||||||
|
#else
|
||||||
|
this->userButtonAlt = OneButton(BUTTON_PIN_ALT, true, true);
|
||||||
|
#endif
|
||||||
#ifdef INPUT_PULLUP_SENSE
|
#ifdef INPUT_PULLUP_SENSE
|
||||||
// Some platforms (nrf52) have a SENSE variant which allows wake from sleep - override what OneButton did
|
// Some platforms (nrf52) have a SENSE variant which allows wake from sleep - override what OneButton did
|
||||||
pinMode(BUTTON_PIN_ALT, INPUT_PULLUP_SENSE);
|
pinMode(BUTTON_PIN_ALT, INPUT_PULLUP_SENSE);
|
||||||
#endif
|
#endif
|
||||||
userButtonAlt.attachClick(userButtonPressed);
|
userButtonAlt.attachClick(userButtonPressedScreen);
|
||||||
userButtonAlt.setClickMs(BUTTON_CLICK_MS);
|
userButtonAlt.setClickMs(BUTTON_CLICK_MS);
|
||||||
userButtonAlt.setPressMs(BUTTON_LONGPRESS_MS);
|
userButtonAlt.setPressMs(BUTTON_LONGPRESS_MS);
|
||||||
userButtonAlt.setDebounceMs(1);
|
userButtonAlt.setDebounceMs(1);
|
||||||
userButtonAlt.attachDoubleClick(userButtonDoublePressed);
|
|
||||||
userButtonAlt.attachLongPressStart(userButtonPressedLongStart);
|
userButtonAlt.attachLongPressStart(userButtonPressedLongStart);
|
||||||
userButtonAlt.attachLongPressStop(userButtonPressedLongStop);
|
userButtonAlt.attachLongPressStop(userButtonPressedLongStop);
|
||||||
#endif
|
#endif
|
||||||
@ -117,6 +122,40 @@ int32_t ButtonThread::runOnce()
|
|||||||
canSleep = true; // Assume we should not keep the board awake
|
canSleep = true; // Assume we should not keep the board awake
|
||||||
|
|
||||||
#if defined(BUTTON_PIN) || defined(USERPREFS_BUTTON_PIN)
|
#if defined(BUTTON_PIN) || defined(USERPREFS_BUTTON_PIN)
|
||||||
|
// #if defined(ELECROW_ThinkNode_M1) || defined(ELECROW_ThinkNode_M2)
|
||||||
|
// buzzer_updata();
|
||||||
|
// if (buttonPressed) {
|
||||||
|
// buttonPressed = false; // 清除标志
|
||||||
|
// LOG_INFO("PIN_BUTTON2 pressed!"); // 串口打印信息
|
||||||
|
// // off_currentTime = millis();
|
||||||
|
// while (digitalRead(PIN_BUTTON2) == HIGH) {
|
||||||
|
// if (cont < 40) {
|
||||||
|
// // unsigned long currentTime = millis(); // 获取当前时间
|
||||||
|
// // if (currentTime - off_currentTime >= 1000) {
|
||||||
|
// cont++;
|
||||||
|
// // off_currentTime = currentTime;
|
||||||
|
// // }
|
||||||
|
// delay(100);
|
||||||
|
// } else {
|
||||||
|
|
||||||
|
// currentState = OFF;
|
||||||
|
// isBuzzing = false;
|
||||||
|
// cont = 0;
|
||||||
|
// BEEP_STATE = false;
|
||||||
|
// analogWrite(M2_buzzer, 0);
|
||||||
|
// pinMode(M2_buzzer, INPUT);
|
||||||
|
// screen->setOn(false);
|
||||||
|
// cont = 0;
|
||||||
|
// LOG_INFO("GGGGGGGGGGGGGGGGGGGGGGGGG");
|
||||||
|
// pinMode(1, OUTPUT);
|
||||||
|
// digitalWrite(1, LOW);
|
||||||
|
// pinMode(6, OUTPUT);
|
||||||
|
// digitalWrite(6, LOW);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// #endif
|
||||||
userButton.tick();
|
userButton.tick();
|
||||||
canSleep &= userButton.isIdle();
|
canSleep &= userButton.isIdle();
|
||||||
#elif defined(ARCH_PORTDUINO)
|
#elif defined(ARCH_PORTDUINO)
|
||||||
@ -166,6 +205,14 @@ int32_t ButtonThread::runOnce()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case BUTTON_EVENT_PRESSED_SCREEN: {
|
||||||
|
// turn screen on or off
|
||||||
|
screen_flag = !screen_flag;
|
||||||
|
if (screen)
|
||||||
|
screen->setOn(screen_flag);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case BUTTON_EVENT_DOUBLE_PRESSED: {
|
case BUTTON_EVENT_DOUBLE_PRESSED: {
|
||||||
LOG_BUTTON("Double press!");
|
LOG_BUTTON("Double press!");
|
||||||
service->refreshLocalMeshNode();
|
service->refreshLocalMeshNode();
|
||||||
@ -192,7 +239,16 @@ int32_t ButtonThread::runOnce()
|
|||||||
screen->forceDisplay(true); // Force a new UI frame, then force an EInk update
|
screen->forceDisplay(true); // Force a new UI frame, then force an EInk update
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#elif defined(ELECROW_ThinkNode_M2)
|
||||||
|
case 3:
|
||||||
|
LOG_INFO("3 clicks: toggle buzzer");
|
||||||
|
buzzer_flag = !buzzer_flag;
|
||||||
|
if (buzzer_flag) {
|
||||||
|
playBeep();
|
||||||
|
}
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_EINK) && defined(PIN_EINK_EN) // i.e. T-Echo
|
#if defined(USE_EINK) && defined(PIN_EINK_EN) // i.e. T-Echo
|
||||||
// 4 clicks: toggle backlight
|
// 4 clicks: toggle backlight
|
||||||
case 4:
|
case 4:
|
||||||
|
@ -24,6 +24,7 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
enum ButtonEventType {
|
enum ButtonEventType {
|
||||||
BUTTON_EVENT_NONE,
|
BUTTON_EVENT_NONE,
|
||||||
BUTTON_EVENT_PRESSED,
|
BUTTON_EVENT_PRESSED,
|
||||||
|
BUTTON_EVENT_PRESSED_SCREEN,
|
||||||
BUTTON_EVENT_DOUBLE_PRESSED,
|
BUTTON_EVENT_DOUBLE_PRESSED,
|
||||||
BUTTON_EVENT_MULTI_PRESSED,
|
BUTTON_EVENT_MULTI_PRESSED,
|
||||||
BUTTON_EVENT_LONG_PRESSED,
|
BUTTON_EVENT_LONG_PRESSED,
|
||||||
@ -42,7 +43,6 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
int beforeLightSleep(void *unused);
|
int beforeLightSleep(void *unused);
|
||||||
int afterLightSleep(esp_sleep_wakeup_cause_t cause);
|
int afterLightSleep(esp_sleep_wakeup_cause_t cause);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if defined(BUTTON_PIN) || defined(ARCH_PORTDUINO) || defined(USERPREFS_BUTTON_PIN)
|
#if defined(BUTTON_PIN) || defined(ARCH_PORTDUINO) || defined(USERPREFS_BUTTON_PIN)
|
||||||
static OneButton userButton; // Static - accessed from an interrupt
|
static OneButton userButton; // Static - accessed from an interrupt
|
||||||
@ -64,6 +64,8 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
|
|
||||||
// set during IRQ
|
// set during IRQ
|
||||||
static volatile ButtonEventType btnEvent;
|
static volatile ButtonEventType btnEvent;
|
||||||
|
bool buzzer_flag = false;
|
||||||
|
bool screen_flag = true;
|
||||||
|
|
||||||
// Store click count during callback, for later use
|
// Store click count during callback, for later use
|
||||||
volatile int multipressClickCount = 0;
|
volatile int multipressClickCount = 0;
|
||||||
@ -72,6 +74,12 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
|
|
||||||
// IRQ callbacks
|
// IRQ callbacks
|
||||||
static void userButtonPressed() { btnEvent = BUTTON_EVENT_PRESSED; }
|
static void userButtonPressed() { btnEvent = BUTTON_EVENT_PRESSED; }
|
||||||
|
static void userButtonPressedScreen()
|
||||||
|
{
|
||||||
|
if (millis() > c_holdOffTime) {
|
||||||
|
btnEvent = BUTTON_EVENT_PRESSED_SCREEN;
|
||||||
|
}
|
||||||
|
}
|
||||||
static void userButtonDoublePressed() { btnEvent = BUTTON_EVENT_DOUBLE_PRESSED; }
|
static void userButtonDoublePressed() { btnEvent = BUTTON_EVENT_DOUBLE_PRESSED; }
|
||||||
static void userButtonMultiPressed(void *callerThread); // Retrieve click count from non-static Onebutton while still valid
|
static void userButtonMultiPressed(void *callerThread); // Retrieve click count from non-static Onebutton while still valid
|
||||||
static void userButtonPressedLongStart();
|
static void userButtonPressedLongStart();
|
||||||
|
@ -755,6 +755,9 @@ void Power::readPowerStatus()
|
|||||||
const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isCharging, batteryVoltageMv, batteryChargePercent);
|
const PowerStatus powerStatus2 = PowerStatus(hasBattery, usbPowered, isCharging, batteryVoltageMv, batteryChargePercent);
|
||||||
LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d", powerStatus2.getHasUSB(), powerStatus2.getIsCharging(),
|
LOG_DEBUG("Battery: usbPower=%d, isCharging=%d, batMv=%d, batPct=%d", powerStatus2.getHasUSB(), powerStatus2.getIsCharging(),
|
||||||
powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
|
powerStatus2.getBatteryVoltageMv(), powerStatus2.getBatteryChargePercent());
|
||||||
|
#if defined(ELECROW_ThinkNode_M1) || defined(POWER_CFG)
|
||||||
|
power_num = powerStatus2.getBatteryVoltageMv();
|
||||||
|
#endif
|
||||||
newStatus.notifyObservers(&powerStatus2);
|
newStatus.notifyObservers(&powerStatus2);
|
||||||
#ifdef DEBUG_HEAP
|
#ifdef DEBUG_HEAP
|
||||||
if (lastheap != memGet.getFreeHeap()) {
|
if (lastheap != memGet.getFreeHeap()) {
|
||||||
@ -798,9 +801,13 @@ void Power::readPowerStatus()
|
|||||||
// If we have a battery at all and it is less than 0%, force deep sleep if we have more than 10 low readings in
|
// If we have a battery at all and it is less than 0%, force deep sleep if we have more than 10 low readings in
|
||||||
// a row. NOTE: min LiIon/LiPo voltage is 2.0 to 2.5V, current OCV min is set to 3100 that is large enough.
|
// a row. NOTE: min LiIon/LiPo voltage is 2.0 to 2.5V, current OCV min is set to 3100 that is large enough.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (batteryLevel && powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
|
if (batteryLevel && powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
|
||||||
if (batteryLevel->getBattVoltage() < OCV[NUM_OCV_POINTS - 1]) {
|
if (batteryLevel->getBattVoltage() < OCV[NUM_OCV_POINTS - 1]) {
|
||||||
low_voltage_counter++;
|
low_voltage_counter++;
|
||||||
|
#if defined(ELECROW_ThinkNode_M1)
|
||||||
|
low_voltage_counter_led3 = low_voltage_counter;
|
||||||
|
#endif
|
||||||
LOG_DEBUG("Low voltage counter: %d/10", low_voltage_counter);
|
LOG_DEBUG("Low voltage counter: %d/10", low_voltage_counter);
|
||||||
if (low_voltage_counter > 10) {
|
if (low_voltage_counter > 10) {
|
||||||
#ifdef ARCH_NRF52
|
#ifdef ARCH_NRF52
|
||||||
@ -813,7 +820,13 @@ void Power::readPowerStatus()
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
low_voltage_counter = 0;
|
low_voltage_counter = 0;
|
||||||
|
#if defined(ELECROW_ThinkNode_M1)
|
||||||
|
low_voltage_counter_led3 = low_voltage_counter;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifdef POWER_CFG
|
||||||
|
low_voltage_counter_led3 = low_voltage_counter;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,8 +30,11 @@ struct ToneDuration {
|
|||||||
#define NOTE_B3 247
|
#define NOTE_B3 247
|
||||||
#define NOTE_CS4 277
|
#define NOTE_CS4 277
|
||||||
|
|
||||||
const int DURATION_1_8 = 125; // 1/8 note
|
const int DURATION_1_8 = 125; // 1/8 note
|
||||||
const int DURATION_1_4 = 250; // 1/4 note
|
const int DURATION_1_4 = 250; // 1/4 note
|
||||||
|
const int DURATION_1_2 = 500; // 1/2 note
|
||||||
|
const int DURATION_3_4 = 750; // 1/4 note
|
||||||
|
const int DURATION_1_1 = 1000; // 1/1 note
|
||||||
|
|
||||||
void playTones(const ToneDuration *tone_durations, int size)
|
void playTones(const ToneDuration *tone_durations, int size)
|
||||||
{
|
{
|
||||||
@ -55,6 +58,12 @@ void playBeep()
|
|||||||
playTones(melody, sizeof(melody) / sizeof(ToneDuration));
|
playTones(melody, sizeof(melody) / sizeof(ToneDuration));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void playLongBeep()
|
||||||
|
{
|
||||||
|
ToneDuration melody[] = {{NOTE_B3, DURATION_1_1}};
|
||||||
|
playTones(melody, sizeof(melody) / sizeof(ToneDuration));
|
||||||
|
}
|
||||||
|
|
||||||
void playGPSEnableBeep()
|
void playGPSEnableBeep()
|
||||||
{
|
{
|
||||||
ToneDuration melody[] = {{NOTE_C3, DURATION_1_8}, {NOTE_FS3, DURATION_1_4}, {NOTE_CS4, DURATION_1_4}};
|
ToneDuration melody[] = {{NOTE_C3, DURATION_1_8}, {NOTE_FS3, DURATION_1_4}, {NOTE_CS4, DURATION_1_4}};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
void playBeep();
|
void playBeep();
|
||||||
|
void playLongBeep();
|
||||||
void playStartMelody();
|
void playStartMelody();
|
||||||
void playShutdownMelody();
|
void playShutdownMelody();
|
||||||
void playGPSEnableBeep();
|
void playGPSEnableBeep();
|
||||||
|
@ -128,16 +128,24 @@ bool EInkDisplay::connect()
|
|||||||
#ifdef PIN_EINK_EN
|
#ifdef PIN_EINK_EN
|
||||||
// backlight power, HIGH is backlight on, LOW is off
|
// backlight power, HIGH is backlight on, LOW is off
|
||||||
pinMode(PIN_EINK_EN, OUTPUT);
|
pinMode(PIN_EINK_EN, OUTPUT);
|
||||||
|
#ifdef ELECROW_ThinkNode_M1
|
||||||
digitalWrite(PIN_EINK_EN, LOW);
|
digitalWrite(PIN_EINK_EN, LOW);
|
||||||
|
#else
|
||||||
|
digitalWrite(PIN_EINK_EN, HIGH);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(TTGO_T_ECHO)
|
#if defined(TTGO_T_ECHO) || defined(ELECROW_ThinkNode_M1)
|
||||||
{
|
{
|
||||||
auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, SPI1);
|
auto lowLevel = new EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, SPI1);
|
||||||
|
|
||||||
adafruitDisplay = new GxEPD2_BW<EINK_DISPLAY_MODEL, EINK_DISPLAY_MODEL::HEIGHT>(*lowLevel);
|
adafruitDisplay = new GxEPD2_BW<EINK_DISPLAY_MODEL, EINK_DISPLAY_MODEL::HEIGHT>(*lowLevel);
|
||||||
adafruitDisplay->init();
|
adafruitDisplay->init();
|
||||||
|
#ifdef ELECROW_ThinkNode_M1
|
||||||
|
adafruitDisplay->setRotation(4);
|
||||||
|
#else
|
||||||
adafruitDisplay->setRotation(3);
|
adafruitDisplay->setRotation(3);
|
||||||
|
#endif
|
||||||
adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight);
|
adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight);
|
||||||
}
|
}
|
||||||
#elif defined(MESHLINK)
|
#elif defined(MESHLINK)
|
||||||
|
@ -1641,6 +1641,11 @@ void Screen::handleSetOn(bool on, FrameCallback einkScreensaver)
|
|||||||
setScreensaverFrames(einkScreensaver);
|
setScreensaverFrames(einkScreensaver);
|
||||||
#endif
|
#endif
|
||||||
LOG_INFO("Turn off screen");
|
LOG_INFO("Turn off screen");
|
||||||
|
#ifdef ELECROW_ThinkNode_M1
|
||||||
|
if (digitalRead(PIN_EINK_EN) == HIGH) {
|
||||||
|
digitalWrite(PIN_EINK_EN, LOW);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
dispdev->displayOff();
|
dispdev->displayOff();
|
||||||
#ifdef USE_ST7789
|
#ifdef USE_ST7789
|
||||||
SPI1.end();
|
SPI1.end();
|
||||||
|
33
src/main.cpp
33
src/main.cpp
@ -270,6 +270,31 @@ void setup()
|
|||||||
esp_task_wdt_deinit();
|
esp_task_wdt_deinit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef POWER_CHRG
|
||||||
|
pinMode(POWER_CHRG, OUTPUT);
|
||||||
|
digitalWrite(POWER_CHRG, HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PIN_POWER_EN)
|
||||||
|
pinMode(PIN_POWER_EN, OUTPUT);
|
||||||
|
digitalWrite(PIN_POWER_EN, HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LED_POWER
|
||||||
|
pinMode(LED_POWER, OUTPUT);
|
||||||
|
digitalWrite(LED_POWER, HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef POWER_LED
|
||||||
|
pinMode(POWER_LED, OUTPUT);
|
||||||
|
digitalWrite(POWER_LED, HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USER_LED
|
||||||
|
pinMode(USER_LED, OUTPUT);
|
||||||
|
digitalWrite(USER_LED, LOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(T_DECK)
|
#if defined(T_DECK)
|
||||||
// GPIO10 manages all peripheral power supplies
|
// GPIO10 manages all peripheral power supplies
|
||||||
// Turn on peripheral power immediately after MUC starts.
|
// Turn on peripheral power immediately after MUC starts.
|
||||||
@ -333,13 +358,6 @@ void setup()
|
|||||||
|
|
||||||
initDeepSleep();
|
initDeepSleep();
|
||||||
|
|
||||||
// power on peripherals
|
|
||||||
#if defined(PIN_POWER_EN)
|
|
||||||
pinMode(PIN_POWER_EN, OUTPUT);
|
|
||||||
digitalWrite(PIN_POWER_EN, HIGH);
|
|
||||||
// digitalWrite(PIN_POWER_EN1, INPUT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(LORA_TCXO_GPIO)
|
#if defined(LORA_TCXO_GPIO)
|
||||||
pinMode(LORA_TCXO_GPIO, OUTPUT);
|
pinMode(LORA_TCXO_GPIO, OUTPUT);
|
||||||
digitalWrite(LORA_TCXO_GPIO, HIGH);
|
digitalWrite(LORA_TCXO_GPIO, HIGH);
|
||||||
@ -1311,5 +1329,4 @@ void loop()
|
|||||||
mainDelay.delay(delayMsec);
|
mainDelay.delay(delayMsec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
SerialModule *serialModule;
|
SerialModule *serialModule;
|
||||||
SerialModuleRadio *serialModuleRadio;
|
SerialModuleRadio *serialModuleRadio;
|
||||||
|
|
||||||
#if defined(TTGO_T_ECHO) || defined(CANARYONE) || defined(MESHLINK)
|
#if defined(TTGO_T_ECHO) || defined(CANARYONE) || defined(MESHLINK) || defined(ELECROW_ThinkNode_M1)
|
||||||
SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial") {}
|
SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial") {}
|
||||||
static Print *serialPrint = &Serial;
|
static Print *serialPrint = &Serial;
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
|
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||||
@ -158,7 +158,7 @@ int32_t SerialModule::runOnce()
|
|||||||
Serial.begin(baud);
|
Serial.begin(baud);
|
||||||
Serial.setTimeout(moduleConfig.serial.timeout > 0 ? moduleConfig.serial.timeout : TIMEOUT);
|
Serial.setTimeout(moduleConfig.serial.timeout > 0 ? moduleConfig.serial.timeout : TIMEOUT);
|
||||||
}
|
}
|
||||||
#elif !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK)
|
#elif !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1)
|
||||||
if (moduleConfig.serial.rxd && moduleConfig.serial.txd) {
|
if (moduleConfig.serial.rxd && moduleConfig.serial.txd) {
|
||||||
#ifdef ARCH_RP2040
|
#ifdef ARCH_RP2040
|
||||||
Serial2.setFIFOSize(RX_BUFFER);
|
Serial2.setFIFOSize(RX_BUFFER);
|
||||||
@ -214,7 +214,7 @@ int32_t SerialModule::runOnce()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK)
|
#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1)
|
||||||
else if ((moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85)) {
|
else if ((moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85)) {
|
||||||
processWXSerial();
|
processWXSerial();
|
||||||
|
|
||||||
@ -416,7 +416,8 @@ uint32_t SerialModule::getBaudRate()
|
|||||||
*/
|
*/
|
||||||
void SerialModule::processWXSerial()
|
void SerialModule::processWXSerial()
|
||||||
{
|
{
|
||||||
#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(MESHLINK)
|
#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(MESHLINK) && \
|
||||||
|
!defined(ELECROW_ThinkNode_M1)
|
||||||
static unsigned int lastAveraged = 0;
|
static unsigned int lastAveraged = 0;
|
||||||
static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded.
|
static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded.
|
||||||
static double dir_sum_sin = 0;
|
static double dir_sum_sin = 0;
|
||||||
|
@ -144,6 +144,8 @@
|
|||||||
#define HW_VENDOR meshtastic_HardwareModel_HELTEC_HT62
|
#define HW_VENDOR meshtastic_HardwareModel_HELTEC_HT62
|
||||||
#elif defined(EBYTE_ESP32_S3)
|
#elif defined(EBYTE_ESP32_S3)
|
||||||
#define HW_VENDOR meshtastic_HardwareModel_EBYTE_ESP32_S3
|
#define HW_VENDOR meshtastic_HardwareModel_EBYTE_ESP32_S3
|
||||||
|
#elif defined(ELECROW_ThinkNode_M2)
|
||||||
|
#define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M2
|
||||||
#elif defined(ESP32_S3_PICO)
|
#elif defined(ESP32_S3_PICO)
|
||||||
#define HW_VENDOR meshtastic_HardwareModel_ESP32_S3_PICO
|
#define HW_VENDOR meshtastic_HardwareModel_ESP32_S3_PICO
|
||||||
#elif defined(SENSELORA_S3)
|
#elif defined(SENSELORA_S3)
|
||||||
|
@ -110,6 +110,11 @@ void esp32Setup()
|
|||||||
randomSeed(seed);
|
randomSeed(seed);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef POWER_FULL
|
||||||
|
pinMode(POWER_FULL, INPUT);
|
||||||
|
pinMode(7, INPUT);
|
||||||
|
#endif
|
||||||
|
|
||||||
LOG_DEBUG("Total heap: %d", ESP.getHeapSize());
|
LOG_DEBUG("Total heap: %d", ESP.getHeapSize());
|
||||||
LOG_DEBUG("Free heap: %d", ESP.getFreeHeap());
|
LOG_DEBUG("Free heap: %d", ESP.getFreeHeap());
|
||||||
LOG_DEBUG("Total PSRAM: %d", ESP.getPsramSize());
|
LOG_DEBUG("Total PSRAM: %d", ESP.getPsramSize());
|
||||||
|
@ -53,6 +53,8 @@
|
|||||||
#define HW_VENDOR meshtastic_HardwareModel_RAK4631
|
#define HW_VENDOR meshtastic_HardwareModel_RAK4631
|
||||||
#elif defined(TTGO_T_ECHO)
|
#elif defined(TTGO_T_ECHO)
|
||||||
#define HW_VENDOR meshtastic_HardwareModel_T_ECHO
|
#define HW_VENDOR meshtastic_HardwareModel_T_ECHO
|
||||||
|
#elif defined(ELECROW_ThinkNode_M1)
|
||||||
|
#define HW_VENDOR meshtastic_HardwareModel_NRF52_UNKNOWN // HW_VENDOR meshtastic_HardwareModel_ThinkNode_M1
|
||||||
#elif defined(NANO_G2_ULTRA)
|
#elif defined(NANO_G2_ULTRA)
|
||||||
#define HW_VENDOR meshtastic_HardwareModel_NANO_G2_ULTRA
|
#define HW_VENDOR meshtastic_HardwareModel_NANO_G2_ULTRA
|
||||||
#elif defined(CANARYONE)
|
#elif defined(CANARYONE)
|
||||||
|
@ -235,6 +235,14 @@ void nrf52InitSemiHosting()
|
|||||||
|
|
||||||
void nrf52Setup()
|
void nrf52Setup()
|
||||||
{
|
{
|
||||||
|
#ifdef USB_CHECK
|
||||||
|
pinMode(USB_CHECK, INPUT);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ADC_V
|
||||||
|
pinMode(ADC_V, INPUT);
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t why = NRF_POWER->RESETREAS;
|
uint32_t why = NRF_POWER->RESETREAS;
|
||||||
// per
|
// per
|
||||||
// https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fpower.html
|
// https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fpower.html
|
||||||
@ -275,9 +283,11 @@ void cpuDeepSleep(uint32_t msecToWake)
|
|||||||
Wire.end();
|
Wire.end();
|
||||||
#endif
|
#endif
|
||||||
SPI.end();
|
SPI.end();
|
||||||
|
#if SPI_INTERFACES_COUNT > 1
|
||||||
|
SPI1.end();
|
||||||
|
#endif
|
||||||
// This may cause crashes as debug messages continue to flow.
|
// This may cause crashes as debug messages continue to flow.
|
||||||
Serial.end();
|
Serial.end();
|
||||||
|
|
||||||
#ifdef PIN_SERIAL_RX1
|
#ifdef PIN_SERIAL_RX1
|
||||||
Serial1.end();
|
Serial1.end();
|
||||||
#endif
|
#endif
|
||||||
@ -315,6 +325,31 @@ void cpuDeepSleep(uint32_t msecToWake)
|
|||||||
detachInterrupt(PIN_GPS_PPS);
|
detachInterrupt(PIN_GPS_PPS);
|
||||||
detachInterrupt(PIN_BUTTON1);
|
detachInterrupt(PIN_BUTTON1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ELECROW_ThinkNode_M1
|
||||||
|
for (int pin = 0; pin < 48; pin++) {
|
||||||
|
if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 ||
|
||||||
|
pin == PIN_BUTTON1 || pin == PIN_BUTTON2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pinMode(pin, OUTPUT);
|
||||||
|
}
|
||||||
|
for (int pin = 0; pin < 48; pin++) {
|
||||||
|
if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 ||
|
||||||
|
pin == PIN_BUTTON1 || pin == PIN_BUTTON2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
digitalWrite(pin, LOW);
|
||||||
|
}
|
||||||
|
for (int pin = 0; pin < 48; pin++) {
|
||||||
|
if (pin == 17 || pin == 19 || pin == 20 || pin == 22 || pin == 23 || pin == 24 || pin == 25 || pin == 9 || pin == 10 ||
|
||||||
|
pin == PIN_BUTTON1 || pin == PIN_BUTTON2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
NRF_GPIO->DIRCLR = (1 << pin);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Sleepy trackers or sensors can low power "sleep"
|
// Sleepy trackers or sensors can low power "sleep"
|
||||||
// Don't enter this if we're sleeping portMAX_DELAY, since that's a shutdown event
|
// Don't enter this if we're sleeping portMAX_DELAY, since that's a shutdown event
|
||||||
if (msecToWake != portMAX_DELAY &&
|
if (msecToWake != portMAX_DELAY &&
|
||||||
@ -333,6 +368,17 @@ void cpuDeepSleep(uint32_t msecToWake)
|
|||||||
// FIXME, use system off mode with ram retention for key state?
|
// FIXME, use system off mode with ram retention for key state?
|
||||||
// FIXME, use non-init RAM per
|
// FIXME, use non-init RAM per
|
||||||
// https://devzone.nordicsemi.com/f/nordic-q-a/48919/ram-retention-settings-with-softdevice-enabled
|
// https://devzone.nordicsemi.com/f/nordic-q-a/48919/ram-retention-settings-with-softdevice-enabled
|
||||||
|
|
||||||
|
#ifdef ELECROW_ThinkNode_M1
|
||||||
|
nrf_gpio_cfg_input(PIN_BUTTON1, NRF_GPIO_PIN_PULLUP); // Configure the pin to be woken up as an input
|
||||||
|
nrf_gpio_pin_sense_t sense = NRF_GPIO_PIN_SENSE_LOW;
|
||||||
|
nrf_gpio_cfg_sense_set(PIN_BUTTON1, sense);
|
||||||
|
|
||||||
|
nrf_gpio_cfg_input(PIN_BUTTON2, NRF_GPIO_PIN_PULLUP);
|
||||||
|
nrf_gpio_pin_sense_t sense1 = NRF_GPIO_PIN_SENSE_LOW;
|
||||||
|
nrf_gpio_cfg_sense_set(PIN_BUTTON2, sense1);
|
||||||
|
#endif
|
||||||
|
|
||||||
auto ok = sd_power_system_off();
|
auto ok = sd_power_system_off();
|
||||||
if (ok != NRF_SUCCESS) {
|
if (ok != NRF_SUCCESS) {
|
||||||
LOG_ERROR("FIXME: Ignoring soft device (EasyDMA pending?) and forcing system-off!");
|
LOG_ERROR("FIXME: Ignoring soft device (EasyDMA pending?) and forcing system-off!");
|
||||||
|
@ -210,7 +210,10 @@ void portduinoSetup()
|
|||||||
}
|
}
|
||||||
char serial[9] = {0};
|
char serial[9] = {0};
|
||||||
ch341Hal->getSerialString(serial, 8);
|
ch341Hal->getSerialString(serial, 8);
|
||||||
std::cout << "Serial " << serial << std::endl;
|
std::cout << "CH341 Serial " << serial << std::endl;
|
||||||
|
char product_string[96] = {0};
|
||||||
|
ch341Hal->getProductString(product_string, 95);
|
||||||
|
std::cout << "CH341 Product " << product_string << std::endl;
|
||||||
if (strlen(serial) == 8 && settingsStrings[mac_address].length() < 12) {
|
if (strlen(serial) == 8 && settingsStrings[mac_address].length() < 12) {
|
||||||
uint8_t hash[32] = {0};
|
uint8_t hash[32] = {0};
|
||||||
memcpy(hash, serial, 8);
|
memcpy(hash, serial, 8);
|
||||||
|
@ -61,6 +61,12 @@ class Ch341Hal : public RadioLibHal
|
|||||||
strncpy(_serial, pinedio.serial_number, len);
|
strncpy(_serial, pinedio.serial_number, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getProductString(char *_product_string, size_t len)
|
||||||
|
{
|
||||||
|
len = len > 95 ? 95 : len;
|
||||||
|
strncpy(_product_string, pinedio.product_string, len);
|
||||||
|
}
|
||||||
|
|
||||||
void init() override {}
|
void init() override {}
|
||||||
void term() override {}
|
void term() override {}
|
||||||
|
|
||||||
|
@ -89,6 +89,11 @@ class Power : private concurrency::OSThread
|
|||||||
void setStatusHandler(meshtastic::PowerStatus *handler) { statusHandler = handler; }
|
void setStatusHandler(meshtastic::PowerStatus *handler) { statusHandler = handler; }
|
||||||
const uint16_t OCV[11] = {OCV_ARRAY};
|
const uint16_t OCV[11] = {OCV_ARRAY};
|
||||||
|
|
||||||
|
#if defined(ELECROW_ThinkNode_M1) || defined(POWER_CFG)
|
||||||
|
uint8_t low_voltage_counter_led3;
|
||||||
|
int power_num = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
meshtastic::PowerStatus *statusHandler;
|
meshtastic::PowerStatus *statusHandler;
|
||||||
|
|
||||||
|
@ -226,6 +226,7 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false, bool skipSaveN
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PIN_POWER_EN
|
#ifdef PIN_POWER_EN
|
||||||
|
digitalWrite(PIN_POWER_EN, LOW);
|
||||||
pinMode(PIN_POWER_EN, INPUT); // power off peripherals
|
pinMode(PIN_POWER_EN, INPUT); // power off peripherals
|
||||||
// pinMode(PIN_POWER_EN1, INPUT_PULLDOWN);
|
// pinMode(PIN_POWER_EN1, INPUT_PULLDOWN);
|
||||||
#endif
|
#endif
|
||||||
|
29
variants/ELECROW-ThinkNode-M1/platformio.ini
Normal file
29
variants/ELECROW-ThinkNode-M1/platformio.ini
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
; First prototype eink/nrf52840/sx1262 device
|
||||||
|
[env:thinknode_m1]
|
||||||
|
extends = nrf52840_base
|
||||||
|
board = ThinkNode-M1
|
||||||
|
board_check = true
|
||||||
|
debug_tool = jlink
|
||||||
|
|
||||||
|
# add -DCFG_SYSVIEW if you want to use the Segger systemview tool for OS profiling.
|
||||||
|
build_flags = ${nrf52840_base.build_flags} -Ivariants/ELECROW-ThinkNode-M1
|
||||||
|
-DELECROW_ThinkNode_M1
|
||||||
|
-DGPS_POWER_TOGGLE
|
||||||
|
-L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard"
|
||||||
|
-DEINK_DISPLAY_MODEL=GxEPD2_154_D67
|
||||||
|
-DEINK_WIDTH=200
|
||||||
|
-DEINK_HEIGHT=200
|
||||||
|
-DUSE_EINK_DYNAMICDISPLAY ; Enable Dynamic EInk
|
||||||
|
-DEINK_LIMIT_FASTREFRESH=10 ; How many consecutive fast-refreshes are permitted //20
|
||||||
|
-DEINK_LIMIT_RATE_BACKGROUND_SEC=10 ; Minimum interval between BACKGROUND updates //30
|
||||||
|
-DEINK_LIMIT_RATE_RESPONSIVE_SEC=1 ; Minimum interval between RESPONSIVE updates
|
||||||
|
; -DEINK_LIMIT_GHOSTING_PX=2000 ; (Optional) How much image ghosting is tolerated
|
||||||
|
-DEINK_BACKGROUND_USES_FAST ; (Optional) Use FAST refresh for both BACKGROUND and RESPONSIVE, until a limit is reached.
|
||||||
|
|
||||||
|
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/ELECROW-ThinkNode-M1>
|
||||||
|
lib_deps =
|
||||||
|
${nrf52840_base.lib_deps}
|
||||||
|
https://github.com/meshtastic/GxEPD2/archive/33db3fa8ee6fc47d160bdb44f8f127c9a9203a10.zip
|
||||||
|
lewisxhe/PCF8563_Library@^1.0.1
|
||||||
|
khoih-prog/nRF52_PWM@^1.0.1
|
||||||
|
;upload_protocol = fs
|
44
variants/ELECROW-ThinkNode-M1/variant.cpp
Normal file
44
variants/ELECROW-ThinkNode-M1/variant.cpp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
|
||||||
|
Copyright (c) 2016 Sandeep Mistry All right reserved.
|
||||||
|
Copyright (c) 2018, Adafruit Industries (adafruit.com)
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
See the GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "variant.h"
|
||||||
|
#include "nrf.h"
|
||||||
|
#include "wiring_constants.h"
|
||||||
|
#include "wiring_digital.h"
|
||||||
|
|
||||||
|
const uint32_t g_ADigitalPinMap[] = {
|
||||||
|
// P0 - pins 0 and 1 are hardwired for xtal and should never be enabled
|
||||||
|
0xff, 0xff, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||||
|
|
||||||
|
// P1
|
||||||
|
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47};
|
||||||
|
|
||||||
|
void initVariant()
|
||||||
|
{
|
||||||
|
// LED1 & LED2
|
||||||
|
pinMode(PIN_LED1, OUTPUT);
|
||||||
|
ledOff(PIN_LED1);
|
||||||
|
|
||||||
|
pinMode(PIN_LED2, OUTPUT);
|
||||||
|
ledOff(PIN_LED2);
|
||||||
|
|
||||||
|
pinMode(PIN_LED3, OUTPUT);
|
||||||
|
ledOff(PIN_LED3);
|
||||||
|
}
|
205
variants/ELECROW-ThinkNode-M1/variant.h
Normal file
205
variants/ELECROW-ThinkNode-M1/variant.h
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
|
||||||
|
Copyright (c) 2016 Sandeep Mistry All right reserved.
|
||||||
|
Copyright (c) 2018, Adafruit Industries (adafruit.com)
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
See the GNU Lesser General Public License for more details.
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _VARIANT_ELECROW_EINK_V1_0_
|
||||||
|
#define _VARIANT_ELECROW_EINK_V1_0_
|
||||||
|
|
||||||
|
/** Master clock frequency */
|
||||||
|
#define VARIANT_MCK (64000000ul)
|
||||||
|
|
||||||
|
#define USE_LFXO // Board uses 32khz crystal for LF
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
* Headers
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "WVariant.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
// Number of pins defined in PinDescription array
|
||||||
|
// 在PinDescription数组中定义的引脚数
|
||||||
|
#define PINS_COUNT (48)
|
||||||
|
#define NUM_DIGITAL_PINS (48)
|
||||||
|
#define NUM_ANALOG_INPUTS (1)
|
||||||
|
#define NUM_ANALOG_OUTPUTS (0)
|
||||||
|
|
||||||
|
#define PIN_LED1 -1
|
||||||
|
#define PIN_LED2 -1
|
||||||
|
#define PIN_LED3 -1
|
||||||
|
|
||||||
|
// LED
|
||||||
|
#define POWER_LED (32 + 6) // red
|
||||||
|
#define LED_POWER (32 + 4)
|
||||||
|
#define USER_LED (0 + 13) // green
|
||||||
|
// USB_CHECK
|
||||||
|
#define USB_CHECK (32 + 3)
|
||||||
|
#define ADC_V (0 + 8)
|
||||||
|
|
||||||
|
#define LED_RED PIN_LED3
|
||||||
|
#define LED_BLUE PIN_LED1
|
||||||
|
#define LED_GREEN PIN_LED2
|
||||||
|
#define LED_BUILTIN LED_BLUE
|
||||||
|
#define LED_CONN PIN_GREEN
|
||||||
|
#define LED_STATE_ON 0 // State when LED is lit // LED灯亮时的状态
|
||||||
|
#define M1_buzzer (0 + 6)
|
||||||
|
/*
|
||||||
|
* Buttons
|
||||||
|
*/
|
||||||
|
#define PIN_BUTTON2 (32 + 10)
|
||||||
|
#define PIN_BUTTON1 (32 + 7)
|
||||||
|
|
||||||
|
// #define PIN_BUTTON1 (0 + 11)
|
||||||
|
// #define PIN_BUTTON1 (32 + 7)
|
||||||
|
|
||||||
|
// #define BUTTON_CLICK_MS 400
|
||||||
|
// #define BUTTON_TOUCH_MS 200
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Analog pins
|
||||||
|
*/
|
||||||
|
#define PIN_A0 (4) // Battery ADC
|
||||||
|
|
||||||
|
#define BATTERY_PIN PIN_A0
|
||||||
|
|
||||||
|
static const uint8_t A0 = PIN_A0;
|
||||||
|
|
||||||
|
#define ADC_RESOLUTION 14
|
||||||
|
|
||||||
|
#define PIN_NFC1 (9)
|
||||||
|
#define PIN_NFC2 (10)
|
||||||
|
|
||||||
|
/*Wire Interfaces*/
|
||||||
|
#define WIRE_INTERFACES_COUNT 1
|
||||||
|
|
||||||
|
#define PIN_WIRE_SDA (26)
|
||||||
|
#define PIN_WIRE_SCL (27)
|
||||||
|
|
||||||
|
/* touch sensor, active high */
|
||||||
|
|
||||||
|
#define TP_SER_IO (0 + 11)
|
||||||
|
|
||||||
|
#define PIN_RTC_INT (0 + 16) // Interrupt from the PCF8563 RTC
|
||||||
|
|
||||||
|
/*
|
||||||
|
External serial flash WP25R1635FZUIL0
|
||||||
|
*/
|
||||||
|
|
||||||
|
// QSPI Pins
|
||||||
|
#define PIN_QSPI_SCK (32 + 14)
|
||||||
|
#define PIN_QSPI_CS (32 + 15)
|
||||||
|
#define PIN_QSPI_IO0 (32 + 12) // MOSI if using two bit interface
|
||||||
|
#define PIN_QSPI_IO1 (32 + 13) // MISO if using two bit interface
|
||||||
|
#define PIN_QSPI_IO2 (0 + 7) // WP if using two bit interface (i.e. not used)
|
||||||
|
#define PIN_QSPI_IO3 (0 + 5) // HOLD if using two bit interface (i.e. not used)
|
||||||
|
|
||||||
|
// On-board QSPI Flash
|
||||||
|
#define EXTERNAL_FLASH_DEVICES MX25R1635F
|
||||||
|
#define EXTERNAL_FLASH_USE_QSPI
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Lora radio
|
||||||
|
*/
|
||||||
|
#define SX126X_POWER_EN (0 + 21)
|
||||||
|
#define USE_SX1262
|
||||||
|
#define SX126X_CS (0 + 24) // FIXME - we really should define LORA_CS instead
|
||||||
|
#define SX126X_DIO1 (0 + 20)
|
||||||
|
// Note DIO2 is attached internally to the module to an analog switch for TX/RX switching
|
||||||
|
// #define SX1262_DIO3 (0 + 21) // This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not
|
||||||
|
// drive from the main
|
||||||
|
#define SX126X_BUSY (0 + 17)
|
||||||
|
#define SX126X_RESET (0 + 25)
|
||||||
|
#define SX126X_DIO2_AS_RF_SWITCH
|
||||||
|
#define SX126X_DIO3_TCXO_VOLTAGE 3.3
|
||||||
|
|
||||||
|
#define PIN_EINK_EN (32 + 11) // Note: this is really just backlight power
|
||||||
|
#define PIN_EINK_CS (0 + 30)
|
||||||
|
#define PIN_EINK_BUSY (0 + 3)
|
||||||
|
#define PIN_EINK_DC (0 + 28)
|
||||||
|
#define PIN_EINK_RES (0 + 2)
|
||||||
|
#define PIN_EINK_SCLK (0 + 31)
|
||||||
|
#define PIN_EINK_MOSI (0 + 29) // also called SDI
|
||||||
|
|
||||||
|
// Controls power for all peripherals (eink + GPS + LoRa + Sensor)
|
||||||
|
#define PIN_POWER_EN (0 + 12)
|
||||||
|
|
||||||
|
#define USE_EINK
|
||||||
|
|
||||||
|
#define PIN_SPI1_MISO (32 + 7)
|
||||||
|
#define PIN_SPI1_MOSI PIN_EINK_MOSI
|
||||||
|
#define PIN_SPI1_SCK PIN_EINK_SCLK
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GPS pins
|
||||||
|
*/
|
||||||
|
// #define HAS_GPS 1
|
||||||
|
#define GPS_L76K
|
||||||
|
#define GPS_BAUDRATE 9600
|
||||||
|
#define PIN_GPS_REINIT (32 + 5) // An output to reset L76K GPS. As per datasheet, low for > 100ms will reset the L76K
|
||||||
|
#define PIN_GPS_STANDBY (32 + 2) // An output to wake GPS, low means allow sleep, high means force wake
|
||||||
|
// Seems to be missing on this new board
|
||||||
|
// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS
|
||||||
|
#define GPS_TX_PIN (32 + 9) // This is for bits going TOWARDS the CPU
|
||||||
|
#define GPS_RX_PIN (32 + 8) // This is for bits going TOWARDS the GPS
|
||||||
|
|
||||||
|
#define GPS_THREAD_INTERVAL 50
|
||||||
|
|
||||||
|
#define PIN_GPS_PPS (32 + 1) // GPS开关判断
|
||||||
|
|
||||||
|
#define PIN_SERIAL1_RX GPS_TX_PIN
|
||||||
|
#define PIN_SERIAL1_TX GPS_RX_PIN
|
||||||
|
|
||||||
|
// PCF8563 RTC Module
|
||||||
|
#define PCF8563_RTC 0x51
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SPI Interfaces
|
||||||
|
*/
|
||||||
|
#define SPI_INTERFACES_COUNT 2
|
||||||
|
|
||||||
|
// For LORA, spi 0
|
||||||
|
#define PIN_SPI_MISO (0 + 23)
|
||||||
|
#define PIN_SPI_MOSI (0 + 22)
|
||||||
|
#define PIN_SPI_SCK (0 + 19)
|
||||||
|
|
||||||
|
#define PIN_PWR_EN (0 + 6)
|
||||||
|
|
||||||
|
// To debug via the segger JLINK console rather than the CDC-ACM serial device
|
||||||
|
// #define USE_SEGGER
|
||||||
|
|
||||||
|
// Battery
|
||||||
|
// The battery sense is hooked to pin A0 (4)
|
||||||
|
// it is defined in the anlaolgue pin section of this file
|
||||||
|
// and has 12 bit resolution
|
||||||
|
#define BATTERY_SENSE_RESOLUTION_BITS 12
|
||||||
|
#define BATTERY_SENSE_RESOLUTION 4096.0
|
||||||
|
#undef AREF_VOLTAGE
|
||||||
|
#define AREF_VOLTAGE 3.0
|
||||||
|
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
|
||||||
|
#define ADC_MULTIPLIER (2.02F)
|
||||||
|
|
||||||
|
// #define HAS_RTC 0
|
||||||
|
// #define HAS_SCREEN 0
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
28
variants/ELECROW-ThinkNode-M2/pins_arduino.h
Normal file
28
variants/ELECROW-ThinkNode-M2/pins_arduino.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Need this file for ESP32-S3
|
||||||
|
// No need to modify this file, changes to pins imported from variant.h
|
||||||
|
// Most is similar to https://github.com/espressif/arduino-esp32/blob/master/variants/esp32s3/pins_arduino.h
|
||||||
|
|
||||||
|
#ifndef Pins_Arduino_h
|
||||||
|
#define Pins_Arduino_h
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <variant.h>
|
||||||
|
|
||||||
|
#define USB_VID 0x303a
|
||||||
|
#define USB_PID 0x1001
|
||||||
|
|
||||||
|
// Serial
|
||||||
|
static const uint8_t TX = UART_TX;
|
||||||
|
static const uint8_t RX = UART_RX;
|
||||||
|
|
||||||
|
// Default SPI will be mapped to Radio
|
||||||
|
static const uint8_t SS = LORA_CS;
|
||||||
|
static const uint8_t SCK = LORA_SCK;
|
||||||
|
static const uint8_t MOSI = LORA_MOSI;
|
||||||
|
static const uint8_t MISO = LORA_MISO;
|
||||||
|
|
||||||
|
// The default Wire will be mapped to PMU and RTC
|
||||||
|
static const uint8_t SCL = I2C_SCL;
|
||||||
|
static const uint8_t SDA = I2C_SDA;
|
||||||
|
|
||||||
|
#endif /* Pins_Arduino_h */
|
7
variants/ELECROW-ThinkNode-M2/platformio.ini
Normal file
7
variants/ELECROW-ThinkNode-M2/platformio.ini
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[env:thinknode_m2]
|
||||||
|
extends = esp32s3_base
|
||||||
|
board = ESP32-S3-WROOM-1-N4
|
||||||
|
build_flags =
|
||||||
|
${esp32s3_base.build_flags}
|
||||||
|
-D ELECROW_ThinkNode_M2
|
||||||
|
-I variants/ELECROW-ThinkNode-M2
|
64
variants/ELECROW-ThinkNode-M2/variant.h
Normal file
64
variants/ELECROW-ThinkNode-M2/variant.h
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// Status
|
||||||
|
#define LED_PIN_POWER 1
|
||||||
|
#define BIAS_T_ENABLE LED_PIN_POWER
|
||||||
|
#define BIAS_T_VALUE HIGH
|
||||||
|
|
||||||
|
#define PIN_BUTTON1 47 // 功能键
|
||||||
|
#define PIN_BUTTON2 4 // 电源键
|
||||||
|
|
||||||
|
#define POWER_CFG
|
||||||
|
#define POWER_CHRG 6
|
||||||
|
#define POWER_FULL 42
|
||||||
|
|
||||||
|
#define PIN_BUZZER 5
|
||||||
|
|
||||||
|
#define I2C_SCL 15
|
||||||
|
#define I2C_SDA 16
|
||||||
|
|
||||||
|
#define UART_TX 43
|
||||||
|
#define UART_RX 44
|
||||||
|
|
||||||
|
#define VEXT_ENABLE 46 // for OLED
|
||||||
|
#define VEXT_ON_VALUE HIGH
|
||||||
|
|
||||||
|
#define SX126X_CS 10
|
||||||
|
#define LORA_SCK 12
|
||||||
|
#define LORA_MOSI 11
|
||||||
|
#define LORA_MISO 13
|
||||||
|
#define SX126X_RESET 21
|
||||||
|
#define SX126X_BUSY 14
|
||||||
|
#define SX126X_DIO1 3
|
||||||
|
#define SX126X_DIO2_AS_RF_SWITCH
|
||||||
|
// #define SX126X_DIO3 9
|
||||||
|
#define SX126X_DIO3_TCXO_VOLTAGE 3.3
|
||||||
|
|
||||||
|
#define SX126X_MAX_POWER 22 // SX126xInterface.cpp defaults to 22 if not defined, but here we define it for good practice
|
||||||
|
#define USE_SX1262
|
||||||
|
#define LORA_CS SX126X_CS // FIXME: for some reason both are used in /src
|
||||||
|
#define LORA_DIO1 SX126X_DIO1
|
||||||
|
#define SX126X_POWER_EN 48
|
||||||
|
|
||||||
|
// Battery
|
||||||
|
// #define BATTERY_PIN 2
|
||||||
|
#define BATTERY_PIN 17
|
||||||
|
// #define ADC_CHANNEL ADC1_GPIO2_CHANNEL
|
||||||
|
#define ADC_CHANNEL ADC2_GPIO17_CHANNEL
|
||||||
|
#define BATTERY_SENSE_RESOLUTION_BITS 12
|
||||||
|
#define BATTERY_SENSE_RESOLUTION 4096.0
|
||||||
|
#undef AREF_VOLTAGE
|
||||||
|
#define AREF_VOLTAGE 3.0
|
||||||
|
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
|
||||||
|
#define ADC_MULTIPLIER (1.548F)
|
||||||
|
#define BAT_MEASURE_ADC_UNIT 2
|
||||||
|
|
||||||
|
#define HAS_SCREEN 1
|
||||||
|
#define USE_SH1106 1
|
||||||
|
|
||||||
|
// PCF8563 RTC Module
|
||||||
|
// #define PCF8563_RTC 0x51
|
||||||
|
// #define PIN_RTC_INT 48 // Interrupt from the PCF8563 RTC
|
||||||
|
#define HAS_RTC 0
|
||||||
|
#define HAS_GPS 0
|
||||||
|
|
||||||
|
#define BUTTON_PIN PIN_BUTTON1
|
||||||
|
#define BUTTON_PIN_ALT PIN_BUTTON2
|
@ -25,7 +25,7 @@ build_flags = ${esp32_base.build_flags}
|
|||||||
-DUSE_ARDUINO_HAL_GPIO
|
-DUSE_ARDUINO_HAL_GPIO
|
||||||
|
|
||||||
lib_deps = ${esp32s3_base.lib_deps}
|
lib_deps = ${esp32s3_base.lib_deps}
|
||||||
https://github.com/mverch67/LovyanGFX#develop
|
https://github.com/mverch67/LovyanGFX#4c76238c1344162a234ae917b27651af146d6fb2
|
||||||
earlephilhower/ESP8266Audio@^1.9.9
|
earlephilhower/ESP8266Audio@^1.9.9
|
||||||
earlephilhower/ESP8266SAM@^1.0.1
|
earlephilhower/ESP8266SAM@^1.0.1
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ build_flags =
|
|||||||
-D HAS_SCREEN=0
|
-D HAS_SCREEN=0
|
||||||
-D HAS_TFT=1
|
-D HAS_TFT=1
|
||||||
-D DISPLAY_SET_RESOLUTION
|
-D DISPLAY_SET_RESOLUTION
|
||||||
-D USE_I2S_BUZZER
|
-D USE_PIN_BUZZER
|
||||||
-D RAM_SIZE=4096
|
-D RAM_SIZE=4096
|
||||||
-D LV_LVGL_H_INCLUDE_SIMPLE
|
-D LV_LVGL_H_INCLUDE_SIMPLE
|
||||||
-D LV_CONF_INCLUDE_SIMPLE
|
-D LV_CONF_INCLUDE_SIMPLE
|
||||||
@ -66,10 +66,9 @@ build_flags =
|
|||||||
-D LGFX_DRIVER=LGFX_INDICATOR
|
-D LGFX_DRIVER=LGFX_INDICATOR
|
||||||
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_INDICATOR.h\"
|
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_INDICATOR.h\"
|
||||||
-D VIEW_320x240
|
-D VIEW_320x240
|
||||||
; -D USE_DOUBLE_BUFFER
|
|
||||||
-D USE_PACKET_API
|
-D USE_PACKET_API
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${env:seeed-sensecap-indicator.lib_deps}
|
${env:seeed-sensecap-indicator.lib_deps}
|
||||||
${device-ui_base.lib_deps}
|
${device-ui_base.lib_deps}
|
||||||
https://github.com/bitbank2/bb_captouch.git#8f2f06462ff597847921739376a299db93612417 ; alternative touch library supporting FT6x36
|
https://github.com/mverch67/bb_captouch.git#8626412fe650d808a267791c0eae6e5860c85a5d ; alternative touch library supporting FT6x36
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[VERSION]
|
[VERSION]
|
||||||
major = 2
|
major = 2
|
||||||
minor = 6
|
minor = 6
|
||||||
build = 3
|
build = 4
|
||||||
|
Loading…
Reference in New Issue
Block a user