1use embassy_rp::{
2 Peri,
3 dma::{self, ChannelInstance},
4 flash::Flash,
5 interrupt,
6 peripherals::FLASH,
7};
8use rktk::drivers::interface::storage::StorageDriver;
9use rktk_drivers_common::storage::flash_sequential_map::FlashSequentialMapStorage;
10
11pub fn init_storage<D: ChannelInstance, const SIZE: usize>(
16 flash: Peri<'static, FLASH>,
17 dma: Peri<'static, D>,
18 irq: impl interrupt::typelevel::Binding<D::Interrupt, dma::InterruptHandler<D>> + 'static,
19) -> impl StorageDriver {
20 let flash = Flash::<_, _, SIZE>::new(flash, dma, irq);
21
22 const FLASH_START: u32 = 1024 * 1024;
23 const FLASH_SIZE: u32 = 2 * 1024 * 1024;
24
25 FlashSequentialMapStorage::new(flash, FLASH_START, FLASH_SIZE)
26}