Signed-off-by: 吴文峰 <kevin@lmve.net>

This commit is contained in:
2026-03-03 22:16:00 +08:00
parent 7ae6e9e999
commit 88d56e1e9e
1660 changed files with 281430 additions and 0 deletions
@@ -0,0 +1,77 @@
#pragma once
#define PINS_COUNT (25u)
#define NUM_DIGITAL_PINS (25u)
#define NUM_ANALOG_INPUTS (4u)
#define NUM_ANALOG_OUTPUTS (0u)
#define ADC_RESOLUTION (12u)
// LEDs
#define LED_POWER (24u)
// Serial
#define PIN_SERIAL1_TX (16u)
#define PIN_SERIAL1_RX (17u)
// SPI
#define PIN_SPI0_MISO (20u)
#define PIN_SPI0_MOSI (23u)
#define PIN_SPI0_SCK (22u)
#define PIN_SPI0_SS (21u)
// Connected to LoRa module
#define PIN_SPI1_MISO (12u)
#define PIN_SPI1_MOSI (11u)
#define PIN_SPI1_SCK (10u)
#define PIN_SPI1_SS (9u)
#define RFM95W_SS (9u)
#define RFM95W_DIO0 (14u)
#define RFM95W_DIO1 (15u)
#define RFM95W_DIO2 (18u)
#define RFM95W_RST (13u)
#define RFM95W_SPI SPI1
// Wire
#define PIN_WIRE0_SDA (0u)
#define PIN_WIRE0_SCL (1u)
// Not pinned out
#define PIN_WIRE1_SDA (31u)
#define PIN_WIRE1_SCL (31u)
#define PIN_SERIAL2_RX (31u)
#define PIN_SERIAL2_TX (31u)
#define SERIAL_HOWMANY (1u)
#define SPI_HOWMANY (2u)
#define WIRE_HOWMANY (1u)
static const uint8_t D0 = (16u);
static const uint8_t D1 = (17u);
static const uint8_t D2 = (20u);
static const uint8_t D3 = (23u);
static const uint8_t D4 = (22u);
static const uint8_t D5 = (2u);
static const uint8_t D6 = (3u);
static const uint8_t D7 = (0u);
static const uint8_t D8 = (1u);
static const uint8_t D9 = (4u);
static const uint8_t D10 = (5u);
static const uint8_t D11 = (6u);
static const uint8_t D12 = (7u);
static const uint8_t D13 = (8u);
static const uint8_t D14 = (13u);
static const uint8_t D15 = (14u);
static const uint8_t D16 = (15u);
static const uint8_t D17 = (18u);
static const uint8_t D18 = (24u);
static const uint8_t A0 = (26u);
static const uint8_t A1 = (27u);
static const uint8_t A2 = (28u);
static const uint8_t A3 = (29u);
static const uint8_t A4 = (19u);
static const uint8_t A5 = (21u);
#ifndef SS
#define SS PIN_SPI1_SS
#endif
@@ -0,0 +1,14 @@
[env:challenger_2040_lora]
extends = rp2040_base
board = challenger_2040_lora
board_level = extra
upload_protocol = picotool
# add our variants files to the include and src paths
build_flags =
${rp2040_base.build_flags}
-D PRIVATE_HW
-I variants/rp2040/challenger_2040_lora
-D DEBUG_RP2040_PORT=Serial
-D HW_SPI1_DEVICE
debug_build_flags = ${rp2040_base.build_flags}
debug_tool = cmsis-dap ; for e.g. Picotool
@@ -0,0 +1,37 @@
// Define SS for compatibility with libraries expecting a default SPI chip select pin
#define ARDUINO_ARCH_AVR
#define EXT_NOTIFY_OUT 0xFFFFFFFF
#define BUTTON_PIN 0xFFFFFFFF
#define USE_RF95 // RFM95/SX127x
#undef LORA_SCK
#undef LORA_MISO
#undef LORA_MOSI
#undef LORA_CS
// https://gitlab.com/invectorlabs/hw/challenger_rp2040_lora
#define LORA_SCK 10 // Clock
#define LORA_CS 9 // Chip Select
#define LORA_MOSI 11 // Serial Data Out
#define LORA_MISO 12 // Serial Data In
#define LORA_RESET 13 // Reset
#define LORA_DIO0 14 // DIO0
#define LORA_DIO1 15 // DIO1
#define LORA_DIO2 18 // DIO2
#define LORA_DIO3 0xFFFFFFFF // Not connected
#define LORA_DIO4 0xFFFFFFFF // Not connected
#define LORA_DIO5 0xFFFFFFFF // Not connected
#ifdef USE_SX1262
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
// #define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif
@@ -0,0 +1,13 @@
[env:catsniffer]
extends = rp2040_base
board = rpipico
board_level = extra
upload_protocol = picotool
build_flags =
${rp2040_base.build_flags}
-D RPI_PICO
-I variants/rp2040/ec_catsniffer
-D DEBUG_RP2040_PORT=Serial
; -D HW_SPI1_DEVICE
debug_build_flags = ${rp2040_base.build_flags}, -g
debug_tool = cmsis-dap
@@ -0,0 +1,39 @@
/*
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 "wiring_constants.h"
#include "wiring_digital.h"
#define CTF1 8
#define CTF2 9
#define CTF3 10
void initVariant()
{
// Config the LoRa Switch
pinMode(CTF1, OUTPUT);
pinMode(CTF2, OUTPUT);
pinMode(CTF3, OUTPUT);
digitalWrite(CTF1, HIGH);
digitalWrite(CTF2, LOW);
digitalWrite(CTF3, LOW);
}
@@ -0,0 +1,41 @@
// #define RADIOLIB_CUSTOM_ARDUINO 1
// #define RADIOLIB_TONE_UNSUPPORTED 1
// #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED 1
#define ARDUINO_ARCH_AVR
#define HAS_SCREEN 0
#define HAS_GPS 0
#undef GPS_RX_PIN
#undef GPS_TX_PIN
#define LED_POWER 27
#define USE_SX1262
#undef LORA_SCK
#undef LORA_MISO
#undef LORA_MOSI
#undef LORA_CS
#define LORA_SCK 18
#define LORA_MISO 16
#define LORA_MOSI 19
#define LORA_CS 17 // NSS
#define LORA_DIO0 5
#define LORA_RESET 24
#define LORA_DIO1 4
#define LORA_DIO2 23
#define LORA_DIO3 25
#define SX126X_RXEN 21
#define SX126X_TXEN 20
#ifdef USE_SX1262
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO0
#define SX126X_BUSY LORA_DIO1
#define SX126X_RESET LORA_RESET
// #define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 0
#endif
@@ -0,0 +1,14 @@
[env:feather_rp2040_rfm95]
extends = rp2040_base
board = adafruit_feather
board_level = extra
upload_protocol = picotool
# add our variants files to the include and src paths
build_flags =
${rp2040_base.build_flags}
-D RP2040_FEATHER_RFM95
-I variants/rp2040/feather_rp2040_rfm95
-D DEBUG_RP2040_PORT=Serial
-D HW_SPI1_DEVICE
debug_build_flags = ${rp2040_base.build_flags}
debug_tool = cmsis-dap ; for e.g. Picotool
@@ -0,0 +1,61 @@
// #define RADIOLIB_CUSTOM_ARDUINO 1
// #define RADIOLIB_TONE_UNSUPPORTED 1
// #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED 1
#define ARDUINO_ARCH_AVR
// #define USE_SSD1306
// #define USE_SH1106 1
// default I2C pins:
// SDA = 4
// SCL = 5
// Recommended pins for SerialModule:
// txd = 8
// rxd = 9
#define EXT_NOTIFY_OUT 22
#define BUTTON_PIN 7
// #define BUTTON_NEED_PULLUP
#define LED_POWER PIN_LED
// #define BATTERY_PIN 26
// ratio of voltage divider = 3.0 (R17=200k, R18=100k)
// #define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic
#define USE_RF95 // RFM95/SX127x
#undef LORA_SCK
#undef LORA_MISO
#undef LORA_MOSI
#undef LORA_CS
// https://www.adafruit.com/product/5714
// https://learn.adafruit.com/feather-rp2040-rfm95
// https://learn.adafruit.com/assets/120283
// https://learn.adafruit.com/assets/120813
#define LORA_SCK 14 // 10 12P
#define LORA_MISO 8 // 12 10P
#define LORA_MOSI 15 // 11 11P
#define LORA_CS 16 // 3 13P
#define LORA_RESET 17 // 15 14P
#define LORA_DIO0 21 // ?? 6P
#define LORA_DIO1 22 // 20 7P
#define LORA_DIO2 23 // 2 8P
#define LORA_DIO3 19 // ?? 3P
#define LORA_DIO4 20 // ?? 4P
#define LORA_DIO5 18 // ?? 15P
#ifdef USE_SX1262
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
// #define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif
@@ -0,0 +1,14 @@
[env:nibble-rp2040]
extends = rp2040_base
board = rpipico
board_level = extra
upload_protocol = picotool
# add our variants files to the include and src paths
build_flags =
${rp2040_base.build_flags}
-D PRIVATE_HW
-I variants/rp2040/nibble_rp2040
-D DEBUG_RP2040_PORT=Serial
-D HW_SPI1_DEVICE
debug_build_flags = ${rp2040_base.build_flags}, -g
debug_tool = cmsis-dap ; for e.g. Picotool
@@ -0,0 +1,18 @@
#define ARDUINO_ARCH_AVR
#define BUTTON_PIN -1 // Pin 17 used for antenna switching via DIO4
#define LED_POWER 1
#define HAS_CPU_SHUTDOWN 1
#define USE_RF95
#define LORA_SCK 10
#define LORA_MISO 12
#define LORA_MOSI 11
#define LORA_CS 13
#define LORA_DIO0 14
#define LORA_RESET 15
#define LORA_DIO1 RADIOLIB_NC
#define LORA_DIO2 RADIOLIB_NC
@@ -0,0 +1,66 @@
#pragma once
// Pin definitions taken from:
// https://datasheets.raspberrypi.org/pico/pico-datasheet.pdf
static const uint8_t WB_IO1 = 6; // SLOT_A SLOT_B
static const uint8_t WB_IO2 = 22; // SLOT_A SLOT_B
static const uint8_t WB_IO3 = 7; // SLOT_C
static const uint8_t WB_IO4 = 28; // SLOT_C
static const uint8_t WB_IO5 = 9; // SLOT_D
static const uint8_t WB_IO6 = 8; // SLOT_D
static const uint8_t WB_A0 = 26; // IO_SLOT
static const uint8_t WB_A1 = 27; // IO_SLOT
#define PIN_A0 (26u)
#define PIN_A1 (27u)
#define PIN_A2 (28u)
#define PIN_A3 (29u)
static const uint8_t A0 = PIN_A0;
static const uint8_t A1 = PIN_A1;
static const uint8_t A2 = PIN_A2;
static const uint8_t A3 = PIN_A3;
// LEDs
#define PIN_LED1 (23u)
#define LED_NOTIFICATION (24u)
#define ADC_RESOLUTION 12
// Serial
#define PIN_SERIAL1_TX (0ul)
#define PIN_SERIAL1_RX (1ul)
#define PIN_SERIAL2_TX (4ul)
#define PIN_SERIAL2_RX (5ul)
// SPI
#define PIN_SPI1_MISO (12u)
#define PIN_SPI1_MOSI (11u)
#define PIN_SPI1_SCK (10u)
#define PIN_SPI1_SS (13u)
#define PIN_SPI0_MISO (16u)
#define PIN_SPI0_MOSI (19u)
#define PIN_SPI0_SCK (18u)
#define PIN_SPI0_SS (17u)
// Wire
#define PIN_WIRE0_SDA (2u)
#define PIN_WIRE0_SCL (3u)
#define PIN_WIRE1_SDA (20u)
#define PIN_WIRE1_SCL (21u)
#define SERIAL_HOWMANY (3u)
#define SPI_HOWMANY (2u)
#define WIRE_HOWMANY (2u)
static const uint8_t SS = PIN_SPI0_SS;
static const uint8_t MOSI = PIN_SPI0_MOSI;
static const uint8_t MISO = PIN_SPI0_MISO;
static const uint8_t SCK = PIN_SPI0_SCK;
static const uint8_t SDA = PIN_WIRE0_SDA;
static const uint8_t SCL = PIN_WIRE0_SCL;
@@ -0,0 +1,33 @@
[env:rak11310]
custom_meshtastic_hw_model = 26
custom_meshtastic_hw_model_slug = RAK11310
custom_meshtastic_architecture = rp2040
custom_meshtastic_actively_supported = true
custom_meshtastic_support_level = 2
custom_meshtastic_display_name = RAK WisBlock 11310
custom_meshtastic_images = rak11310.svg
custom_meshtastic_tags = RAK
custom_meshtastic_requires_dfu = true
extends = rp2040_base
board = rakwireless_rak11300
board_level = pr
upload_protocol = picotool
# add our variants files to the include and src paths
build_flags =
${rp2040_base.build_flags}
-D RAK11310
-I variants/rp2040/rak11310
-D DEBUG_RP2040_PORT=Serial
-D RV3028_RTC=0x52
build_src_filter = ${rp2040_base.build_src_filter} +<../variants/rp2040/rak11310> +<mesh/eth/> +<mesh/api/> +<mqtt/>
lib_deps =
${rp2040_base.lib_deps}
${networking_base.lib_deps}
${networking_extra.lib_deps}
# renovate: datasource=custom.pio depName=Melopero RV3028 packageName=melopero/library/Melopero RV3028
melopero/Melopero RV3028@1.2.0
# renovate: datasource=github-tags depName=RAK13800-W5100S packageName=RAKWireless/RAK13800-W5100S
https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip
debug_build_flags = ${rp2040_base.build_flags}, -g
debug_tool = cmsis-dap ; for e.g. Picotool
@@ -0,0 +1,63 @@
// #define RADIOLIB_CUSTOM_ARDUINO 1
// #define RADIOLIB_TONE_UNSUPPORTED 1
// #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED 1
#define ARDUINO_ARCH_AVR
// Define I2C pins to ensure correct usage of both ports
#define I2C_SDA 20
#define I2C_SCL 21
#define I2C_SDA1 2
#define I2C_SCL1 3
#define LED_POWER PIN_LED1
#define ledOff(pin) pinMode(pin, INPUT)
#define BUTTON_PIN 9
#define BUTTON_NEED_PULLUP
// #define EXT_NOTIFY_OUT 4
#define BATTERY_PIN 26
#define BATTERY_SENSE_RESOLUTION_BITS ADC_RESOLUTION
// ratio of voltage divider = 3.0 (R17=200k, R18=100k)
#define ADC_MULTIPLIER 1.84
#define DETECTION_SENSOR_EN 28
#define USE_SX1262
#undef LORA_SCK
#undef LORA_MISO
#undef LORA_MOSI
#undef LORA_CS
// RAK BSP somehow uses SPI1 instead of SPI0
#define HW_SPI1_DEVICE
#define LORA_SCK (10u)
#define LORA_MOSI (11u)
#define LORA_MISO (12u)
#define LORA_CS (13u)
#define LORA_DIO0 RADIOLIB_NC
#define LORA_RESET 14
#define LORA_DIO1 29
#define LORA_DIO2 15
#define LORA_DIO3 RADIOLIB_NC
#ifdef USE_SX1262
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_POWER_EN 25
// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif
#define HAS_ETHERNET 1
#define PIN_ETHERNET_RESET 7 // IO3
#define PIN_ETHERNET_SS 17
#define ETH_SPI_PORT SPI
#define PIN_ETH_POWER_EN 22
@@ -0,0 +1,22 @@
[env:rp2040-lora]
custom_meshtastic_hw_model = 30
custom_meshtastic_hw_model_slug = RP2040_LORA
custom_meshtastic_architecture = rp2040
custom_meshtastic_actively_supported = true
custom_meshtastic_support_level = 2
custom_meshtastic_display_name = RP2040 LoRa
custom_meshtastic_tags = Waveshare
custom_meshtastic_requires_dfu = true
extends = rp2040_base
board = rpipico
upload_protocol = picotool
# add our variants files to the include and src paths
build_flags =
${rp2040_base.build_flags}
-D RP2040_LORA
-I variants/rp2040/rp2040-lora
-D DEBUG_RP2040_PORT=Serial
-D HW_SPI1_DEVICE
debug_build_flags = ${rp2040_base.build_flags}, -g
debug_tool = cmsis-dap ; for e.g. Picotool
@@ -0,0 +1,60 @@
// #define RADIOLIB_CUSTOM_ARDUINO 1
// #define RADIOLIB_TONE_UNSUPPORTED 1
// #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED 1
#define ARDUINO_ARCH_AVR
// #define USE_SH1106 1
// default I2C pins:
// SDA = 4
// SCL = 5
// Recommended pins for SerialModule:
// txd = 8
// rxd = 9
#define EXT_NOTIFY_OUT 22
#define BUTTON_PIN -1 // Pin 17 used for antenna switching via DIO4
#define LED_POWER PIN_LED
// #define BATTERY_PIN 26
// ratio of voltage divider = 3.0 (R17=200k, R18=100k)
// #define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic
#define HAS_CPU_SHUTDOWN 1
#define USE_SX1262
#undef LORA_SCK
#undef LORA_MISO
#undef LORA_MOSI
#undef LORA_CS
// https://www.waveshare.com/rp2040-lora.htm
// https://www.waveshare.com/img/devkit/RP2040-LoRa-HF/RP2040-LoRa-HF-details-11.jpg
#define LORA_SCK 14 // GPIO14
#define LORA_MISO 24 // GPIO24
#define LORA_MOSI 15 // GPIO15
#define LORA_CS 13 // GPIO13
#define LORA_DIO0 RADIOLIB_NC // No GPIO connection
#define LORA_RESET 23 // GPIO23
#define LORA_BUSY 18 // GPIO18
#define LORA_DIO1 16 // GPIO16
#define LORA_DIO2 RADIOLIB_NC // Antenna switching, no GPIO connection
#define LORA_DIO3 RADIOLIB_NC // No GPIO connection
#define LORA_DIO4 17 // GPIO17
// On rp2040-lora board the antenna switch is wired and works with complementary-pin control logic.
// See PE4259 datasheet page 4
#ifdef USE_SX1262
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_BUSY
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH // Antenna switch CTRL
#define SX126X_RXEN LORA_DIO4 // Antenna switch !CTRL via GPIO17
// #define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif
+35
View File
@@ -0,0 +1,35 @@
; Common settings for rp2040 Processor based targets
[rp2040_base]
platform =
# TODO renovate
https://github.com/maxgerhardt/platform-raspberrypi#cc24cfef37ed22ca9f2a6aead28c2deb76c39f24
; For arduino-pico >= 5.4.4
extends = arduino_base
platform_packages =
# TODO renovate
arduino-pico@https://github.com/earlephilhower/arduino-pico/releases/download/5.4.4/rp2040-5.4.4.zip
board_build.core = earlephilhower
board_build.filesystem_size = 0.5m
build_flags =
${arduino_base.build_flags} -Wno-unused-variable -Wcast-align
-Isrc/platform/rp2xx0
-Isrc/platform/rp2xx0/hardware_rosc/include
-Isrc/platform/rp2xx0/pico_sleep/include
-D__PLAT_RP2040__
-D__FREERTOS=1
# -D _POSIX_THREADS
build_src_filter =
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<modules/esp32> -<platform/nrf52/> -<platform/stm32wl> -<mesh/eth/> -<mesh/wifi/> -<mesh/http/> -<mesh/raspihttp>
lib_ignore =
BluetoothOTA
lvgl
lib_deps =
${arduino_base.lib_deps}
${environmental_base.lib_deps}
${environmental_extra.lib_deps}
${radiolib_base.lib_deps}
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
rweather/Crypto@0.4.0
@@ -0,0 +1,26 @@
[env:pico_slowclock]
extends = rp2040_base
board = rpipico
board_level = extra
upload_protocol = jlink
# debug settings for external openocd with RP2040 support (custom build)
debug_tool = custom
debug_init_cmds =
target extended-remote localhost:3333
$INIT_BREAK
monitor reset halt
$LOAD_CMDS
monitor init
monitor reset halt
# add our variants files to the include and src paths
build_flags =
${rp2040_base.build_flags}
-DRPI_PICO
-Ivariants/rp2040/rpipico-slowclock
-DDEBUG_RP2040_PORT=Serial2
-DHW_SPI1_DEVICE
-g
-DNO_USB
debug_build_flags = ${rp2040_base.build_flags}
-g
-DNO_USB
@@ -0,0 +1,87 @@
#define ARDUINO_ARCH_AVR
// Build with slow system clock enabled to reduce power consumption.
#define RP2040_SLOW_CLOCK
#ifdef RP2040_SLOW_CLOCK
// Redefine UART1 serial log output to avoid collision with UART0 for GPS.
#define SERIAL2_TX 4
#define SERIAL2_RX 5
// Reroute log output in SensorLib when USB is not available
#define log_e(...) Serial2.printf(__VA_ARGS__)
#define log_i(...) Serial2.printf(__VA_ARGS__)
#define log_d(...) Serial2.printf(__VA_ARGS__)
#endif
// Expecting the Waveshare Pico GPS hat
#define HAS_GPS 1
// Enable OLED Screen
#define HAS_SCREEN 1
#define USE_SH1106 1
#define RESET_OLED 13
// Redefine I2C0 pins to avoid collision with UART1/Serial2.
#define I2C_SDA 8
#define I2C_SCL 9
// Redefine Waveshare UPS-A/B I2C_1 pins:
#define I2C_SDA1 6
#define I2C_SCL1 7
// Waveshare UPS-A/B uses a 0.01 Ohm shunt for the INA219 sensor
#define INA219_MULTIPLIER 10.0f
// Waveshare Pico GPS L76B pins:
#define GPS_RX_PIN 1
#define GPS_TX_PIN 0
// Wakeup from backup mode
// #define PIN_GPS_FORCE_ON 14
// No GPS reset available
#undef PIN_GPS_RESET
/*
* For PPS output the resistor R20 needs to be populated with 0 Ohm
* on the Waveshare Pico GPS board.
*/
#define PIN_GPS_PPS 16
/*
* For standby mode switching the resistor R18 needs to be populated
* with 0 Ohm on the Waveshare Pico GPS board.
*/
#define PIN_GPS_STANDBY 17
#define BUTTON_PIN 18
#define EXT_NOTIFY_OUT 22
#define LED_POWER PIN_LED
#define BATTERY_PIN 26
// ratio of voltage divider = 3.0 (R17=200k, R18=100k)
#define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic
#define BATTERY_SENSE_RESOLUTION_BITS ADC_RESOLUTION
#define USE_SX1262
#undef LORA_SCK
#undef LORA_MISO
#undef LORA_MOSI
#undef LORA_CS
#define LORA_SCK 10
#define LORA_MISO 12
#define LORA_MOSI 11
#define LORA_CS 3
#define LORA_DIO0 RADIOLIB_NC
#define LORA_RESET 15
#define LORA_DIO1 20
#define LORA_DIO2 2
#define LORA_DIO3 RADIOLIB_NC
#ifdef USE_SX1262
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif
@@ -0,0 +1,24 @@
[env:pico]
custom_meshtastic_hw_model = 47
custom_meshtastic_hw_model_slug = RPI_PICO
custom_meshtastic_architecture = rp2040
custom_meshtastic_actively_supported = true
custom_meshtastic_support_level = 3
custom_meshtastic_display_name = Raspberry Pi Pico
custom_meshtastic_images = pico.svg
custom_meshtastic_tags = RPi, DIY
custom_meshtastic_requires_dfu = true
extends = rp2040_base
board = rpipico
board_level = pr
upload_protocol = picotool
# add our variants files to the include and src paths
build_flags =
${rp2040_base.build_flags}
-D RPI_PICO
-I variants/rp2040/rpipico
-D DEBUG_RP2040_PORT=Serial
-D HW_SPI1_DEVICE
debug_build_flags = ${rp2040_base.build_flags}, -g
debug_tool = cmsis-dap ; for e.g. Picotool
@@ -0,0 +1,50 @@
// #define RADIOLIB_CUSTOM_ARDUINO 1
// #define RADIOLIB_TONE_UNSUPPORTED 1
// #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED 1
#define ARDUINO_ARCH_AVR
// default I2C pins:
// SDA = 4
// SCL = 5
// Recommended pins for SerialModule:
// txd = 8
// rxd = 9
#define EXT_NOTIFY_OUT 22
#define BUTTON_PIN 17
#define LED_POWER PIN_LED
#define BATTERY_PIN 26
// ratio of voltage divider = 3.0 (R17=200k, R18=100k)
#define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic
#define BATTERY_SENSE_RESOLUTION_BITS ADC_RESOLUTION
#define USE_SX1262
#undef LORA_SCK
#undef LORA_MISO
#undef LORA_MOSI
#undef LORA_CS
#define LORA_SCK 10
#define LORA_MISO 12
#define LORA_MOSI 11
#define LORA_CS 3
#define LORA_DIO0 RADIOLIB_NC
#define LORA_RESET 15
#define LORA_DIO1 20
#define LORA_DIO2 2
#define LORA_DIO3 RADIOLIB_NC
#ifdef USE_SX1262
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif
@@ -0,0 +1,32 @@
[env:picow]
custom_meshtastic_hw_model = 47
custom_meshtastic_hw_model_slug = RPI_PICO
custom_meshtastic_architecture = rp2040
custom_meshtastic_actively_supported = true
custom_meshtastic_support_level = 3
custom_meshtastic_display_name = Raspberry Pi Pico W
custom_meshtastic_images = rpipicow.svg
custom_meshtastic_tags = RPi, DIY
custom_meshtastic_requires_dfu = true
extends = rp2040_base
board = rpipicow
board_level = pr
board_check = true
upload_protocol = picotool
# add our variants files to the include and src paths
build_flags =
${rp2040_base.build_flags}
-D RPI_PICO
-I variants/rp2040/rpipicow
-D HW_SPI1_DEVICE
-D HAS_UDP_MULTICAST=1
-fexceptions # for exception handling in MQTT
-ULED_BUILTIN
build_src_filter = ${rp2040_base.build_src_filter} +<mesh/wifi/>
lib_deps =
${rp2040_base.lib_deps}
${networking_base.lib_deps}
${networking_extra.lib_deps}
debug_build_flags = ${rp2040_base.build_flags}, -g
debug_tool = cmsis-dap ; for e.g. Picotool
@@ -0,0 +1,54 @@
// #define RADIOLIB_CUSTOM_ARDUINO 1
// #define RADIOLIB_TONE_UNSUPPORTED 1
// #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED 1
#define ARDUINO_ARCH_AVR
#ifndef HAS_WIFI
#define HAS_WIFI 1
#endif
// default I2C pins:
// SDA = 4
// SCL = 5
// Recommended pins for SerialModule:
// txd = 8
// rxd = 9
#define EXT_NOTIFY_OUT 22
#define BUTTON_PIN 17
#define LED_POWER PIN_LED
#define BATTERY_PIN 26
// ratio of voltage divider = 3.0 (R17=200k, R18=100k)
#define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic
#define BATTERY_SENSE_RESOLUTION_BITS ADC_RESOLUTION
#define USE_SX1262
#undef LORA_SCK
#undef LORA_MISO
#undef LORA_MOSI
#undef LORA_CS
#define LORA_SCK 10
#define LORA_MISO 12
#define LORA_MOSI 11
#define LORA_CS 3
#define LORA_DIO0 RADIOLIB_NC
#define LORA_RESET 15
#define LORA_DIO1 20
#define LORA_DIO2 2
#define LORA_DIO3 RADIOLIB_NC
#ifdef USE_SX1262
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#endif
@@ -0,0 +1,48 @@
#pragma once
#define PIN_A0 (26u)
#define PIN_A1 (27u)
#define PIN_A2 (28u)
#define PIN_A3 (29u)
static const uint8_t A0 = PIN_A0;
static const uint8_t A1 = PIN_A1;
static const uint8_t A2 = PIN_A2;
static const uint8_t A3 = PIN_A3;
// LEDs
#define PIN_LED1 (23u)
#define ADC_RESOLUTION 12
// Serial
#define PIN_SERIAL1_TX (0ul)
#define PIN_SERIAL1_RX (1ul)
#define PIN_SERIAL2_TX (4ul)
#define PIN_SERIAL2_RX (5ul)
// SPI
#define PIN_SPI0_MISO (16u)
#define PIN_SPI0_MOSI (19u)
#define PIN_SPI0_SCK (18u)
#define PIN_SPI0_SS (17u)
// Wire
#define PIN_WIRE0_SDA (6u)
#define PIN_WIRE0_SCL (7u)
#define PIN_WIRE1_SDA (-1)
#define PIN_WIRE1_SCL (-1)
#define SERIAL_HOWMANY (3u)
#define SPI_HOWMANY (2u)
#define WIRE_HOWMANY (1u)
static const uint8_t SS = PIN_SPI0_SS;
static const uint8_t MOSI = PIN_SPI0_MOSI;
static const uint8_t MISO = PIN_SPI0_MISO;
static const uint8_t SCK = PIN_SPI0_SCK;
static const uint8_t SDA = PIN_WIRE0_SDA;
static const uint8_t SCL = PIN_WIRE0_SCL;
@@ -0,0 +1,11 @@
[env:senselora_rp2040]
board_level = extra
extends = rp2040_base
board = rpipico
upload_protocol = picotool
# add our variants files to the include and src paths
build_flags = ${rp2040_base.build_flags}
-D SENSELORA_RP2040
-I variants/rp2040/senselora_rp2040
-D DEBUG_RP2040_PORT=Serial
@@ -0,0 +1,28 @@
#define ARDUINO_ARCH_AVR
#define USE_SSD1306
#define BUTTON_PIN 2
#define BUTTON_NEED_PULLUP
#define LED_POWER PIN_LED1
#define ledOff(pin) pinMode(pin, INPUT)
#undef BATTERY_PIN
#define BATTERY_SENSE_RESOLUTION_BITS ADC_RESOLUTION
#undef LORA_SCK
#undef LORA_MISO
#undef LORA_MOSI
#undef LORA_CS
#define USE_RF95
#define LORA_SCK PIN_SPI0_SCK
#define LORA_MISO PIN_SPI0_MISO
#define LORA_MOSI PIN_SPI0_MOSI
#define LORA_CS PIN_SPI0_SS
#define LORA_DIO0 21
#define LORA_DIO1 22
#define LORA_DIO2 RADIOLIB_NC
#define LORA_RESET 20