umsh_bsp_sensecap_solar/lib.rs
1#![no_std]
2
3//! Board support for the SenseCAP Solar Node P1 / P1-Pro (nRF52840 +
4//! SX1262).
5//!
6//! Composes [`umsh-bsp-nrf52840`](../umsh_bsp_nrf52840/index.html) with
7//! the Solar Node's pinout and on-board peripherals. This is the fourth
8//! `nRF52840 + SX1262`-class board, after the T-Echo, Wio Tracker L1,
9//! and T1000-E; the radio path is byte-for-byte the Wio Tracker L1
10//! configuration (external RXEN, DIO2-as-RF-switch, DIO3 TCXO at 1.8 V)
11//! on a different pin map. The [`Platform`](umsh_mac::Platform) bundle is
12//! therefore a verbatim copy of the Wio Tracker's.
13//!
14//! The same crate is intended to cover both the P1 and the P1-Pro, which
15//! are believed to differ only in GNSS module and battery pack.
16//!
17//! Initial scope is *bringup only*:
18//!
19//! - USB-CDC handles (over the nRF native USB peripheral, chip BSP)
20//! - two user LEDs and two buttons for identification (Phase 1)
21//! - calibrated battery measurement (Phase 2)
22//! - SX1262 LoRa radio + external RXEN pin (Phase 3)
23//!
24//! Future expansion (device-node behavior, low-battery
25//! System OFF + LPCOMP solar recovery, GNSS) is welcome but is not yet
26//! implemented.
27//!
28//! See `docs/hardware/sensecap-solar-node-p1-pro-hardware.md` for the
29//! firmware-derived hardware reference.
30//!
31//! # Pin map (nRF52840, from the Meshtastic `seeed_solar_node` variant)
32//!
33//! The BSP and firmware hard-code the `P0_xx` / `P1_xx` embassy-nrf pins
34//! directly; the Arduino logical numbers below appear only for
35//! cross-referencing the vendor sources.
36//!
37//! | Function | Logical | nRF pin | Notes |
38//! |------------------------------|--------:|--------------|-------|
39//! | GNSS standby/wake | 0 | `P0.02` | polarity unverified |
40//! | Radio DIO1 | 1 | `P0.03` | |
41//! | Radio RESET | 2 | `P0.28` | |
42//! | Radio BUSY | 3 | `P0.29` | |
43//! | Radio CS | 4 | `P0.04` | |
44//! | Radio RXEN | 5 | `P0.05` | drive LOW at boot, then `rf_switch_rx` |
45//! | GNSS UART TX (MCU→L76K) | 6 | `P1.11` | NMEA 9600 |
46//! | GNSS UART RX (L76K→MCU) | 7 | `P1.12` | |
47//! | Radio SPI SCK | 8 | `P1.13` | |
48//! | Radio SPI MISO | 9 | `P1.14` | |
49//! | Radio SPI MOSI | 10 | `P1.15` | |
50//! | LED_A ("User LED") | 11 | `P0.15` | **white, active-high** (confirmed 2026-07-23) |
51//! | LED_B ("Breathing"/TX LED) | 12 | `P0.19` | **blue, active-high** (confirmed); heartbeat LED |
52//! | PWR button (USER_BUTTON) | 13 | `P1.01` | active-low, internal pull-up (confirmed); hold → System OFF. A press from System OFF reaches the bootloader, not the application |
53//! | Grove SDA | 14 | `P0.09` | NFC pin — NFCT off / UICR NFCPINS cleared for GPIO |
54//! | Grove SCL | 15 | `P0.10` | NFC pin, ditto |
55//! | Battery ADC | 16 | `P0.31`/AIN7 | Phase 2 |
56//! | GNSS RESET (candidate) | 17 | `P1.03` | never driven — input only until characterized |
57//! | GNSS ENABLE | 18 | `P1.05` | likely active-high; held inactive in bringup |
58//! | Battery divider enable (n) | 19 | `P0.14` | active-low per MeshCore, verify (Phase 2) |
59//! | USR button (USER_BUTTON_2) | 20 | `P1.07` | active-low, pull-up (confirmed); soft — pressing it does NOT cut the MCU rail. The only button that powers the node on |
60//! | QSPI flash (P25Q16H) | 21–26 | see hw doc | reserved, unused (NV store is internal NVMC) |
61
62#[cfg(target_os = "none")]
63pub mod gnss;
64
65#[cfg(target_os = "none")]
66pub mod platform;
67
68#[cfg(target_os = "none")]
69pub mod power;
70
71#[cfg(target_os = "none")]
72pub mod shutdown;
73
74#[cfg(target_os = "none")]
75pub use platform::{SensecapSolarMac, SensecapSolarPlatform};
76#[cfg(target_os = "none")]
77pub use power::PowerSignaler;
78
79// TODO:
80// Phase 2: pub mod power — port the T1000-E battery monitor
81// (SAADC AIN7/P0.31, gated divider P0.14) with calibrated
82// slope/offset constants.
83// Phase 6: low-battery System OFF + LPCOMP solar-recovery wake.