Replace the radio module with peripheral singleton structs (#852)
* Replace the `radio` module with peripheral singleton structs * Update `CHANGELOG.md`
This commit is contained in:
parent
d41e306504
commit
62a174fd06
@ -66,6 +66,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- The `spi` and `spi_slave` modules have been refactored into the `spi`, `spi::master`, and `spi::slave` modules (#843)
|
- The `spi` and `spi_slave` modules have been refactored into the `spi`, `spi::master`, and `spi::slave` modules (#843)
|
||||||
- The `WithDmaSpi2`/`WithDmaSpi3` structs are no longer generic around the inner peripheral type (#853)
|
- The `WithDmaSpi2`/`WithDmaSpi3` structs are no longer generic around the inner peripheral type (#853)
|
||||||
- The `SarAdcExt`/`SensExt` traits are now collectively named `AnalogExt` instead (#857)
|
- The `SarAdcExt`/`SensExt` traits are now collectively named `AnalogExt` instead (#857)
|
||||||
|
- Replace the `radio` module with peripheral singleton structs (#852)
|
||||||
|
|
||||||
## [0.12.0]
|
## [0.12.0]
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,6 @@ symbols = [
|
|||||||
"adc",
|
"adc",
|
||||||
"dac",
|
"dac",
|
||||||
"pdma",
|
"pdma",
|
||||||
"radio",
|
|
||||||
"phy",
|
"phy",
|
||||||
"bt",
|
"bt",
|
||||||
"wifi",
|
"wifi",
|
||||||
|
|||||||
@ -36,7 +36,6 @@ symbols = [
|
|||||||
"adc",
|
"adc",
|
||||||
"assist_debug_sp_monitor",
|
"assist_debug_sp_monitor",
|
||||||
"gdma",
|
"gdma",
|
||||||
"radio",
|
|
||||||
"phy",
|
"phy",
|
||||||
"bt",
|
"bt",
|
||||||
"wifi",
|
"wifi",
|
||||||
|
|||||||
@ -48,7 +48,6 @@ symbols = [
|
|||||||
"assist_debug_sp_monitor",
|
"assist_debug_sp_monitor",
|
||||||
"assist_debug_region_monitor",
|
"assist_debug_region_monitor",
|
||||||
"gdma",
|
"gdma",
|
||||||
"radio",
|
|
||||||
"phy",
|
"phy",
|
||||||
"bt",
|
"bt",
|
||||||
"wifi",
|
"wifi",
|
||||||
|
|||||||
@ -76,7 +76,6 @@ symbols = [
|
|||||||
"gdma",
|
"gdma",
|
||||||
"large_intr_status",
|
"large_intr_status",
|
||||||
"plic",
|
"plic",
|
||||||
"radio",
|
|
||||||
"phy",
|
"phy",
|
||||||
"bt",
|
"bt",
|
||||||
"wifi",
|
"wifi",
|
||||||
|
|||||||
@ -67,7 +67,6 @@ symbols = [
|
|||||||
"assist_debug_region_monitor",
|
"assist_debug_region_monitor",
|
||||||
"gdma",
|
"gdma",
|
||||||
"plic",
|
"plic",
|
||||||
"radio",
|
|
||||||
"phy",
|
"phy",
|
||||||
"bt",
|
"bt",
|
||||||
"ieee802154",
|
"ieee802154",
|
||||||
|
|||||||
@ -52,7 +52,6 @@ symbols = [
|
|||||||
"adc",
|
"adc",
|
||||||
"dac",
|
"dac",
|
||||||
"pdma",
|
"pdma",
|
||||||
"radio",
|
|
||||||
"phy",
|
"phy",
|
||||||
"wifi",
|
"wifi",
|
||||||
"psram",
|
"psram",
|
||||||
|
|||||||
@ -63,7 +63,6 @@ symbols = [
|
|||||||
"adc",
|
"adc",
|
||||||
"assist_debug_region_monitor",
|
"assist_debug_region_monitor",
|
||||||
"gdma",
|
"gdma",
|
||||||
"radio",
|
|
||||||
"phy",
|
"phy",
|
||||||
"bt",
|
"bt",
|
||||||
"wifi",
|
"wifi",
|
||||||
|
|||||||
@ -118,8 +118,6 @@ pub mod parl_io;
|
|||||||
pub mod pcnt;
|
pub mod pcnt;
|
||||||
pub mod peripheral;
|
pub mod peripheral;
|
||||||
pub mod prelude;
|
pub mod prelude;
|
||||||
#[cfg(radio)]
|
|
||||||
pub mod radio;
|
|
||||||
#[cfg(any(hmac, sha))]
|
#[cfg(any(hmac, sha))]
|
||||||
mod reg_access;
|
mod reg_access;
|
||||||
pub mod reset;
|
pub mod reset;
|
||||||
|
|||||||
@ -58,8 +58,6 @@ pub use crate::ledc::{
|
|||||||
},
|
},
|
||||||
timer::{TimerHW as _esp_hal_ledc_timer_TimerHW, TimerIFace as _esp_hal_ledc_timer_TimerIFace},
|
timer::{TimerHW as _esp_hal_ledc_timer_TimerHW, TimerIFace as _esp_hal_ledc_timer_TimerIFace},
|
||||||
};
|
};
|
||||||
#[cfg(radio)]
|
|
||||||
pub use crate::radio::RadioExt as _esp_hal_RadioExt;
|
|
||||||
#[cfg(spi3)]
|
#[cfg(spi3)]
|
||||||
pub use crate::spi::master::dma::WithDmaSpi3 as _esp_hal_spi_dma_WithDmaSpi3;
|
pub use crate::spi::master::dma::WithDmaSpi3 as _esp_hal_spi_dma_WithDmaSpi3;
|
||||||
#[cfg(any(spi0, spi1, spi2, spi3))]
|
#[cfg(any(spi0, spi1, spi2, spi3))]
|
||||||
|
|||||||
@ -1,127 +0,0 @@
|
|||||||
//! # Wireless communication peripheral implementations
|
|
||||||
//!
|
|
||||||
//! ## Overview
|
|
||||||
//! The radio module provides implementations for different wireless
|
|
||||||
//! communication peripherals, including WiFi, Bluetooth and
|
|
||||||
//! IEEE 802.15.4 Low Rate wireless personal area radio.
|
|
||||||
//!
|
|
||||||
//! In addition to the structures defined in this module, the module also
|
|
||||||
//! defines the `RadioExt` trait, which provides a `split` method. This method
|
|
||||||
//! allows splitting the general `Radio` peripheral into its individual
|
|
||||||
//! components.
|
|
||||||
//!
|
|
||||||
//! Additionally, the module includes implementation blocks for each wireless
|
|
||||||
//! communication peripheral, providing necessary functions and traits for each
|
|
||||||
//! peripheral.
|
|
||||||
pub trait RadioExt {
|
|
||||||
type Components;
|
|
||||||
|
|
||||||
fn split(self) -> Self::Components;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// WiFi radio
|
|
||||||
pub struct Wifi {
|
|
||||||
_private: (),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Bluetooth radio
|
|
||||||
pub struct Bluetooth {
|
|
||||||
_private: (),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// IEEE 802.15.4 Low rate wireless personal area radio
|
|
||||||
pub struct LowRate {
|
|
||||||
_private: (),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Wifi {
|
|
||||||
pub const unsafe fn steal() -> Self {
|
|
||||||
Self { _private: () }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl crate::peripheral::Peripheral for Wifi {
|
|
||||||
type P = Self;
|
|
||||||
|
|
||||||
unsafe fn clone_unchecked(&mut self) -> Self::P {
|
|
||||||
Self::steal()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl crate::peripheral::sealed::Sealed for Wifi {}
|
|
||||||
|
|
||||||
impl Bluetooth {
|
|
||||||
pub const unsafe fn steal() -> Self {
|
|
||||||
Self { _private: () }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl crate::peripheral::Peripheral for Bluetooth {
|
|
||||||
type P = Self;
|
|
||||||
|
|
||||||
unsafe fn clone_unchecked(&mut self) -> Self::P {
|
|
||||||
Self::steal()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl crate::peripheral::sealed::Sealed for Bluetooth {}
|
|
||||||
|
|
||||||
impl LowRate {
|
|
||||||
pub const unsafe fn steal() -> Self {
|
|
||||||
Self { _private: () }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl crate::peripheral::Peripheral for LowRate {
|
|
||||||
type P = Self;
|
|
||||||
|
|
||||||
unsafe fn clone_unchecked(&mut self) -> Self::P {
|
|
||||||
Self::steal()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl crate::peripheral::sealed::Sealed for LowRate {}
|
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
|
||||||
if #[cfg(all(bt, ieee802154, wifi))] {
|
|
||||||
impl RadioExt for crate::peripherals::RADIO {
|
|
||||||
type Components = (Wifi, Bluetooth, LowRate);
|
|
||||||
|
|
||||||
fn split(self) -> Self::Components {
|
|
||||||
unsafe {
|
|
||||||
(Wifi::steal(), Bluetooth::steal(), LowRate::steal())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if #[cfg(all(bt, ieee802154))] {
|
|
||||||
impl RadioExt for crate::peripherals::RADIO {
|
|
||||||
type Components = (Bluetooth, LowRate);
|
|
||||||
|
|
||||||
fn split(self) -> Self::Components {
|
|
||||||
unsafe {
|
|
||||||
(Bluetooth::steal(), LowRate::steal())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if #[cfg(all(bt, wifi))] {
|
|
||||||
impl RadioExt for crate::peripherals::RADIO {
|
|
||||||
type Components = (Wifi, Bluetooth);
|
|
||||||
|
|
||||||
fn split(self) -> Self::Components {
|
|
||||||
unsafe {
|
|
||||||
(Wifi::steal(), Bluetooth::steal())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if #[cfg(wifi)] {
|
|
||||||
impl RadioExt for crate::peripherals::RADIO {
|
|
||||||
type Components = Wifi;
|
|
||||||
|
|
||||||
fn split(self) -> Self::Components {
|
|
||||||
unsafe {
|
|
||||||
Wifi::steal()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -32,8 +32,6 @@ crate::peripherals! {
|
|||||||
AES <= AES,
|
AES <= AES,
|
||||||
APB_CTRL <= APB_CTRL,
|
APB_CTRL <= APB_CTRL,
|
||||||
BB <= BB,
|
BB <= BB,
|
||||||
// SYSTEM is derived from DPORT
|
|
||||||
SYSTEM <= DPORT,
|
|
||||||
EFUSE <= EFUSE,
|
EFUSE <= EFUSE,
|
||||||
FLASH_ENCRYPTION <= FLASH_ENCRYPTION,
|
FLASH_ENCRYPTION <= FLASH_ENCRYPTION,
|
||||||
FRC_TIMER <= FRC_TIMER,
|
FRC_TIMER <= FRC_TIMER,
|
||||||
@ -65,6 +63,8 @@ crate::peripherals! {
|
|||||||
SPI1 <= SPI1,
|
SPI1 <= SPI1,
|
||||||
SPI2 <= SPI2,
|
SPI2 <= SPI2,
|
||||||
SPI3 <= SPI3,
|
SPI3 <= SPI3,
|
||||||
|
// SYSTEM is derived from DPORT:
|
||||||
|
SYSTEM <= DPORT,
|
||||||
TIMG0 <= TIMG0,
|
TIMG0 <= TIMG0,
|
||||||
TIMG1 <= TIMG1,
|
TIMG1 <= TIMG1,
|
||||||
TWAI0 <= TWAI0,
|
TWAI0 <= TWAI0,
|
||||||
@ -73,6 +73,9 @@ crate::peripherals! {
|
|||||||
UART2 <= UART2,
|
UART2 <= UART2,
|
||||||
UHCI0 <= UHCI0,
|
UHCI0 <= UHCI0,
|
||||||
UHCI1 <= UHCI1,
|
UHCI1 <= UHCI1,
|
||||||
RADIO <= virtual,
|
|
||||||
|
// Virtual peripherals:
|
||||||
|
BT <= virtual,
|
||||||
PSRAM <= virtual,
|
PSRAM <= virtual,
|
||||||
|
WIFI <= virtual,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,5 +53,8 @@ crate::peripherals! {
|
|||||||
UART0 <= UART0,
|
UART0 <= UART0,
|
||||||
UART1 <= UART1,
|
UART1 <= UART1,
|
||||||
XTS_AES <= XTS_AES,
|
XTS_AES <= XTS_AES,
|
||||||
RADIO <= virtual
|
|
||||||
|
// Virtual peripherals:
|
||||||
|
BT <= virtual,
|
||||||
|
WIFI <= virtual,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,5 +64,8 @@ crate::peripherals! {
|
|||||||
UHCI1 <= UHCI1,
|
UHCI1 <= UHCI1,
|
||||||
USB_DEVICE <= USB_DEVICE,
|
USB_DEVICE <= USB_DEVICE,
|
||||||
XTS_AES <= XTS_AES,
|
XTS_AES <= XTS_AES,
|
||||||
RADIO <= virtual
|
|
||||||
|
// Virtual peripherals:
|
||||||
|
BT <= virtual,
|
||||||
|
WIFI <= virtual,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,8 +69,6 @@ crate::peripherals! {
|
|||||||
PARL_IO <= PARL_IO,
|
PARL_IO <= PARL_IO,
|
||||||
PAU <= PAU,
|
PAU <= PAU,
|
||||||
PCNT <= PCNT,
|
PCNT <= PCNT,
|
||||||
// SYSTEM is derived from PCR
|
|
||||||
SYSTEM <= PCR,
|
|
||||||
PMU <= PMU,
|
PMU <= PMU,
|
||||||
RMT <= RMT,
|
RMT <= RMT,
|
||||||
RNG <= RNG,
|
RNG <= RNG,
|
||||||
@ -81,6 +79,8 @@ crate::peripherals! {
|
|||||||
SPI0 <= SPI0,
|
SPI0 <= SPI0,
|
||||||
SPI1 <= SPI1,
|
SPI1 <= SPI1,
|
||||||
SPI2 <= SPI2,
|
SPI2 <= SPI2,
|
||||||
|
// SYSTEM is derived from PCR
|
||||||
|
SYSTEM <= PCR,
|
||||||
SYSTIMER <= SYSTIMER,
|
SYSTIMER <= SYSTIMER,
|
||||||
TEE <= TEE,
|
TEE <= TEE,
|
||||||
TIMG0 <= TIMG0,
|
TIMG0 <= TIMG0,
|
||||||
@ -92,6 +92,10 @@ crate::peripherals! {
|
|||||||
UART1 <= UART1,
|
UART1 <= UART1,
|
||||||
UHCI0 <= UHCI0,
|
UHCI0 <= UHCI0,
|
||||||
USB_DEVICE <= USB_DEVICE,
|
USB_DEVICE <= USB_DEVICE,
|
||||||
RADIO <= virtual,
|
|
||||||
|
// Virtual peripherals:
|
||||||
|
BT <= virtual,
|
||||||
|
IEEE802154 <= virtual,
|
||||||
LP_CORE <= virtual,
|
LP_CORE <= virtual,
|
||||||
|
WIFI <= virtual,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,8 +62,6 @@ crate::peripherals! {
|
|||||||
PARL_IO <= PARL_IO,
|
PARL_IO <= PARL_IO,
|
||||||
PAU <= PAU,
|
PAU <= PAU,
|
||||||
PCNT <= PCNT,
|
PCNT <= PCNT,
|
||||||
// SYSTEM is derived from PCR
|
|
||||||
SYSTEM <= PCR,
|
|
||||||
PMU <= PMU,
|
PMU <= PMU,
|
||||||
RMT <= RMT,
|
RMT <= RMT,
|
||||||
RNG <= RNG,
|
RNG <= RNG,
|
||||||
@ -73,6 +71,8 @@ crate::peripherals! {
|
|||||||
SPI0 <= SPI0,
|
SPI0 <= SPI0,
|
||||||
SPI1 <= SPI1,
|
SPI1 <= SPI1,
|
||||||
SPI2 <= SPI2,
|
SPI2 <= SPI2,
|
||||||
|
// SYSTEM is derived from PCR:
|
||||||
|
SYSTEM <= PCR,
|
||||||
SYSTIMER <= SYSTIMER,
|
SYSTIMER <= SYSTIMER,
|
||||||
TEE <= TEE,
|
TEE <= TEE,
|
||||||
TIMG0 <= TIMG0,
|
TIMG0 <= TIMG0,
|
||||||
@ -83,5 +83,8 @@ crate::peripherals! {
|
|||||||
UART1 <= UART1,
|
UART1 <= UART1,
|
||||||
UHCI0 <= UHCI0,
|
UHCI0 <= UHCI0,
|
||||||
USB_DEVICE <= USB_DEVICE,
|
USB_DEVICE <= USB_DEVICE,
|
||||||
RADIO <= virtual,
|
|
||||||
|
// Virtual peripherals:
|
||||||
|
BT <= virtual,
|
||||||
|
IEEE802154 <= virtual,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,9 @@ crate::peripherals! {
|
|||||||
USB0 <= USB0,
|
USB0 <= USB0,
|
||||||
USB_WRAP <= USB_WRAP,
|
USB_WRAP <= USB_WRAP,
|
||||||
XTS_AES <= XTS_AES,
|
XTS_AES <= XTS_AES,
|
||||||
RADIO <= virtual,
|
|
||||||
|
// Virtual peripherals:
|
||||||
PSRAM <= virtual,
|
PSRAM <= virtual,
|
||||||
ULP_RISCV_CORE <= virtual,
|
ULP_RISCV_CORE <= virtual,
|
||||||
|
WIFI <= virtual,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,7 +81,10 @@ crate::peripherals! {
|
|||||||
USB_WRAP <= USB_WRAP,
|
USB_WRAP <= USB_WRAP,
|
||||||
WCL <= WCL,
|
WCL <= WCL,
|
||||||
XTS_AES <= XTS_AES,
|
XTS_AES <= XTS_AES,
|
||||||
RADIO <= virtual,
|
|
||||||
|
// Virtual peripherals:
|
||||||
|
BT <= virtual,
|
||||||
PSRAM <= virtual,
|
PSRAM <= virtual,
|
||||||
ULP_RISCV_CORE <= virtual,
|
ULP_RISCV_CORE <= virtual,
|
||||||
|
WIFI <= virtual,
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user