Last active
February 6, 2026 18:10
-
-
Save thomasabbott/eed20e8b4fdaac50c448aaf896803855 to your computer and use it in GitHub Desktop.
Comparison of PicoWboard.h and WaveshareBoard.h on June 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| #include <Arduino.h> | |
| #include <MeshCore.h> | |
| // LoRa radio module pins for Waveshare RP2040-LoRa-HF/LF | |
| // https://files.waveshare.com/wiki/RP2040-LoRa/Rp2040-lora-sch.pdf | |
| #define P_LORA_DIO_1 16 | |
| #define P_LORA_NSS 13 // CS | |
| #define P_LORA_RESET 23 | |
| #define P_LORA_BUSY 18 | |
| #define P_LORA_SCLK 14 | |
| #define P_LORA_MISO 24 | |
| #define P_LORA_MOSI 15 | |
| #define SX126X_DIO2_AS_RF_SWITCH true | |
| #define SX126X_DIO3_TCXO_VOLTAGE 0 | |
| // built-ins | |
| #define PIN_LED_BUILTIN 25 | |
| // This board has no built-in way to read battery voltage | |
| // #define PIN_VBAT_READ 26 | |
| // #define BATTERY_SAMPLES 8 | |
| // #define ADC_MULTIPLIER (3.1 * 3.3 * 1000) // MT Uses 3.1 | |
| class WaveshareBoard : public mesh::MainBoard { | |
| protected: | |
| uint8_t startup_reason; | |
| public: | |
| void begin(); | |
| uint8_t getStartupReason() const override { return startup_reason; } | |
| void onBeforeTransmit() override { | |
| digitalWrite(PIN_LED_BUILTIN, HIGH); // turn TX LED on | |
| } | |
| void onAfterTransmit() override { | |
| digitalWrite(PIN_LED_BUILTIN, LOW); // turn TX LED off | |
| } | |
| uint16_t getBattMilliVolts() override { | |
| #if defined(PIN_VBAT_READ) && defined(ADC_MULTIPLIER) | |
| analogReadResolution(12); | |
| uint32_t raw = 0; | |
| for (int i = 0; i < BATTERY_SAMPLES; i++) { | |
| raw += analogRead(PIN_VBAT_READ); | |
| } | |
| raw = raw / BATTERY_SAMPLES; | |
| return (ADC_MULTIPLIER * raw) / 4096; | |
| #else | |
| return 0; | |
| #endif | |
| } | |
| const char *getManufacturerName() const override { return "Waveshare RP2040-LoRa"; } | |
| void reboot() override { rp2040.reboot(); } | |
| bool startOTAUpdate(const char *id, char reply[]) override; | |
| }; | |
| // this is now the contents of waveshareboard.h pasted over the original picowboard.h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment