mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-07 18:37:52 +00:00
Compare commits
3 Commits
elecrow-m4
...
InkHUD_une
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca0e845c52 | ||
|
|
a59723030a | ||
|
|
a6cdf2c50b |
176
.github/workflows/build_one_arch.yml
vendored
Normal file
176
.github/workflows/build_one_arch.yml
vendored
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
name: Build One Arch
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
# trunk-ignore(checkov/CKV_GHA_7)
|
||||||
|
arch:
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- esp32
|
||||||
|
- esp32s3
|
||||||
|
- esp32c3
|
||||||
|
- esp32c6
|
||||||
|
- nrf52840
|
||||||
|
- rp2040
|
||||||
|
- rp2350
|
||||||
|
- stm32
|
||||||
|
- native
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
env:
|
||||||
|
INPUT_ARCH: ${{ github.event.inputs.arch }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: actions/setup-python@v6
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
cache: pip
|
||||||
|
- run: pip install -U platformio
|
||||||
|
- name: Generate matrix
|
||||||
|
id: jsonStep
|
||||||
|
run: |
|
||||||
|
TARGETS=$(./bin/generate_ci_matrix.py $INPUT_ARCH --level extra)
|
||||||
|
echo "Name: $GITHUB_REF_NAME Base: $GITHUB_BASE_REF Ref: $GITHUB_REF"
|
||||||
|
echo "selected_arch=$TARGETS" >> $GITHUB_OUTPUT
|
||||||
|
outputs:
|
||||||
|
selected_arch: ${{ steps.jsonStep.outputs.selected_arch }}
|
||||||
|
|
||||||
|
version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- name: Get release version string
|
||||||
|
run: |
|
||||||
|
echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
||||||
|
echo "deb=$(./bin/buildinfo.py deb)" >> $GITHUB_OUTPUT
|
||||||
|
id: version
|
||||||
|
env:
|
||||||
|
BUILD_LOCATION: local
|
||||||
|
outputs:
|
||||||
|
long: ${{ steps.version.outputs.long }}
|
||||||
|
deb: ${{ steps.version.outputs.deb }}
|
||||||
|
|
||||||
|
build:
|
||||||
|
if: ${{ github.event_name != 'workflow_dispatch' }}
|
||||||
|
needs: [setup, version]
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
build: ${{ fromJson(needs.setup.outputs.selected_arch) }}
|
||||||
|
uses: ./.github/workflows/build_firmware.yml
|
||||||
|
with:
|
||||||
|
version: ${{ needs.version.outputs.long }}
|
||||||
|
pio_env: ${{ matrix.build.board }}
|
||||||
|
platform: ${{ matrix.build.arch }}
|
||||||
|
|
||||||
|
build-debian-src:
|
||||||
|
if: ${{ github.repository == 'meshtastic/firmware' && github.event_name != 'workflow_dispatch' || inputs.arch == 'native' }}
|
||||||
|
uses: ./.github/workflows/build_debian_src.yml
|
||||||
|
with:
|
||||||
|
series: UNRELEASED
|
||||||
|
build_location: local
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
package-pio-deps-native-tft:
|
||||||
|
if: ${{ inputs.arch == 'native' }}
|
||||||
|
uses: ./.github/workflows/package_pio_deps.yml
|
||||||
|
with:
|
||||||
|
pio_env: native-tft
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
test-native:
|
||||||
|
if: ${{ !contains(github.ref_name, 'event/') && github.event_name != 'workflow_dispatch' || !contains(github.ref_name, 'event/') && inputs.arch == 'native' }}
|
||||||
|
uses: ./.github/workflows/test_native.yml
|
||||||
|
|
||||||
|
gather-artifacts:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
arch:
|
||||||
|
- esp32
|
||||||
|
- esp32s3
|
||||||
|
- esp32c3
|
||||||
|
- esp32c6
|
||||||
|
- nrf52840
|
||||||
|
- rp2040
|
||||||
|
- rp2350
|
||||||
|
- stm32
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [version, build]
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: ${{github.event.pull_request.head.ref}}
|
||||||
|
repository: ${{github.event.pull_request.head.repo.full_name}}
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v6
|
||||||
|
with:
|
||||||
|
path: ./
|
||||||
|
pattern: firmware-${{inputs.arch}}-*
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Display structure of downloaded files
|
||||||
|
run: ls -R
|
||||||
|
|
||||||
|
- name: Move files up
|
||||||
|
run: mv -b -t ./ ./bin/device-*.sh ./bin/device-*.bat
|
||||||
|
|
||||||
|
- name: Repackage in single firmware zip
|
||||||
|
uses: actions/upload-artifact@v5
|
||||||
|
with:
|
||||||
|
name: firmware-${{inputs.arch}}-${{ needs.version.outputs.long }}
|
||||||
|
overwrite: true
|
||||||
|
path: |
|
||||||
|
./firmware-*.bin
|
||||||
|
./firmware-*.uf2
|
||||||
|
./firmware-*.hex
|
||||||
|
./firmware-*-ota.zip
|
||||||
|
./device-*.sh
|
||||||
|
./device-*.bat
|
||||||
|
./littlefs-*.bin
|
||||||
|
./bleota*bin
|
||||||
|
./Meshtastic_nRF52_factory_erase*.uf2
|
||||||
|
retention-days: 30
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v6
|
||||||
|
with:
|
||||||
|
name: firmware-${{inputs.arch}}-${{ needs.version.outputs.long }}
|
||||||
|
merge-multiple: true
|
||||||
|
path: ./output
|
||||||
|
|
||||||
|
# For diagnostics
|
||||||
|
- name: Show artifacts
|
||||||
|
run: ls -lR
|
||||||
|
|
||||||
|
- name: Device scripts permissions
|
||||||
|
run: |
|
||||||
|
chmod +x ./output/device-install.sh
|
||||||
|
chmod +x ./output/device-update.sh
|
||||||
|
|
||||||
|
- name: Zip firmware
|
||||||
|
run: zip -j -9 -r ./firmware-${{inputs.arch}}-${{ needs.version.outputs.long }}.zip ./output
|
||||||
|
|
||||||
|
- name: Repackage in single elfs zip
|
||||||
|
uses: actions/upload-artifact@v5
|
||||||
|
with:
|
||||||
|
name: debug-elfs-${{inputs.arch}}-${{ needs.version.outputs.long }}.zip
|
||||||
|
overwrite: true
|
||||||
|
path: ./*.elf
|
||||||
|
retention-days: 30
|
||||||
|
|
||||||
|
- uses: scruplelesswizard/comment-artifact@main
|
||||||
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
|
with:
|
||||||
|
name: firmware-${{inputs.arch}}-${{ needs.version.outputs.long }}
|
||||||
|
description: "Download firmware-${{inputs.arch}}-${{ needs.version.outputs.long }}.zip. This artifact will be available for 90 days from creation"
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
23
.github/workflows/build_one_target.yml
vendored
23
.github/workflows/build_one_target.yml
vendored
@@ -15,6 +15,7 @@ on:
|
|||||||
- rp2040
|
- rp2040
|
||||||
- rp2350
|
- rp2350
|
||||||
- stm32
|
- stm32
|
||||||
|
- native
|
||||||
target:
|
target:
|
||||||
type: string
|
type: string
|
||||||
required: false
|
required: false
|
||||||
@@ -41,6 +42,7 @@ jobs:
|
|||||||
- rp2040
|
- rp2040
|
||||||
- rp2350
|
- rp2350
|
||||||
- stm32
|
- stm32
|
||||||
|
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
@@ -58,7 +60,7 @@ jobs:
|
|||||||
echo "Arch: ${{matrix.arch}}" >> $GITHUB_STEP_SUMMARY
|
echo "Arch: ${{matrix.arch}}" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "Ref: $GITHUB_REF" >> $GITHUB_STEP_SUMMARY
|
echo "Ref: $GITHUB_REF" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "Targets:" >> $GITHUB_STEP_SUMMARY
|
echo "Targets:" >> $GITHUB_STEP_SUMMARY
|
||||||
echo $TARGETS | jq -r 'sort_by(.board) |.[] | "- " + .board' >> $GITHUB_STEP_SUMMARY
|
echo $TARGETS >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
version:
|
version:
|
||||||
if: ${{ inputs.target != '' }}
|
if: ${{ inputs.target != '' }}
|
||||||
@@ -85,6 +87,25 @@ jobs:
|
|||||||
pio_env: ${{ inputs.target }}
|
pio_env: ${{ inputs.target }}
|
||||||
platform: ${{ inputs.arch }}
|
platform: ${{ inputs.arch }}
|
||||||
|
|
||||||
|
build-debian-src:
|
||||||
|
if: ${{ github.repository == 'meshtastic/firmware' && inputs.arch == 'native' }}
|
||||||
|
uses: ./.github/workflows/build_debian_src.yml
|
||||||
|
with:
|
||||||
|
series: UNRELEASED
|
||||||
|
build_location: local
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
package-pio-deps-native-tft:
|
||||||
|
if: ${{ inputs.arch == 'native' }}
|
||||||
|
uses: ./.github/workflows/package_pio_deps.yml
|
||||||
|
with:
|
||||||
|
pio_env: native-tft
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
test-native:
|
||||||
|
if: ${{ !contains(github.ref_name, 'event/') && github.event_name != 'workflow_dispatch' || !contains(github.ref_name, 'event/') && inputs.arch == 'native' && inputs.target != '' }}
|
||||||
|
uses: ./.github/workflows/test_native.yml
|
||||||
|
|
||||||
gather-artifacts:
|
gather-artifacts:
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ plugins:
|
|||||||
lint:
|
lint:
|
||||||
enabled:
|
enabled:
|
||||||
- checkov@3.2.495
|
- checkov@3.2.495
|
||||||
- renovate@42.24.1
|
- renovate@42.26.3
|
||||||
- prettier@3.6.2
|
- prettier@3.7.1
|
||||||
- trufflehog@3.91.1
|
- trufflehog@3.91.1
|
||||||
- yamllint@1.37.1
|
- yamllint@1.37.1
|
||||||
- bandit@1.9.2
|
- bandit@1.9.2
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
{
|
|
||||||
"build": {
|
|
||||||
"arduino": {
|
|
||||||
"ldscript": "nrf52840_s140_v6.ld"
|
|
||||||
},
|
|
||||||
"core": "nRF5",
|
|
||||||
"cpu": "cortex-m4",
|
|
||||||
"extra_flags": "-DARDUINO_NRF52840_ELECROW_M4 -DNRF52840_XXAA",
|
|
||||||
"f_cpu": "64000000L",
|
|
||||||
"hwids": [
|
|
||||||
["0x239A", "0x4405"],
|
|
||||||
["0x239A", "0x0029"],
|
|
||||||
["0x239A", "0x002A"]
|
|
||||||
],
|
|
||||||
"usb_product": "elecrow_thinknode_m4",
|
|
||||||
"mcu": "nrf52840",
|
|
||||||
"variant": "ELECROW-ThinkNode-M4",
|
|
||||||
"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 ThinkNode m4",
|
|
||||||
"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": "https://www.elecrow.com/thinknode-m4-power-bank-lora-device-with-meshtastic-lora-tracker-function-powered-by-nrf52840.html",
|
|
||||||
"vendor": "ELECROW"
|
|
||||||
}
|
|
||||||
134
src/Power.cpp
134
src/Power.cpp
@@ -692,8 +692,6 @@ bool Power::setup()
|
|||||||
found = true;
|
found = true;
|
||||||
} else if (lipoChargerInit()) {
|
} else if (lipoChargerInit()) {
|
||||||
found = true;
|
found = true;
|
||||||
} else if (serialBatteryInit()) {
|
|
||||||
found = true;
|
|
||||||
} else if (meshSolarInit()) {
|
} else if (meshSolarInit()) {
|
||||||
found = true;
|
found = true;
|
||||||
} else if (analogInit()) {
|
} else if (analogInit()) {
|
||||||
@@ -1568,135 +1566,3 @@ bool Power::meshSolarInit()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_SERIAL_BATTERY_LEVEL
|
|
||||||
#include <SoftwareSerial.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SerialBatteryLevel class for pulling battery information from a secondary MCU over serial.
|
|
||||||
*/
|
|
||||||
class SerialBatteryLevel : public HasBatteryLevel
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* Init the I2C meshSolar battery level sensor
|
|
||||||
*/
|
|
||||||
bool runOnce()
|
|
||||||
{
|
|
||||||
BatterySerial.begin(4800);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Battery state of charge, from 0 to 100 or -1 for unknown
|
|
||||||
*/
|
|
||||||
virtual int getBatteryPercent() override { return v_percent; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The raw voltage of the battery in millivolts, or NAN if unknown
|
|
||||||
*/
|
|
||||||
virtual uint16_t getBattVoltage() override { return voltage * 1000; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return true if there is a battery installed in this unit
|
|
||||||
*/
|
|
||||||
virtual bool isBatteryConnect() override
|
|
||||||
{
|
|
||||||
// definitely need to gobble up more bytes at once
|
|
||||||
if (BatterySerial.available() > 5) {
|
|
||||||
LOG_WARN("SerialBatteryLevel: %u bytes available", BatterySerial.available());
|
|
||||||
while (BatterySerial.available() > 11) {
|
|
||||||
BatterySerial.read(); // flush old data
|
|
||||||
}
|
|
||||||
LOG_WARN("SerialBatteryLevel: %u bytes now available", BatterySerial.available());
|
|
||||||
int tries = 0;
|
|
||||||
while (BatterySerial.read() != 0xFE) {
|
|
||||||
tries++; // wait for start byte
|
|
||||||
if (tries > 10) {
|
|
||||||
LOG_WARN("SerialBatteryLevel: no start byte found");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Data[1] = BatterySerial.read();
|
|
||||||
Data[2] = BatterySerial.read();
|
|
||||||
Data[3] = BatterySerial.read();
|
|
||||||
Data[4] = BatterySerial.read();
|
|
||||||
Data[5] = BatterySerial.read();
|
|
||||||
if (Data[5] != 0xFD) {
|
|
||||||
LOG_WARN("SerialBatteryLevel: invalid end byte %02x", Data[5]);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
v_percent = Data[1];
|
|
||||||
voltage = Data[2] + (((float)Data[3]) / 100) + (((float)Data[4]) / 10000);
|
|
||||||
voltage *= 2;
|
|
||||||
LOG_WARN("SerialBatteryLevel: received data %u, %f, %02x", v_percent, voltage, Data[5]);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// This function runs first, so use it to grab the latest data from the secondary MCU
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return true if there is an external power source detected
|
|
||||||
*/
|
|
||||||
virtual bool isVbusIn() override
|
|
||||||
{
|
|
||||||
#if defined(EXT_CHRG_DETECT)
|
|
||||||
|
|
||||||
return digitalRead(EXT_CHRG_DETECT) == ext_chrg_detect_value;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool isCharging() override
|
|
||||||
{
|
|
||||||
#ifdef EXT_CHRG_DETECT
|
|
||||||
return digitalRead(EXT_CHRG_DETECT) == ext_chrg_detect_value;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
// by default, we check the battery voltage only
|
|
||||||
return isVbusIn();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
SoftwareSerial BatterySerial = SoftwareSerial(SERIAL_BATTERY_RX, SERIAL_BATTERY_TX);
|
|
||||||
uint8_t Data[6] = {0};
|
|
||||||
int v_percent = 0;
|
|
||||||
float voltage = 0.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
SerialBatteryLevel serialBatteryLevel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Init the serial battery level sensor
|
|
||||||
*/
|
|
||||||
bool Power::serialBatteryInit()
|
|
||||||
{
|
|
||||||
#ifdef EXT_PWR_DETECT
|
|
||||||
pinMode(EXT_PWR_DETECT, INPUT);
|
|
||||||
#endif
|
|
||||||
#ifdef EXT_CHRG_DETECT
|
|
||||||
pinMode(EXT_CHRG_DETECT, ext_chrg_detect_mode);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool result = serialBatteryLevel.runOnce();
|
|
||||||
LOG_DEBUG("Power::serialBatteryInit serial battery sensor is %s", result ? "ready" : "not ready yet");
|
|
||||||
if (!result)
|
|
||||||
return false;
|
|
||||||
batteryLevel = &serialBatteryLevel;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
/**
|
|
||||||
* If this device has no serial battery level sensor, don't try to use it.
|
|
||||||
*/
|
|
||||||
bool Power::serialBatteryInit()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -38,16 +38,14 @@ template <typename T, std::size_t N> std::size_t array_count(const T (&)[N])
|
|||||||
return N;
|
return N;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GPS_SERIAL_PORT
|
#if defined(NRF52840_XXAA) || defined(NRF52833_XXAA) || defined(ARCH_ESP32) || defined(ARCH_PORTDUINO) || defined(ARCH_STM32WL)
|
||||||
#define GPS_SERIAL_PORT Serial1
|
#if defined(GPS_SERIAL_PORT)
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(ARCH_NRF52)
|
|
||||||
Uart *GPS::_serial_gps = &GPS_SERIAL_PORT;
|
|
||||||
#elif defined(ARCH_ESP32) || defined(ARCH_PORTDUINO) || defined(ARCH_STM32WL)
|
|
||||||
HardwareSerial *GPS::_serial_gps = &GPS_SERIAL_PORT;
|
HardwareSerial *GPS::_serial_gps = &GPS_SERIAL_PORT;
|
||||||
|
#else
|
||||||
|
HardwareSerial *GPS::_serial_gps = &Serial1;
|
||||||
|
#endif
|
||||||
#elif defined(ARCH_RP2040)
|
#elif defined(ARCH_RP2040)
|
||||||
SerialUART *GPS::_serial_gps = &GPS_SERIAL_PORT;
|
SerialUART *GPS::_serial_gps = &Serial1;
|
||||||
#else
|
#else
|
||||||
HardwareSerial *GPS::_serial_gps = nullptr;
|
HardwareSerial *GPS::_serial_gps = nullptr;
|
||||||
#endif
|
#endif
|
||||||
@@ -896,11 +894,14 @@ void GPS::writePinEN(bool on)
|
|||||||
void GPS::writePinStandby(bool standby)
|
void GPS::writePinStandby(bool standby)
|
||||||
{
|
{
|
||||||
#ifdef PIN_GPS_STANDBY // Specifically the standby pin for L76B, L76K and clones
|
#ifdef PIN_GPS_STANDBY // Specifically the standby pin for L76B, L76K and clones
|
||||||
bool val;
|
|
||||||
if (standby)
|
// Determine the new value for the pin
|
||||||
val = GPS_STANDBY_ACTIVE;
|
// Normally: active HIGH for awake
|
||||||
else
|
#ifdef PIN_GPS_STANDBY_INVERTED
|
||||||
val = !GPS_STANDBY_ACTIVE;
|
bool val = standby;
|
||||||
|
#else
|
||||||
|
bool val = !standby;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Write and log
|
// Write and log
|
||||||
pinMode(PIN_GPS_STANDBY, OUTPUT);
|
pinMode(PIN_GPS_STANDBY, OUTPUT);
|
||||||
@@ -1524,7 +1525,10 @@ GPS *GPS::createGps()
|
|||||||
int8_t _rx_gpio = config.position.rx_gpio;
|
int8_t _rx_gpio = config.position.rx_gpio;
|
||||||
int8_t _tx_gpio = config.position.tx_gpio;
|
int8_t _tx_gpio = config.position.tx_gpio;
|
||||||
int8_t _en_gpio = config.position.gps_en_gpio;
|
int8_t _en_gpio = config.position.gps_en_gpio;
|
||||||
|
#if HAS_GPS && !defined(ARCH_ESP32)
|
||||||
|
_rx_gpio = 1; // We only specify GPS serial ports on ESP32. Otherwise, these are just flags.
|
||||||
|
_tx_gpio = 1;
|
||||||
|
#endif
|
||||||
#if defined(GPS_RX_PIN)
|
#if defined(GPS_RX_PIN)
|
||||||
if (!_rx_gpio)
|
if (!_rx_gpio)
|
||||||
_rx_gpio = GPS_RX_PIN;
|
_rx_gpio = GPS_RX_PIN;
|
||||||
@@ -1598,28 +1602,16 @@ GPS *GPS::createGps()
|
|||||||
_serial_gps->setRxBufferSize(SERIAL_BUFFER_SIZE); // the default is 256
|
_serial_gps->setRxBufferSize(SERIAL_BUFFER_SIZE); // the default is 256
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LOG_DEBUG("Use GPIO%d for GPS RX", new_gps->rx_gpio);
|
|
||||||
LOG_DEBUG("Use GPIO%d for GPS TX", new_gps->tx_gpio);
|
|
||||||
|
|
||||||
// ESP32 has a special set of parameters vs other arduino ports
|
// ESP32 has a special set of parameters vs other arduino ports
|
||||||
#if defined(ARCH_ESP32)
|
#if defined(ARCH_ESP32)
|
||||||
|
LOG_DEBUG("Use GPIO%d for GPS RX", new_gps->rx_gpio);
|
||||||
|
LOG_DEBUG("Use GPIO%d for GPS TX", new_gps->tx_gpio);
|
||||||
_serial_gps->begin(GPS_BAUDRATE, SERIAL_8N1, new_gps->rx_gpio, new_gps->tx_gpio);
|
_serial_gps->begin(GPS_BAUDRATE, SERIAL_8N1, new_gps->rx_gpio, new_gps->tx_gpio);
|
||||||
#elif defined(ARCH_RP2040)
|
#elif defined(ARCH_RP2040)
|
||||||
_serial_gps->setPinout(new_gps->tx_gpio, new_gps->rx_gpio);
|
|
||||||
_serial_gps->setFIFOSize(256);
|
_serial_gps->setFIFOSize(256);
|
||||||
_serial_gps->begin(GPS_BAUDRATE);
|
_serial_gps->begin(GPS_BAUDRATE);
|
||||||
#elif defined(ARCH_NRF52)
|
|
||||||
_serial_gps->setPins(new_gps->rx_gpio, new_gps->tx_gpio);
|
|
||||||
_serial_gps->begin(GPS_BAUDRATE);
|
|
||||||
#elif defined(ARCH_STM32WL)
|
|
||||||
_serial_gps->setTx(new_gps->tx_gpio);
|
|
||||||
_serial_gps->setRx(new_gps->rx_gpio);
|
|
||||||
_serial_gps->begin(GPS_BAUDRATE);
|
|
||||||
#elif defined(ARCH_PORTDUINO)
|
|
||||||
// Portduino can't set the GPS pins directly.
|
|
||||||
_serial_gps->begin(GPS_BAUDRATE);
|
|
||||||
#else
|
#else
|
||||||
#error Unsupported architecture!
|
_serial_gps->begin(GPS_BAUDRATE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return new_gps;
|
return new_gps;
|
||||||
|
|||||||
@@ -16,11 +16,6 @@
|
|||||||
#define GPS_EN_ACTIVE 1
|
#define GPS_EN_ACTIVE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Allow defining the polarity of the STANDBY output. default is LOW for standby
|
|
||||||
#ifndef GPS_STANDBY_ACTIVE
|
|
||||||
#define GPS_STANDBY_ACTIVE LOW
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static constexpr uint32_t GPS_UPDATE_ALWAYS_ON_THRESHOLD_MS = 10 * 1000UL;
|
static constexpr uint32_t GPS_UPDATE_ALWAYS_ON_THRESHOLD_MS = 10 * 1000UL;
|
||||||
static constexpr uint32_t GPS_FIX_HOLD_MAX_MS = 20000;
|
static constexpr uint32_t GPS_FIX_HOLD_MAX_MS = 20000;
|
||||||
|
|
||||||
@@ -199,8 +194,6 @@ class GPS : private concurrency::OSThread
|
|||||||
/** If !NULL we will use this serial port to construct our GPS */
|
/** If !NULL we will use this serial port to construct our GPS */
|
||||||
#if defined(ARCH_RP2040)
|
#if defined(ARCH_RP2040)
|
||||||
static SerialUART *_serial_gps;
|
static SerialUART *_serial_gps;
|
||||||
#elif defined(ARCH_NRF52)
|
|
||||||
static Uart *_serial_gps;
|
|
||||||
#else
|
#else
|
||||||
static HardwareSerial *_serial_gps;
|
static HardwareSerial *_serial_gps;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -506,6 +506,9 @@ void VirtualKeyboard::drawKey(OLEDDisplay *display, const VirtualKey &key, bool
|
|||||||
centeredTextY -= 1;
|
centeredTextY -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef MUZI_BASE // Correct issue with character vertical position on MUZI_BASE
|
||||||
|
centeredTextY -= 2;
|
||||||
|
#endif
|
||||||
display->drawString(textX, centeredTextY, keyText.c_str());
|
display->drawString(textX, centeredTextY, keyText.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ uint32_t InkHUD::AppletFont::toUtf32(std::string utf8)
|
|||||||
utf32 |= (utf8.at(3) & 0b00111111);
|
utf32 |= (utf8.at(3) & 0b00111111);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(false);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return utf32;
|
return utf32;
|
||||||
|
|||||||
@@ -64,9 +64,8 @@ SerialModule *serialModule;
|
|||||||
SerialModuleRadio *serialModuleRadio;
|
SerialModuleRadio *serialModuleRadio;
|
||||||
|
|
||||||
#if defined(TTGO_T_ECHO) || defined(CANARYONE) || defined(MESHLINK) || defined(ELECROW_ThinkNode_M1) || \
|
#if defined(TTGO_T_ECHO) || defined(CANARYONE) || defined(MESHLINK) || defined(ELECROW_ThinkNode_M1) || \
|
||||||
defined(ELECROW_ThinkNode_M4) || defined(ELECROW_ThinkNode_M5) || defined(HELTEC_MESH_SOLAR) || defined(T_ECHO_LITE) || \
|
defined(ELECROW_ThinkNode_M5) || defined(HELTEC_MESH_SOLAR) || defined(T_ECHO_LITE) || defined(ELECROW_ThinkNode_M3) || \
|
||||||
defined(ELECROW_ThinkNode_M3) || defined(MUZI_BASE)
|
defined(MUZI_BASE)
|
||||||
|
|
||||||
SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial")
|
SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial")
|
||||||
{
|
{
|
||||||
api_type = TYPE_SERIAL;
|
api_type = TYPE_SERIAL;
|
||||||
@@ -206,9 +205,7 @@ int32_t SerialModule::runOnce()
|
|||||||
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(T_ECHO_LITE) && !defined(CANARYONE) && !defined(MESHLINK) && \
|
#elif !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(MESHLINK) && \
|
||||||
!defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M4) && \
|
!defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) && !defined(MUZI_BASE)
|
||||||
!defined(ELECROW_ThinkNode_M5) && !defined(MUZI_BASE)
|
|
||||||
|
|
||||||
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);
|
||||||
@@ -265,8 +262,7 @@ int32_t SerialModule::runOnce()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(MESHLINK) && \
|
#if !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(MESHLINK) && \
|
||||||
!defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M4) && \
|
!defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) && !defined(MUZI_BASE)
|
||||||
!defined(ELECROW_ThinkNode_M5) && !defined(MUZI_BASE)
|
|
||||||
else if ((moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85)) {
|
else if ((moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85)) {
|
||||||
processWXSerial();
|
processWXSerial();
|
||||||
|
|
||||||
@@ -541,9 +537,8 @@ ParsedLine parseLine(const char *line)
|
|||||||
void SerialModule::processWXSerial()
|
void SerialModule::processWXSerial()
|
||||||
{
|
{
|
||||||
#if !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && \
|
#if !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && \
|
||||||
!defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M4) && \
|
!defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) && \
|
||||||
!defined(ELECROW_ThinkNode_M5) && !defined(ARCH_STM32WL) && !defined(MUZI_BASE)
|
!defined(ARCH_STM32WL) && !defined(MUZI_BASE)
|
||||||
|
|
||||||
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;
|
||||||
|
|||||||
@@ -13,18 +13,16 @@ StatusLEDModule::StatusLEDModule() : concurrency::OSThread("StatusLEDModule")
|
|||||||
{
|
{
|
||||||
bluetoothStatusObserver.observe(&bluetoothStatus->onNewStatus);
|
bluetoothStatusObserver.observe(&bluetoothStatus->onNewStatus);
|
||||||
powerStatusObserver.observe(&powerStatus->onNewStatus);
|
powerStatusObserver.observe(&powerStatus->onNewStatus);
|
||||||
if (inputBroker)
|
|
||||||
inputObserver.observe(inputBroker);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int StatusLEDModule::handleStatusUpdate(const meshtastic::Status *arg)
|
int StatusLEDModule::handleStatusUpdate(const meshtastic::Status *arg)
|
||||||
{
|
{
|
||||||
switch (arg->getStatusType()) {
|
switch (arg->getStatusType()) {
|
||||||
case STATUS_TYPE_POWER: {
|
case STATUS_TYPE_POWER: {
|
||||||
meshtastic::PowerStatus *_powerStatus = (meshtastic::PowerStatus *)arg;
|
meshtastic::PowerStatus *powerStatus = (meshtastic::PowerStatus *)arg;
|
||||||
if (_powerStatus->getHasUSB()) {
|
if (powerStatus->getHasUSB()) {
|
||||||
power_state = charging;
|
power_state = charging;
|
||||||
if (_powerStatus->getBatteryChargePercent() >= 100) {
|
if (powerStatus->getBatteryChargePercent() >= 100) {
|
||||||
power_state = charged;
|
power_state = charged;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -58,12 +56,6 @@ int StatusLEDModule::handleStatusUpdate(const meshtastic::Status *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
int StatusLEDModule::handleInputEvent(const InputEvent *event)
|
|
||||||
{
|
|
||||||
lastUserbuttonTime = millis();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t StatusLEDModule::runOnce()
|
int32_t StatusLEDModule::runOnce()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -90,21 +82,6 @@ int32_t StatusLEDModule::runOnce()
|
|||||||
PAIRING_LED_state = LED_STATE_ON;
|
PAIRING_LED_state = LED_STATE_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool chargeIndicatorLED1 = LED_STATE_OFF;
|
|
||||||
bool chargeIndicatorLED2 = LED_STATE_OFF;
|
|
||||||
bool chargeIndicatorLED3 = LED_STATE_OFF;
|
|
||||||
bool chargeIndicatorLED4 = LED_STATE_OFF;
|
|
||||||
if (lastUserbuttonTime + 10 * 1000 > millis()) {
|
|
||||||
// should this be off at very low percentages?
|
|
||||||
chargeIndicatorLED1 = LED_STATE_ON;
|
|
||||||
if (powerStatus && powerStatus->getBatteryChargePercent() >= 25)
|
|
||||||
chargeIndicatorLED2 = LED_STATE_ON;
|
|
||||||
if (powerStatus && powerStatus->getBatteryChargePercent() >= 50)
|
|
||||||
chargeIndicatorLED3 = LED_STATE_ON;
|
|
||||||
if (powerStatus && powerStatus->getBatteryChargePercent() >= 75)
|
|
||||||
chargeIndicatorLED4 = LED_STATE_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef LED_CHARGE
|
#ifdef LED_CHARGE
|
||||||
digitalWrite(LED_CHARGE, CHARGE_LED_state);
|
digitalWrite(LED_CHARGE, CHARGE_LED_state);
|
||||||
#endif
|
#endif
|
||||||
@@ -113,18 +90,5 @@ int32_t StatusLEDModule::runOnce()
|
|||||||
digitalWrite(LED_PAIRING, PAIRING_LED_state);
|
digitalWrite(LED_PAIRING, PAIRING_LED_state);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Battery_LED_1
|
|
||||||
digitalWrite(Battery_LED_1, chargeIndicatorLED1);
|
|
||||||
#endif
|
|
||||||
#ifdef Battery_LED_2
|
|
||||||
digitalWrite(Battery_LED_2, chargeIndicatorLED2);
|
|
||||||
#endif
|
|
||||||
#ifdef Battery_LED_3
|
|
||||||
digitalWrite(Battery_LED_3, chargeIndicatorLED3);
|
|
||||||
#endif
|
|
||||||
#ifdef Battery_LED_4
|
|
||||||
digitalWrite(Battery_LED_4, chargeIndicatorLED4);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return (my_interval);
|
return (my_interval);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "PowerStatus.h"
|
#include "PowerStatus.h"
|
||||||
#include "concurrency/OSThread.h"
|
#include "concurrency/OSThread.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "input/InputBroker.h"
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@@ -18,8 +17,6 @@ class StatusLEDModule : private concurrency::OSThread
|
|||||||
|
|
||||||
int handleStatusUpdate(const meshtastic::Status *);
|
int handleStatusUpdate(const meshtastic::Status *);
|
||||||
|
|
||||||
int handleInputEvent(const InputEvent *arg);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
unsigned int my_interval = 1000; // interval in millisconds
|
unsigned int my_interval = 1000; // interval in millisconds
|
||||||
virtual int32_t runOnce() override;
|
virtual int32_t runOnce() override;
|
||||||
@@ -28,15 +25,12 @@ class StatusLEDModule : private concurrency::OSThread
|
|||||||
CallbackObserver<StatusLEDModule, const meshtastic::Status *>(this, &StatusLEDModule::handleStatusUpdate);
|
CallbackObserver<StatusLEDModule, const meshtastic::Status *>(this, &StatusLEDModule::handleStatusUpdate);
|
||||||
CallbackObserver<StatusLEDModule, const meshtastic::Status *> powerStatusObserver =
|
CallbackObserver<StatusLEDModule, const meshtastic::Status *> powerStatusObserver =
|
||||||
CallbackObserver<StatusLEDModule, const meshtastic::Status *>(this, &StatusLEDModule::handleStatusUpdate);
|
CallbackObserver<StatusLEDModule, const meshtastic::Status *>(this, &StatusLEDModule::handleStatusUpdate);
|
||||||
CallbackObserver<StatusLEDModule, const InputEvent *> inputObserver =
|
|
||||||
CallbackObserver<StatusLEDModule, const InputEvent *>(this, &StatusLEDModule::handleInputEvent);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool CHARGE_LED_state = LED_STATE_OFF;
|
bool CHARGE_LED_state = LED_STATE_OFF;
|
||||||
bool PAIRING_LED_state = LED_STATE_OFF;
|
bool PAIRING_LED_state = LED_STATE_OFF;
|
||||||
|
|
||||||
uint32_t PAIRING_LED_starttime = 0;
|
uint32_t PAIRING_LED_starttime = 0;
|
||||||
uint32_t lastUserbuttonTime = 0;
|
|
||||||
|
|
||||||
enum PowerState { discharging, charging, charged };
|
enum PowerState { discharging, charging, charged };
|
||||||
|
|
||||||
|
|||||||
@@ -72,8 +72,6 @@
|
|||||||
#define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M3
|
#define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M3
|
||||||
#elif defined(ELECROW_ThinkNode_M6)
|
#elif defined(ELECROW_ThinkNode_M6)
|
||||||
#define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M6
|
#define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M6
|
||||||
#elif defined(ELECROW_ThinkNode_M4)
|
|
||||||
#define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M4
|
|
||||||
#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)
|
||||||
|
|||||||
@@ -132,8 +132,6 @@ class Power : private concurrency::OSThread
|
|||||||
bool lipoChargerInit();
|
bool lipoChargerInit();
|
||||||
/// Setup a meshSolar battery sensor
|
/// Setup a meshSolar battery sensor
|
||||||
bool meshSolarInit();
|
bool meshSolarInit();
|
||||||
/// Setup a serial battery sensor
|
|
||||||
bool serialBatteryInit();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
; ThinkNode M4 - Powerbank nrf52840/LR1110 by Elecrow
|
|
||||||
[env:thinknode_m4]
|
|
||||||
extends = nrf52840_base
|
|
||||||
board = ThinkNode-M4
|
|
||||||
board_check = true
|
|
||||||
debug_tool = jlink
|
|
||||||
|
|
||||||
build_flags = ${nrf52840_base.build_flags}
|
|
||||||
-Ivariants/nrf52840/ELECROW-ThinkNode-M4
|
|
||||||
-DELECROW_ThinkNode_M4
|
|
||||||
|
|
||||||
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/nrf52840/ELECROW-ThinkNode-M4>
|
|
||||||
lib_deps =
|
|
||||||
${nrf52840_base.lib_deps}
|
|
||||||
lewisxhe/PCF8563_Library@^1.0.1
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
#include "RadioLib.h"
|
|
||||||
|
|
||||||
static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC};
|
|
||||||
|
|
||||||
static const Module::RfSwitchMode_t rfswitch_table[] = {
|
|
||||||
// mode DIO5 DIO6
|
|
||||||
{LR11x0::MODE_STBY, {LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW}},
|
|
||||||
{LR11x0::MODE_TX, {HIGH, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH}},
|
|
||||||
{LR11x0::MODE_TX_HF, {LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW}},
|
|
||||||
{LR11x0::MODE_WIFI, {LOW, LOW}}, END_OF_MODE_TABLE,
|
|
||||||
};
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
pinMode(LED_CHARGE, OUTPUT);
|
|
||||||
ledOff(LED_CHARGE);
|
|
||||||
|
|
||||||
pinMode(LED_PAIRING, OUTPUT);
|
|
||||||
ledOff(LED_PAIRING);
|
|
||||||
|
|
||||||
pinMode(Battery_LED_1, OUTPUT);
|
|
||||||
ledOff(Battery_LED_1);
|
|
||||||
pinMode(Battery_LED_2, OUTPUT);
|
|
||||||
ledOff(Battery_LED_2);
|
|
||||||
|
|
||||||
pinMode(Battery_LED_3, OUTPUT);
|
|
||||||
ledOff(Battery_LED_3);
|
|
||||||
|
|
||||||
pinMode(Battery_LED_4, OUTPUT);
|
|
||||||
ledOff(Battery_LED_4);
|
|
||||||
}
|
|
||||||
@@ -1,142 +0,0 @@
|
|||||||
/*
|
|
||||||
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_THINKNODE_M4_
|
|
||||||
#define _VARIANT_ELECROW_THINKNODE_M4_
|
|
||||||
|
|
||||||
/** Master clock frequency */
|
|
||||||
#define VARIANT_MCK (64000000ul)
|
|
||||||
|
|
||||||
#define USE_LFXO
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
|
||||||
* Headers
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "WVariant.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
#define PINS_COUNT (48)
|
|
||||||
#define NUM_DIGITAL_PINS (48)
|
|
||||||
#define NUM_ANALOG_INPUTS (1)
|
|
||||||
#define NUM_ANALOG_OUTPUTS (0)
|
|
||||||
|
|
||||||
// LEDs
|
|
||||||
#define LED_BUILTIN -1
|
|
||||||
#define LED_BLUE -1
|
|
||||||
#define LED_CHARGE (32 + 9)
|
|
||||||
#define LED_PAIRING (13)
|
|
||||||
|
|
||||||
#define Battery_LED_1 (15)
|
|
||||||
#define Battery_LED_2 (17)
|
|
||||||
#define Battery_LED_3 (32 + 2)
|
|
||||||
#define Battery_LED_4 (32 + 4)
|
|
||||||
|
|
||||||
#define LED_STATE_ON 1
|
|
||||||
|
|
||||||
// Button
|
|
||||||
#define PIN_BUTTON1 (4)
|
|
||||||
|
|
||||||
// Battery ADC
|
|
||||||
#define PIN_A0 (2)
|
|
||||||
#define BATTERY_PIN PIN_A0
|
|
||||||
#define BATTERY_SENSE_SAMPLES 30
|
|
||||||
#define ADC_RESOLUTION 14
|
|
||||||
#define BATTERY_SENSE_RESOLUTION_BITS 12
|
|
||||||
#define BATTERY_SENSE_RESOLUTION 4096.0
|
|
||||||
#define ADC_MULTIPLIER (2.00F)
|
|
||||||
#undef AREF_VOLTAGE
|
|
||||||
#define AREF_VOLTAGE 3.0
|
|
||||||
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
|
|
||||||
|
|
||||||
#define HAS_SERIAL_BATTERY_LEVEL 1
|
|
||||||
#define SERIAL_BATTERY_RX 30
|
|
||||||
#define SERIAL_BATTERY_TX 5
|
|
||||||
|
|
||||||
static const uint8_t A0 = PIN_A0;
|
|
||||||
|
|
||||||
#define PIN_NFC1 (9)
|
|
||||||
#define PIN_NFC2 (10)
|
|
||||||
|
|
||||||
// I2C
|
|
||||||
#define WIRE_INTERFACES_COUNT 1
|
|
||||||
#define PIN_WIRE_SDA (23)
|
|
||||||
#define PIN_WIRE_SCL (25)
|
|
||||||
|
|
||||||
// actually the LORA Radio
|
|
||||||
#define PIN_POWER_EN (11)
|
|
||||||
|
|
||||||
// charger status
|
|
||||||
#define EXT_CHRG_DETECT (32 + 6)
|
|
||||||
#define EXT_CHRG_DETECT_VALUE HIGH
|
|
||||||
|
|
||||||
// SPI
|
|
||||||
#define SPI_INTERFACES_COUNT 1
|
|
||||||
#define PIN_SPI_MISO (8)
|
|
||||||
#define PIN_SPI_MOSI (7)
|
|
||||||
#define PIN_SPI_SCK (6)
|
|
||||||
|
|
||||||
#define LORA_RESET (32 + 8)
|
|
||||||
#define LORA_DIO1 (12)
|
|
||||||
#define LORA_DIO2 (26)
|
|
||||||
#define LORA_SCK PIN_SPI_SCK
|
|
||||||
#define LORA_MISO PIN_SPI_MISO
|
|
||||||
#define LORA_MOSI PIN_SPI_MOSI
|
|
||||||
#define LORA_CS (27)
|
|
||||||
|
|
||||||
#define USE_LR1110
|
|
||||||
#define LR1110_IRQ_PIN LORA_DIO1
|
|
||||||
#define LR1110_NRESET_PIN LORA_RESET
|
|
||||||
#define LR1110_BUSY_PIN LORA_DIO2
|
|
||||||
#define LR1110_SPI_NSS_PIN LORA_CS
|
|
||||||
#define LR1110_SPI_SCK_PIN LORA_SCK
|
|
||||||
#define LR1110_SPI_MOSI_PIN LORA_MOSI
|
|
||||||
#define LR1110_SPI_MISO_PIN LORA_MISO
|
|
||||||
|
|
||||||
#define LR11X0_DIO3_TCXO_VOLTAGE 1.6
|
|
||||||
#define LR11X0_DIO_AS_RF_SWITCH
|
|
||||||
|
|
||||||
// Peripherals on I2C bus. Active Low
|
|
||||||
#define VEXT_ENABLE (32)
|
|
||||||
#define VEXT_ON_VALUE LOW
|
|
||||||
|
|
||||||
// GPS L76K
|
|
||||||
#define HAS_GPS 1
|
|
||||||
#define GPS_L76K
|
|
||||||
#define GPS_BAUDRATE 9600
|
|
||||||
#define PIN_GPS_EN (32 + 11)
|
|
||||||
#define GPS_EN_ACTIVE LOW
|
|
||||||
#define PIN_GPS_RESET (3)
|
|
||||||
#define GPS_RESET_MODE HIGH
|
|
||||||
#define PIN_GPS_STANDBY (28)
|
|
||||||
#define GPS_STANDBY_ACTIVE HIGH
|
|
||||||
#define GPS_TX_PIN (32 + 12)
|
|
||||||
#define GPS_RX_PIN (32 + 14)
|
|
||||||
#define GPS_THREAD_INTERVAL 50
|
|
||||||
|
|
||||||
#define PIN_SERIAL1_RX GPS_RX_PIN
|
|
||||||
#define PIN_SERIAL1_TX GPS_TX_PIN
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -116,13 +116,13 @@ No longer populated on PCB
|
|||||||
#define PIN_GPS_PPS (32 + 4)
|
#define PIN_GPS_PPS (32 + 4)
|
||||||
// Seems to be missing on this new board
|
// Seems to be missing on this new board
|
||||||
// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS
|
// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS
|
||||||
#define GPS_TX_PIN (32 + 7) // This is for bits going TOWARDS the CPU
|
#define GPS_TX_PIN (32 + 5) // This is for bits going TOWARDS the CPU
|
||||||
#define GPS_RX_PIN (32 + 5) // This is for bits going TOWARDS the GPS
|
#define GPS_RX_PIN (32 + 7) // This is for bits going TOWARDS the GPS
|
||||||
|
|
||||||
#define GPS_THREAD_INTERVAL 50
|
#define GPS_THREAD_INTERVAL 50
|
||||||
|
|
||||||
#define PIN_SERIAL1_RX GPS_RX_PIN
|
#define PIN_SERIAL1_RX GPS_TX_PIN
|
||||||
#define PIN_SERIAL1_TX GPS_TX_PIN
|
#define PIN_SERIAL1_TX GPS_RX_PIN
|
||||||
|
|
||||||
// PCF8563 RTC Module
|
// PCF8563 RTC Module
|
||||||
#define PCF8563_RTC 0x51
|
#define PCF8563_RTC 0x51
|
||||||
|
|||||||
@@ -167,13 +167,13 @@ No longer populated on PCB
|
|||||||
#define PIN_GPS_PPS (32 + 4)
|
#define PIN_GPS_PPS (32 + 4)
|
||||||
// Seems to be missing on this new board
|
// Seems to be missing on this new board
|
||||||
// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS
|
// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS
|
||||||
#define GPS_TX_PIN (32 + 7) // This is for bits going TOWARDS the CPU
|
#define GPS_TX_PIN (32 + 5) // This is for bits going TOWARDS the CPU
|
||||||
#define GPS_RX_PIN (32 + 5) // This is for bits going TOWARDS the GPS
|
#define GPS_RX_PIN (32 + 7) // This is for bits going TOWARDS the GPS
|
||||||
|
|
||||||
#define GPS_THREAD_INTERVAL 50
|
#define GPS_THREAD_INTERVAL 50
|
||||||
|
|
||||||
#define PIN_SERIAL1_RX GPS_RX_PIN
|
#define PIN_SERIAL1_RX GPS_TX_PIN
|
||||||
#define PIN_SERIAL1_TX GPS_TX_PIN
|
#define PIN_SERIAL1_TX GPS_RX_PIN
|
||||||
|
|
||||||
// PCF8563 RTC Module
|
// PCF8563 RTC Module
|
||||||
#define PCF8563_RTC 0x51
|
#define PCF8563_RTC 0x51
|
||||||
|
|||||||
@@ -116,13 +116,13 @@ No longer populated on PCB
|
|||||||
#define PIN_GPS_PPS (32 + 4)
|
#define PIN_GPS_PPS (32 + 4)
|
||||||
// Seems to be missing on this new board
|
// Seems to be missing on this new board
|
||||||
// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS
|
// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS
|
||||||
#define GPS_TX_PIN (32 + 7) // This is for bits going TOWARDS the CPU
|
#define GPS_TX_PIN (32 + 5) // This is for bits going TOWARDS the CPU
|
||||||
#define GPS_RX_PIN (32 + 5) // This is for bits going TOWARDS the GPS
|
#define GPS_RX_PIN (32 + 7) // This is for bits going TOWARDS the GPS
|
||||||
|
|
||||||
#define GPS_THREAD_INTERVAL 50
|
#define GPS_THREAD_INTERVAL 50
|
||||||
|
|
||||||
#define PIN_SERIAL1_RX GPS_RX_PIN
|
#define PIN_SERIAL1_RX GPS_TX_PIN
|
||||||
#define PIN_SERIAL1_TX GPS_TX_PIN
|
#define PIN_SERIAL1_TX GPS_RX_PIN
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SPI Interfaces
|
* SPI Interfaces
|
||||||
|
|||||||
@@ -103,12 +103,12 @@ extern "C" {
|
|||||||
#define LR11X0_DIO_AS_RF_SWITCH
|
#define LR11X0_DIO_AS_RF_SWITCH
|
||||||
|
|
||||||
// GPS
|
// GPS
|
||||||
#define GPS_RX_PIN (0 + 20) // P0.20
|
#define GPS_RX_PIN (0 + 19) // P0.19
|
||||||
#define GPS_TX_PIN (0 + 19) // P0.19
|
#define GPS_TX_PIN (0 + 20) // P0.20
|
||||||
#define GPS_EN_GPIO (32 + 1) // P1.01
|
#define GPS_EN_GPIO (32 + 1) // P1.01
|
||||||
|
|
||||||
#define PIN_SERIAL1_RX GPS_RX_PIN
|
#define PIN_SERIAL1_RX GPS_TX_PIN
|
||||||
#define PIN_SERIAL1_TX GPS_TX_PIN
|
#define PIN_SERIAL1_TX GPS_RX_PIN
|
||||||
|
|
||||||
#define PIN_BUZZER (0 + 22) // P0.22
|
#define PIN_BUZZER (0 + 22) // P0.22
|
||||||
|
|
||||||
|
|||||||
@@ -182,13 +182,13 @@ External serial flash WP25R1635FZUIL0
|
|||||||
#define PIN_GPS_STANDBY (32 + 2) // An output to wake GPS, low means allow sleep, high means force wake
|
#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
|
// Seems to be missing on this new board
|
||||||
// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS
|
// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS
|
||||||
#define GPS_TX_PIN (32 + 8) // This is for bits going TOWARDS the CPU
|
#define GPS_TX_PIN (32 + 9) // This is for bits going TOWARDS the CPU
|
||||||
#define GPS_RX_PIN (32 + 9) // This is for bits going TOWARDS the GPS
|
#define GPS_RX_PIN (32 + 8) // This is for bits going TOWARDS the GPS
|
||||||
|
|
||||||
#define GPS_THREAD_INTERVAL 50
|
#define GPS_THREAD_INTERVAL 50
|
||||||
|
|
||||||
#define PIN_SERIAL1_RX GPS_RX_PIN
|
#define PIN_SERIAL1_RX GPS_TX_PIN
|
||||||
#define PIN_SERIAL1_TX GPS_TX_PIN
|
#define PIN_SERIAL1_TX GPS_RX_PIN
|
||||||
|
|
||||||
// PCF8563 RTC Module
|
// PCF8563 RTC Module
|
||||||
#define PCF8563_RTC 0x51
|
#define PCF8563_RTC 0x51
|
||||||
|
|||||||
Reference in New Issue
Block a user