feat: upgrade all dependencies to latest versions
Major version bumps: - defmt 0.3 → 1.0 - esp-hal 0.22 → 1.0 (full API migration) - esp-hal-embassy 0.5 → esp-rtos 0.2 (replacement crate) - esp-backtrace 0.14 → 0.18 - esp-println 0.12 → 0.16 - embassy-nrf 0.2 → 0.10 - embassy-embedded-hal 0.2 → 0.6 - embassy-sync 0.6 → 0.8 - embassy-time 0.3 → 0.5 - embassy-usb 0.3 → 0.6 - embassy-usb-driver 0.1 → 0.2 - embedded-io-async 0.6 → 0.7 - heapless 0.8 → 0.9 - panic-probe 0.3 → 1.0 - minijinja 2.0 → 2.18 - owo-colors 4.0 → 4.3 embassy-executor stays at 0.9 (latest with Xtensa support via esp-rtos). Updated ESP toolchain from 1.82 to 1.93.
This commit is contained in:
7 files changed
+637
-573
No files matched your search
Generated
+558
-491
File diff suppressed because it is too large.
Load diff
+19
-21
@@ -17,16 +17,16 @@ categories = ["embedded", "hardware-support", "no-std"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
cfg-if = "1.0"
|
cfg-if = "1.0"
|
||||||
critical-section = "1.2"
|
critical-section = "1.2"
|
||||||
defmt = "0.3"
|
defmt = "1.0"
|
||||||
embedded-hal-async = "1.0"
|
embedded-hal-async = "1.0"
|
||||||
embassy-embedded-hal = "0.2"
|
embassy-embedded-hal = "0.6"
|
||||||
embassy-executor = { version = "0.6", features = ["task-arena-size-32768"] }
|
embassy-executor = "0.9"
|
||||||
embassy-sync = "0.6"
|
embassy-sync = "0.8"
|
||||||
embassy-time = "0.3"
|
embassy-time = "0.5"
|
||||||
embassy-usb = { version = "0.3", features = ["defmt"] }
|
embassy-usb = { version = "0.6", features = ["defmt"] }
|
||||||
embassy-usb-driver = "0.1"
|
embassy-usb-driver = "0.2"
|
||||||
ucobs = { path = "../ucobs" }
|
ucobs = { path = "../ucobs" }
|
||||||
heapless = "0.8"
|
heapless = "0.9"
|
||||||
lora-phy = "3.0"
|
lora-phy = "3.0"
|
||||||
static_cell = "2.1"
|
static_cell = "2.1"
|
||||||
|
|
||||||
@@ -36,38 +36,36 @@ embedded-graphics = "0.8"
|
|||||||
ssd1306 = { version = "0.10", features = ["async"] }
|
ssd1306 = { version = "0.10", features = ["async"] }
|
||||||
|
|
||||||
# Async IO traits and combinators
|
# Async IO traits and combinators
|
||||||
embedded-io-async = "0.6"
|
embedded-io-async = "0.7"
|
||||||
embassy-futures = "0.1"
|
embassy-futures = "0.1"
|
||||||
|
|
||||||
# ESP32-S3 (Heltec V3) — requires esp toolchain (espup)
|
# ESP32-S3 (Heltec V3) — requires esp toolchain (espup)
|
||||||
esp-backtrace = { version = "0.14", optional = true, features = ["esp32s3", "panic-handler", "exception-handler", "defmt"] }
|
esp-backtrace = { version = "0.18", optional = true, features = ["esp32s3", "panic-handler", "defmt"] }
|
||||||
esp-hal = { version = "0.22", optional = true, features = ["esp32s3"] }
|
esp-hal = { version = "1.0", optional = true, features = ["esp32s3", "unstable"] }
|
||||||
esp-hal-embassy = { version = "0.5", optional = true, features = ["esp32s3"] }
|
esp-println = { version = "0.16", optional = true, features = ["esp32s3", "defmt-espflash"] }
|
||||||
esp-println = { version = "0.12", optional = true, features = ["esp32s3", "defmt-espflash"] }
|
esp-rtos = { version = "0.2", optional = true, features = ["esp32s3", "embassy"] }
|
||||||
|
|
||||||
# nRF52840 (RAK 4631)
|
# nRF52840 (RAK 4631)
|
||||||
cortex-m-rt = { version = "0.7", optional = true }
|
cortex-m-rt = { version = "0.7", optional = true }
|
||||||
embassy-nrf = { version = "0.2", optional = true, features = ["nrf52840", "gpiote", "time-driver-rtc1", "defmt"] }
|
embassy-nrf = { version = "0.10", optional = true, features = ["nrf52840", "gpiote", "time-driver-rtc1", "defmt"] }
|
||||||
panic-probe = { version = "0.3", optional = true, features = ["print-defmt"] }
|
panic-probe = { version = "1.0", optional = true, features = ["print-defmt"] }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
minijinja = "2.0"
|
minijinja = "2.18"
|
||||||
owo-colors = "4.0"
|
owo-colors = "4.3"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
heltec_v3 = [
|
heltec_v3 = [
|
||||||
"dep:esp-backtrace",
|
"dep:esp-backtrace",
|
||||||
"dep:esp-hal",
|
"dep:esp-hal",
|
||||||
"dep:esp-hal-embassy",
|
|
||||||
"dep:esp-println",
|
"dep:esp-println",
|
||||||
"embassy-time/generic-queue-8",
|
"dep:esp-rtos",
|
||||||
]
|
]
|
||||||
heltec_v4 = [
|
heltec_v4 = [
|
||||||
"dep:esp-backtrace",
|
"dep:esp-backtrace",
|
||||||
"dep:esp-hal",
|
"dep:esp-hal",
|
||||||
"dep:esp-hal-embassy",
|
|
||||||
"dep:esp-println",
|
"dep:esp-println",
|
||||||
"embassy-time/generic-queue-8",
|
"dep:esp-rtos",
|
||||||
]
|
]
|
||||||
rak_wisblock_4631 = [
|
rak_wisblock_4631 = [
|
||||||
"dep:cortex-m-rt",
|
"dep:cortex-m-rt",
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ _require_esp_toolchain:
|
|||||||
echo "error: ESP toolchain not found" >&2; \
|
echo "error: ESP toolchain not found" >&2; \
|
||||||
echo " install:" >&2; \
|
echo " install:" >&2; \
|
||||||
echo " cargo install espup" >&2; \
|
echo " cargo install espup" >&2; \
|
||||||
echo " espup install --toolchain-version 1.82.0.3" >&2; \
|
echo " espup install" >&2; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+22
-23
@@ -2,12 +2,12 @@ use super::traits::LoRaBoard;
|
|||||||
use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice;
|
use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice;
|
||||||
use embassy_sync::blocking_mutex::raw::NoopRawMutex;
|
use embassy_sync::blocking_mutex::raw::NoopRawMutex;
|
||||||
use embassy_time::Delay;
|
use embassy_time::Delay;
|
||||||
use esp_hal::dma::{Dma, DmaPriority};
|
use esp_hal::dma::{DmaRxBuf, DmaTxBuf};
|
||||||
use esp_hal::gpio::{Input, Level, Output, Pull};
|
use esp_hal::gpio::{Input, InputConfig, Level, Output, OutputConfig, Pull};
|
||||||
use esp_hal::i2c::master::{Config as I2cConfig, I2c};
|
use esp_hal::i2c::master::{Config as I2cConfig, I2c};
|
||||||
use esp_hal::prelude::*;
|
|
||||||
use esp_hal::spi::master::{Config as SpiConfig, Spi, SpiDmaBus};
|
use esp_hal::spi::master::{Config as SpiConfig, Spi, SpiDmaBus};
|
||||||
use esp_hal::spi::SpiMode;
|
use esp_hal::spi::Mode as SpiMode;
|
||||||
|
use esp_hal::time::Rate;
|
||||||
use esp_hal::timer::timg::TimerGroup;
|
use esp_hal::timer::timg::TimerGroup;
|
||||||
use static_cell::StaticCell;
|
use static_cell::StaticCell;
|
||||||
|
|
||||||
@@ -67,32 +67,30 @@ impl Board {
|
|||||||
pub fn into_parts(self) -> (RadioParts, UsbParts, Option<DisplayParts>) {
|
pub fn into_parts(self) -> (RadioParts, UsbParts, Option<DisplayParts>) {
|
||||||
let p = self.p;
|
let p = self.p;
|
||||||
|
|
||||||
// ── Embassy time driver ────────────────────────────────────
|
// ── esp-rtos scheduler + embassy time driver ──────────────
|
||||||
let timg0 = TimerGroup::new(p.TIMG0);
|
let timg0 = TimerGroup::new(p.TIMG0);
|
||||||
esp_hal_embassy::init(timg0.timer0);
|
esp_rtos::start(timg0.timer0);
|
||||||
|
|
||||||
// ── Vext power: GPIO21, active LOW to enable OLED ──────────
|
// ── Vext power: GPIO21, active LOW to enable OLED ──────────
|
||||||
let vext = Output::new(p.GPIO21, Level::Low);
|
let vext = Output::new(p.GPIO21, Level::Low, OutputConfig::default());
|
||||||
core::mem::forget(vext); // hold pin low permanently; drop would reset it
|
core::mem::forget(vext); // hold pin low permanently; drop would reset it
|
||||||
|
|
||||||
// ── DMA for SPI ────────────────────────────────────────────
|
|
||||||
let dma = Dma::new(p.DMA);
|
|
||||||
let dma_ch = dma.channel0.configure(false, DmaPriority::Priority0);
|
|
||||||
|
|
||||||
// ── SPI + DMA for SX1262 ───────────────────────────────────
|
// ── SPI + DMA for SX1262 ───────────────────────────────────
|
||||||
let spi = Spi::new_with_config(p.SPI2, SpiConfig {
|
let spi = Spi::new(
|
||||||
frequency: 1u32.MHz(),
|
p.SPI2,
|
||||||
mode: SpiMode::Mode0,
|
SpiConfig::default()
|
||||||
..Default::default()
|
.with_frequency(Rate::from_mhz(1))
|
||||||
})
|
.with_mode(SpiMode::_0),
|
||||||
|
)
|
||||||
|
.expect("SPI init")
|
||||||
.with_sck(p.GPIO9)
|
.with_sck(p.GPIO9)
|
||||||
.with_mosi(p.GPIO10)
|
.with_mosi(p.GPIO10)
|
||||||
.with_miso(p.GPIO11)
|
.with_miso(p.GPIO11)
|
||||||
.with_dma(dma_ch);
|
.with_dma(p.DMA_CH0);
|
||||||
|
|
||||||
let (rx_buf, rx_desc, tx_buf, tx_desc) = esp_hal::dma_buffers!(256);
|
let (rx_buf, rx_desc, tx_buf, tx_desc) = esp_hal::dma_buffers!(256);
|
||||||
let dma_rx = esp_hal::dma::DmaRxBuf::new(rx_desc, rx_buf).expect("DMA RX buf");
|
let dma_rx = DmaRxBuf::new(rx_desc, rx_buf).expect("DMA RX buf");
|
||||||
let dma_tx = esp_hal::dma::DmaTxBuf::new(tx_desc, tx_buf).expect("DMA TX buf");
|
let dma_tx = DmaTxBuf::new(tx_desc, tx_buf).expect("DMA TX buf");
|
||||||
|
|
||||||
let spi = spi.with_buffers(dma_rx, dma_tx).into_async();
|
let spi = spi.with_buffers(dma_rx, dma_tx).into_async();
|
||||||
|
|
||||||
@@ -100,13 +98,13 @@ impl Board {
|
|||||||
StaticCell::new();
|
StaticCell::new();
|
||||||
let spi_bus = SPI_BUS.init(embassy_sync::mutex::Mutex::new(spi));
|
let spi_bus = SPI_BUS.init(embassy_sync::mutex::Mutex::new(spi));
|
||||||
|
|
||||||
let nss = Output::new(p.GPIO8, Level::High);
|
let nss = Output::new(p.GPIO8, Level::High, OutputConfig::default());
|
||||||
let spi_device = SpiDevice::new(spi_bus, nss);
|
let spi_device = SpiDevice::new(spi_bus, nss);
|
||||||
|
|
||||||
// ── SX1262 control pins ────────────────────────────────────
|
// ── SX1262 control pins ────────────────────────────────────
|
||||||
let reset = Output::new(p.GPIO12, Level::High);
|
let reset = Output::new(p.GPIO12, Level::High, OutputConfig::default());
|
||||||
let dio1 = Input::new(p.GPIO14, Pull::Down);
|
let dio1 = Input::new(p.GPIO14, InputConfig::default().with_pull(Pull::Down));
|
||||||
let busy = Input::new(p.GPIO13, Pull::Down);
|
let busy = Input::new(p.GPIO13, InputConfig::default().with_pull(Pull::Down));
|
||||||
|
|
||||||
let iv = GenericSx126xInterfaceVariant::new(reset, dio1, busy, None, None).expect("SX1262 interface init");
|
let iv = GenericSx126xInterfaceVariant::new(reset, dio1, busy, None, None).expect("SX1262 interface init");
|
||||||
|
|
||||||
@@ -136,6 +134,7 @@ impl Board {
|
|||||||
|
|
||||||
// ── Display (SSD1306 OLED on I2C, 0x3C) ───────────────────
|
// ── Display (SSD1306 OLED on I2C, 0x3C) ───────────────────
|
||||||
let i2c = I2c::new(p.I2C0, I2cConfig::default())
|
let i2c = I2c::new(p.I2C0, I2cConfig::default())
|
||||||
|
.expect("I2C init")
|
||||||
.with_sda(p.GPIO17)
|
.with_sda(p.GPIO17)
|
||||||
.with_scl(p.GPIO18)
|
.with_scl(p.GPIO18)
|
||||||
.into_async();
|
.into_async();
|
||||||
|
|||||||
+23
-24
@@ -1,12 +1,12 @@
|
|||||||
use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice;
|
use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice;
|
||||||
use embassy_sync::blocking_mutex::raw::NoopRawMutex;
|
use embassy_sync::blocking_mutex::raw::NoopRawMutex;
|
||||||
use embassy_time::Delay;
|
use embassy_time::Delay;
|
||||||
use esp_hal::dma::{Dma, DmaPriority};
|
use esp_hal::dma::{DmaRxBuf, DmaTxBuf};
|
||||||
use esp_hal::gpio::{Input, Level, Output, Pull};
|
use esp_hal::gpio::{Input, InputConfig, Level, Output, OutputConfig, Pull};
|
||||||
use esp_hal::i2c::master::{Config as I2cConfig, I2c};
|
use esp_hal::i2c::master::{Config as I2cConfig, I2c};
|
||||||
use esp_hal::prelude::*;
|
|
||||||
use esp_hal::spi::master::{Config as SpiConfig, Spi, SpiDmaBus};
|
use esp_hal::spi::master::{Config as SpiConfig, Spi, SpiDmaBus};
|
||||||
use esp_hal::spi::SpiMode;
|
use esp_hal::spi::Mode as SpiMode;
|
||||||
|
use esp_hal::time::Rate;
|
||||||
use esp_hal::timer::timg::TimerGroup;
|
use esp_hal::timer::timg::TimerGroup;
|
||||||
use static_cell::StaticCell;
|
use static_cell::StaticCell;
|
||||||
|
|
||||||
@@ -67,32 +67,30 @@ impl Board {
|
|||||||
pub fn into_parts(self) -> (RadioParts, UsbParts, Option<DisplayParts>) {
|
pub fn into_parts(self) -> (RadioParts, UsbParts, Option<DisplayParts>) {
|
||||||
let p = self.p;
|
let p = self.p;
|
||||||
|
|
||||||
// ── Embassy time driver ────────────────────────────────────
|
// ── esp-rtos scheduler + embassy time driver ──────────────
|
||||||
let timg0 = TimerGroup::new(p.TIMG0);
|
let timg0 = TimerGroup::new(p.TIMG0);
|
||||||
esp_hal_embassy::init(timg0.timer0);
|
esp_rtos::start(timg0.timer0);
|
||||||
|
|
||||||
// ── Vext power: GPIO36 ─────────────────────────────────────
|
// ── Vext power: GPIO36 ─────────────────────────────────────
|
||||||
let vext = Output::new(p.GPIO36, Level::Low);
|
let vext = Output::new(p.GPIO36, Level::Low, OutputConfig::default());
|
||||||
core::mem::forget(vext); // hold pin low permanently; drop would reset it
|
core::mem::forget(vext); // hold pin low permanently; drop would reset it
|
||||||
|
|
||||||
// ── DMA for SPI ────────────────────────────────────────────
|
|
||||||
let dma = Dma::new(p.DMA);
|
|
||||||
let dma_ch = dma.channel0.configure(false, DmaPriority::Priority0);
|
|
||||||
|
|
||||||
// ── SPI + DMA for SX1262 ───────────────────────────────────
|
// ── SPI + DMA for SX1262 ───────────────────────────────────
|
||||||
let spi = Spi::new_with_config(p.SPI2, SpiConfig {
|
let spi = Spi::new(
|
||||||
frequency: 1u32.MHz(),
|
p.SPI2,
|
||||||
mode: SpiMode::Mode0,
|
SpiConfig::default()
|
||||||
..Default::default()
|
.with_frequency(Rate::from_mhz(1))
|
||||||
})
|
.with_mode(SpiMode::_0),
|
||||||
|
)
|
||||||
|
.expect("SPI init")
|
||||||
.with_sck(p.GPIO9)
|
.with_sck(p.GPIO9)
|
||||||
.with_mosi(p.GPIO10)
|
.with_mosi(p.GPIO10)
|
||||||
.with_miso(p.GPIO11)
|
.with_miso(p.GPIO11)
|
||||||
.with_dma(dma_ch);
|
.with_dma(p.DMA_CH0);
|
||||||
|
|
||||||
let (rx_buf, rx_desc, tx_buf, tx_desc) = esp_hal::dma_buffers!(256);
|
let (rx_buf, rx_desc, tx_buf, tx_desc) = esp_hal::dma_buffers!(256);
|
||||||
let dma_rx = esp_hal::dma::DmaRxBuf::new(rx_desc, rx_buf).expect("DMA RX buf");
|
let dma_rx = DmaRxBuf::new(rx_desc, rx_buf).expect("DMA RX buf");
|
||||||
let dma_tx = esp_hal::dma::DmaTxBuf::new(tx_desc, tx_buf).expect("DMA TX buf");
|
let dma_tx = DmaTxBuf::new(tx_desc, tx_buf).expect("DMA TX buf");
|
||||||
|
|
||||||
let spi = spi.with_buffers(dma_rx, dma_tx).into_async();
|
let spi = spi.with_buffers(dma_rx, dma_tx).into_async();
|
||||||
|
|
||||||
@@ -100,13 +98,13 @@ impl Board {
|
|||||||
StaticCell::new();
|
StaticCell::new();
|
||||||
let spi_bus = SPI_BUS.init(embassy_sync::mutex::Mutex::new(spi));
|
let spi_bus = SPI_BUS.init(embassy_sync::mutex::Mutex::new(spi));
|
||||||
|
|
||||||
let nss = Output::new(p.GPIO8, Level::High);
|
let nss = Output::new(p.GPIO8, Level::High, OutputConfig::default());
|
||||||
let spi_device = SpiDevice::new(spi_bus, nss);
|
let spi_device = SpiDevice::new(spi_bus, nss);
|
||||||
|
|
||||||
// ── SX1262 control pins ────────────────────────────────────
|
// ── SX1262 control pins ────────────────────────────────────
|
||||||
let reset = Output::new(p.GPIO12, Level::High);
|
let reset = Output::new(p.GPIO12, Level::High, OutputConfig::default());
|
||||||
let dio1 = Input::new(p.GPIO14, Pull::Down);
|
let dio1 = Input::new(p.GPIO14, InputConfig::default().with_pull(Pull::Down));
|
||||||
let busy = Input::new(p.GPIO13, Pull::Down);
|
let busy = Input::new(p.GPIO13, InputConfig::default().with_pull(Pull::Down));
|
||||||
|
|
||||||
let iv = GenericSx126xInterfaceVariant::new(reset, dio1, busy, None, None)
|
let iv = GenericSx126xInterfaceVariant::new(reset, dio1, busy, None, None)
|
||||||
.expect("SX1262 interface init");
|
.expect("SX1262 interface init");
|
||||||
@@ -138,13 +136,14 @@ impl Board {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ── Display (SSD1315 OLED on I2C, 0x3C) ───────────────────
|
// ── Display (SSD1315 OLED on I2C, 0x3C) ───────────────────
|
||||||
let mut display_rst = Output::new(p.GPIO21, Level::Low);
|
let mut display_rst = Output::new(p.GPIO21, Level::Low, OutputConfig::default());
|
||||||
esp_hal::delay::Delay::new().delay_millis(10);
|
esp_hal::delay::Delay::new().delay_millis(10);
|
||||||
display_rst.set_high();
|
display_rst.set_high();
|
||||||
esp_hal::delay::Delay::new().delay_millis(10);
|
esp_hal::delay::Delay::new().delay_millis(10);
|
||||||
core::mem::forget(display_rst); // hold reset high permanently
|
core::mem::forget(display_rst); // hold reset high permanently
|
||||||
|
|
||||||
let i2c = I2c::new(p.I2C0, I2cConfig::default())
|
let i2c = I2c::new(p.I2C0, I2cConfig::default())
|
||||||
|
.expect("I2C init")
|
||||||
.with_sda(p.GPIO17)
|
.with_sda(p.GPIO17)
|
||||||
.with_scl(p.GPIO18)
|
.with_scl(p.GPIO18)
|
||||||
.into_async();
|
.into_async();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice;
|
use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice;
|
||||||
use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pull};
|
use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull};
|
||||||
use embassy_nrf::peripherals::USBD;
|
|
||||||
use embassy_nrf::spim::{self, Spim};
|
use embassy_nrf::spim::{self, Spim};
|
||||||
use embassy_nrf::twim::{self, Twim};
|
use embassy_nrf::twim::{self, Twim};
|
||||||
use embassy_nrf::usb::Driver;
|
use embassy_nrf::usb::Driver;
|
||||||
@@ -15,14 +14,14 @@ use lora_phy::sx126x::{self, Sx1262, Sx126x};
|
|||||||
use super::traits::LoRaBoard;
|
use super::traits::LoRaBoard;
|
||||||
|
|
||||||
bind_interrupts!(struct Irqs {
|
bind_interrupts!(struct Irqs {
|
||||||
USBD => embassy_nrf::usb::InterruptHandler<USBD>;
|
USBD => embassy_nrf::usb::InterruptHandler<embassy_nrf::peripherals::USBD>;
|
||||||
SPIM3 => embassy_nrf::spim::InterruptHandler<embassy_nrf::peripherals::SPI3>;
|
SPIM3 => embassy_nrf::spim::InterruptHandler<embassy_nrf::peripherals::SPI3>;
|
||||||
SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 => embassy_nrf::twim::InterruptHandler<embassy_nrf::peripherals::TWISPI0>;
|
TWISPI0 => embassy_nrf::twim::InterruptHandler<embassy_nrf::peripherals::TWISPI0>;
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Concrete peripheral types ────────────────────────────────────────
|
// ── Concrete peripheral types ────────────────────────────────────────
|
||||||
|
|
||||||
type SpiBus = Spim<'static, embassy_nrf::peripherals::SPI3>;
|
type SpiBus = Spim<'static>;
|
||||||
type Nss = Output<'static>;
|
type Nss = Output<'static>;
|
||||||
type Iv = GenericSx126xInterfaceVariant<Output<'static>, Input<'static>>;
|
type Iv = GenericSx126xInterfaceVariant<Output<'static>, Input<'static>>;
|
||||||
type RadioSpiDevice = SpiDevice<'static, NoopRawMutex, SpiBus, Nss>;
|
type RadioSpiDevice = SpiDevice<'static, NoopRawMutex, SpiBus, Nss>;
|
||||||
@@ -30,10 +29,10 @@ type RadioSpiDevice = SpiDevice<'static, NoopRawMutex, SpiBus, Nss>;
|
|||||||
pub type RadioDriver = Sx126x<RadioSpiDevice, Iv, Sx1262>;
|
pub type RadioDriver = Sx126x<RadioSpiDevice, Iv, Sx1262>;
|
||||||
|
|
||||||
/// USB driver for CDC-ACM.
|
/// USB driver for CDC-ACM.
|
||||||
pub type UsbDriver = Driver<'static, USBD, &'static embassy_nrf::usb::vbus_detect::SoftwareVbusDetect>;
|
pub type UsbDriver = Driver<'static, &'static embassy_nrf::usb::vbus_detect::SoftwareVbusDetect>;
|
||||||
|
|
||||||
/// I2C bus for an optional SSD1306 OLED.
|
/// I2C bus for an optional SSD1306 OLED.
|
||||||
pub type DisplayI2c = Twim<'static, embassy_nrf::peripherals::TWISPI0>;
|
pub type DisplayI2c = Twim<'static>;
|
||||||
|
|
||||||
// ── Peripheral bundles ───────────────────────────────────────────────
|
// ── Peripheral bundles ───────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -97,13 +96,13 @@ impl Board {
|
|||||||
StaticCell::new();
|
StaticCell::new();
|
||||||
let spi_bus = SPI_BUS.init(embassy_sync::mutex::Mutex::new(spi));
|
let spi_bus = SPI_BUS.init(embassy_sync::mutex::Mutex::new(spi));
|
||||||
|
|
||||||
let nss = Output::new(AnyPin::from(p.P1_10), Level::High, OutputDrive::Standard);
|
let nss = Output::new(p.P1_10, Level::High, OutputDrive::Standard);
|
||||||
let spi_device = SpiDevice::new(spi_bus, nss);
|
let spi_device = SpiDevice::new(spi_bus, nss);
|
||||||
|
|
||||||
// ── SX1262 control pins ──────────────────────────────────
|
// ── SX1262 control pins ──────────────────────────────────
|
||||||
let reset = Output::new(AnyPin::from(p.P1_06), Level::High, OutputDrive::Standard);
|
let reset = Output::new(p.P1_06, Level::High, OutputDrive::Standard);
|
||||||
let dio1 = Input::new(AnyPin::from(p.P1_15), Pull::Down);
|
let dio1 = Input::new(p.P1_15, Pull::Down);
|
||||||
let busy = Input::new(AnyPin::from(p.P1_14), Pull::Down);
|
let busy = Input::new(p.P1_14, Pull::Down);
|
||||||
|
|
||||||
let iv = GenericSx126xInterfaceVariant::new(reset, dio1, busy, None, None).expect("SX1262 interface init");
|
let iv = GenericSx126xInterfaceVariant::new(reset, dio1, busy, None, None).expect("SX1262 interface init");
|
||||||
|
|
||||||
@@ -130,8 +129,10 @@ impl Board {
|
|||||||
// ── Display (optional RAK1921 SSD1306 OLED on I2C) ──────
|
// ── Display (optional RAK1921 SSD1306 OLED on I2C) ──────
|
||||||
// Always provide the I2C bus; display_task detects presence
|
// Always provide the I2C bus; display_task detects presence
|
||||||
// via SSD1306 init (fails gracefully if no display attached).
|
// via SSD1306 init (fails gracefully if no display attached).
|
||||||
|
static TWIM_BUF: StaticCell<[u8; 256]> = StaticCell::new();
|
||||||
|
let twim_buf = TWIM_BUF.init([0u8; 256]);
|
||||||
let i2c_cfg = twim::Config::default();
|
let i2c_cfg = twim::Config::default();
|
||||||
let i2c = Twim::new(p.TWISPI0, Irqs, p.P0_13, p.P0_14, i2c_cfg);
|
let i2c = Twim::new(p.TWISPI0, Irqs, p.P0_13, p.P0_14, i2c_cfg, twim_buf);
|
||||||
let mac = Self::mac_address();
|
let mac = Self::mac_address();
|
||||||
let display = Some(DisplayParts { i2c, mac });
|
let display = Some(DisplayParts { i2c, mac });
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -48,7 +48,7 @@ cfg_if::cfg_if! {
|
|||||||
run(spawner).await;
|
run(spawner).await;
|
||||||
}
|
}
|
||||||
} else if #[cfg(any(feature = "heltec_v3", feature = "heltec_v4"))] {
|
} else if #[cfg(any(feature = "heltec_v3", feature = "heltec_v4"))] {
|
||||||
#[esp_hal_embassy::main]
|
#[esp_rtos::main]
|
||||||
async fn main(spawner: Spawner) {
|
async fn main(spawner: Spawner) {
|
||||||
run(spawner).await;
|
run(spawner).await;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user