rewrite wifi crate

This commit is contained in:
2026-09-02 20:11:40 +02:00
parent 0aa1370a2b
commit 240e2b081d
7 changed files with 110 additions and 150 deletions
-28
View File
@@ -1,33 +1,5 @@
use esp_storage::FlashStorage;
pub struct MemoryRegion {
pub offset: u32,
pub size: usize,
}
impl MemoryRegion {
pub const fn new(offset: u32, size: usize) -> Self {
assert!(offset.is_multiple_of(4), "Flash requires 4 bytes alignment");
assert!(size.is_multiple_of(4), "Flash requires 4 bytes alignment");
Self { offset, size }
}
pub const fn end(&self) -> usize {
self.offset as usize + self.size
}
}
pub const MAX_FLASH: usize = 16 * 1024 * 1024;
pub const MAGIC_REGION: MemoryRegion = MemoryRegion::new(0, 4);
pub const SETTINGS_REGION: MemoryRegion = MemoryRegion::new(MAGIC_REGION.end() as u32, 1024);
pub const CARDSTORE_REGION: MemoryRegion = MemoryRegion::new(
SETTINGS_REGION.end() as u32,
MAX_FLASH - SETTINGS_REGION.end(),
);
pub type Nvs = esp_nvs::Nvs<FlashStorage<'static>>;
pub mod cardstore;