refactor: drop Heltec V3, enforce standard toolchain, remove dead code
Heltec V3 (ESP32-S3) requires the espup Xtensa toolchain fork, which violates the standard-toolchain-only principle. Removed until upstream Rust supports Xtensa targets via stock rustup. Also removes all #[allow(dead_code)] band-aids — unused items are deleted rather than suppressed. DESIGN.md updated with standard toolchain principle (#10) and peripheral model (input/telemetry slots).
This commit is contained in:
10 files changed
+36
-850
No files matched your search
@@ -1,70 +0,0 @@
|
||||
use esp_hal::gpio::{GpioPin, Input, Output, PullDown, PushPull};
|
||||
use esp_hal::peripherals::SPI2;
|
||||
use esp_hal::spi::master::Spi;
|
||||
use esp_hal::spi::SpiMode;
|
||||
use esp_hal::i2c::I2c;
|
||||
use esp_hal::peripherals::I2C0;
|
||||
use esp_hal::Delay;
|
||||
|
||||
use lora_phy::iv::GenericSx126xInterfaceVariant;
|
||||
use lora_phy::sx126x::{self, Sx1262, Sx126x};
|
||||
use lora_phy::LoRa;
|
||||
|
||||
/// Board name shown on the display dashboard.
|
||||
pub const BOARD_NAME: &str = "Heltec V3";
|
||||
|
||||
// ── Concrete peripheral types ────────────────────────────────────────
|
||||
|
||||
type Iv = GenericSx126xInterfaceVariant<Output<'static, GpioPin<8>>, Input<'static, GpioPin<14>>>;
|
||||
type RadioSpi = Spi<'static, SPI2>;
|
||||
type RadioDriver = Sx126x<RadioSpi, Iv, Sx1262>;
|
||||
|
||||
/// Fully-constructed LoRa radio driver.
|
||||
pub type Radio = LoRa<RadioDriver, Delay>;
|
||||
|
||||
/// USB driver for CDC-ACM.
|
||||
// TODO: define concrete USB OTG type once esp-hal USB support is wired up
|
||||
pub type UsbDriver = ();
|
||||
|
||||
/// I2C bus for the built-in SSD1306 OLED.
|
||||
pub type DisplayI2c = I2c<'static, I2C0>;
|
||||
|
||||
// ── Peripheral bundles ───────────────────────────────────────────────
|
||||
|
||||
pub struct RadioParts {
|
||||
pub radio: Radio,
|
||||
}
|
||||
|
||||
pub struct UsbParts {
|
||||
pub driver: UsbDriver,
|
||||
}
|
||||
|
||||
pub struct DisplayParts {
|
||||
pub i2c: DisplayI2c,
|
||||
}
|
||||
|
||||
// ── Board init ───────────────────────────────────────────────────────
|
||||
|
||||
pub struct Board {
|
||||
p: esp_hal::peripherals::Peripherals,
|
||||
}
|
||||
|
||||
impl Board {
|
||||
pub fn init() -> Self {
|
||||
let p = esp_hal::init(esp_hal::Config::default());
|
||||
Self { p }
|
||||
}
|
||||
|
||||
pub fn into_parts(self) -> (RadioParts, UsbParts, Option<DisplayParts>) {
|
||||
let _p = self.p;
|
||||
|
||||
// TODO: implement Heltec V3 peripheral init
|
||||
// - SPI2 for SX1262 (SCK=9, MOSI=10, MISO=11, NSS=8)
|
||||
// - GPIO for radio control (RST=12, DIO1=14, BUSY=13)
|
||||
// - Vext pin (GPIO21) LOW to power OLED
|
||||
// - I2C0 for SSD1306 (SDA=17, SCL=18)
|
||||
// - USB OTG for CDC-ACM
|
||||
|
||||
todo!("Heltec V3 peripheral init — requires espup toolchain to develop")
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,6 @@ bind_interrupts!(struct Irqs {
|
||||
SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 => embassy_nrf::twim::InterruptHandler<embassy_nrf::peripherals::TWISPI0>;
|
||||
});
|
||||
|
||||
/// Board name shown on the display dashboard.
|
||||
#[allow(dead_code)]
|
||||
pub const BOARD_NAME: &str = "RAK 4631";
|
||||
|
||||
// ── Concrete peripheral types ────────────────────────────────────────
|
||||
|
||||
type SpiBus = Spim<'static, embassy_nrf::peripherals::SPI3>;
|
||||
|
||||
+1
-11
@@ -1,4 +1,4 @@
|
||||
use crate::channel::{RadioState, RadioStatus};
|
||||
use crate::channel::RadioStatus;
|
||||
|
||||
/// Render the status dashboard to a framebuffer.
|
||||
///
|
||||
@@ -13,13 +13,3 @@ pub fn dashboard(status: &RadioStatus) {
|
||||
// Line 5: last RSSI / SNR
|
||||
let _ = status;
|
||||
}
|
||||
|
||||
/// Format radio state as a short display string.
|
||||
#[allow(dead_code)]
|
||||
pub fn state_label(state: RadioState) -> &'static str {
|
||||
match state {
|
||||
RadioState::Idle => "IDLE",
|
||||
RadioState::Receiving => "RX",
|
||||
RadioState::Transmitting => "TX",
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
/// Radio hardware errors.
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, defmt::Format)]
|
||||
pub enum RadioError {
|
||||
InitFailed,
|
||||
TxTimeout,
|
||||
InvalidConfig,
|
||||
}
|
||||
|
||||
/// USB protocol framing errors.
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, defmt::Format)]
|
||||
pub enum ProtocolError {
|
||||
DeserializeFailed,
|
||||
BufferOverflow,
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
mod board;
|
||||
mod channel;
|
||||
mod display;
|
||||
mod error;
|
||||
mod protocol;
|
||||
mod radio;
|
||||
mod usb;
|
||||
@@ -16,8 +15,6 @@ use crate::channel::{CommandChannel, ResponseChannel, StatusWatch};
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "rak_4631")] {
|
||||
use panic_probe as _;
|
||||
} else if #[cfg(feature = "heltec_v3")] {
|
||||
use esp_backtrace as _;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,6 @@ use serde::{Deserialize, Serialize};
|
||||
/// Maximum LoRa payload size in bytes.
|
||||
pub const MAX_PAYLOAD: usize = 256;
|
||||
|
||||
/// Protocol version for host compatibility checks.
|
||||
#[allow(dead_code)]
|
||||
pub const PROTOCOL_VERSION: u8 = 1;
|
||||
|
||||
/// LoRa signal bandwidth.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, defmt::Format)]
|
||||
#[repr(u8)]
|
||||
|
||||
Reference in new issue
Block a user