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//! - low-battery System OFF with LPCOMP solar recovery (Phase 6) — see
24//!   [`shutdown`]
25//!
26//! Future expansion (device-node behavior, GNSS) is welcome but is not yet
27//! implemented.
28//!
29//! See `docs/hardware/sensecap-solar-node-p1-pro-hardware.md` for the
30//! firmware-derived hardware reference.
31//!
32//! # Pin map (nRF52840, from the Meshtastic `seeed_solar_node` variant)
33//!
34//! The BSP and firmware hard-code the `P0_xx` / `P1_xx` embassy-nrf pins
35//! directly; the Arduino logical numbers below appear only for
36//! cross-referencing the vendor sources.
37//!
38//! | Function                     | Logical | nRF pin      | Notes |
39//! |------------------------------|--------:|--------------|-------|
40//! | GNSS standby/wake            | 0       | `P0.02`      | polarity unverified |
41//! | Radio DIO1                   | 1       | `P0.03`      | |
42//! | Radio RESET                  | 2       | `P0.28`      | |
43//! | Radio BUSY                   | 3       | `P0.29`      | |
44//! | Radio CS                     | 4       | `P0.04`      | |
45//! | Radio RXEN                   | 5       | `P0.05`      | drive LOW at boot, then `rf_switch_rx` |
46//! | GNSS UART TX (MCU→L76K)       | 6       | `P1.11`      | NMEA 9600 |
47//! | GNSS UART RX (L76K→MCU)       | 7       | `P1.12`      | |
48//! | Radio SPI SCK                | 8       | `P1.13`      | |
49//! | Radio SPI MISO               | 9       | `P1.14`      | |
50//! | Radio SPI MOSI               | 10      | `P1.15`      | |
51//! | LED_A ("User LED")           | 11      | `P0.15`      | **white, active-high** (confirmed 2026-07-23) |
52//! | LED_B ("Breathing"/TX LED)   | 12      | `P0.19`      | **blue, active-high** (confirmed); heartbeat LED |
53//! | 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 |
54//! | Grove SDA                    | 14      | `P0.09`      | NFC pin — NFCT off / UICR NFCPINS cleared for GPIO |
55//! | Grove SCL                    | 15      | `P0.10`      | NFC pin, ditto |
56//! | Battery ADC                  | 16      | `P0.31`/AIN7 | Phase 2 |
57//! | GNSS RESET (candidate)       | 17      | `P1.03`      | never driven — input only until characterized |
58//! | GNSS ENABLE                  | 18      | `P1.05`      | likely active-high; held inactive in bringup |
59//! | Battery divider enable (n)   | 19      | `P0.14`      | active-low per MeshCore, verify (Phase 2) |
60//! | 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 |
61//! | QSPI flash (P25Q16H)         | 21–26   | see hw doc   | reserved, unused (NV store is internal NVMC) |
62
63#[cfg(target_os = "none")]
64pub mod gnss;
65
66#[cfg(target_os = "none")]
67pub mod platform;
68
69#[cfg(target_os = "none")]
70pub mod power;
71
72#[cfg(target_os = "none")]
73pub mod shutdown;
74
75#[cfg(target_os = "none")]
76pub use platform::{SensecapSolarMac, SensecapSolarPlatform};
77#[cfg(target_os = "none")]
78pub use power::PowerSignaler;
79
80// TODO:
81//   Phase 2: pub mod power  — port the T1000-E battery monitor
82//            (SAADC AIN7/P0.31, gated divider P0.14) with calibrated
83//            slope/offset constants.