diff options
| author | Mick Chanthaseth <[email protected]> | 2025-04-10 14:09:53 -0700 |
|---|---|---|
| committer | Mick Chanthaseth <[email protected]> | 2025-04-10 14:09:53 -0700 |
| commit | 5bc4de236c6740b5afa4f95bbab1991ac31df06a (patch) | |
| tree | b4421bc26ad19bb5309c8203627b66c6e064d16e | |
| parent | e4739113b7c31a2949b4ebab7ac0ff2d44c39d6a (diff) | |
fixed fmt
| -rw-r--r-- | examples/stm32h742/src/bin/qspi.rs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/examples/stm32h742/src/bin/qspi.rs b/examples/stm32h742/src/bin/qspi.rs index 707bb9922..aee07f3f2 100644 --- a/examples/stm32h742/src/bin/qspi.rs +++ b/examples/stm32h742/src/bin/qspi.rs | |||
| @@ -5,9 +5,7 @@ | |||
| 5 | use defmt::info; | 5 | use defmt::info; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_stm32::mode::Blocking; | 7 | use embassy_stm32::mode::Blocking; |
| 8 | use embassy_stm32::qspi::enums::{ | 8 | use embassy_stm32::qspi::enums::{AddressSize, ChipSelectHighTime, FIFOThresholdLevel, MemorySize, *}; |
| 9 | AddressSize, ChipSelectHighTime, FIFOThresholdLevel, MemorySize, *, | ||
| 10 | }; | ||
| 11 | use embassy_stm32::qspi::{Config as QspiCfg, Instance, Qspi, TransferConfig}; | 9 | use embassy_stm32::qspi::{Config as QspiCfg, Instance, Qspi, TransferConfig}; |
| 12 | use embassy_stm32::Config as StmCfg; | 10 | use embassy_stm32::Config as StmCfg; |
| 13 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -188,11 +186,7 @@ impl<I: Instance> FlashMemory<I> { | |||
| 188 | 186 | ||
| 189 | while left > 0 { | 187 | while left > 0 { |
| 190 | let max_chunk_size = MEMORY_PAGE_SIZE - (place & 0x000000ff) as usize; | 188 | let max_chunk_size = MEMORY_PAGE_SIZE - (place & 0x000000ff) as usize; |
| 191 | let chunk_size = if left >= max_chunk_size { | 189 | let chunk_size = if left >= max_chunk_size { max_chunk_size } else { left }; |
| 192 | max_chunk_size | ||
| 193 | } else { | ||
| 194 | left | ||
| 195 | }; | ||
| 196 | let chunk = &buffer[chunk_start..(chunk_start + chunk_size)]; | 190 | let chunk = &buffer[chunk_start..(chunk_start + chunk_size)]; |
| 197 | self.write_page(place, chunk, chunk_size); | 191 | self.write_page(place, chunk, chunk_size); |
| 198 | place += chunk_size as u32; | 192 | place += chunk_size as u32; |
| @@ -279,9 +273,7 @@ async fn main(_spawner: Spawner) -> ! { | |||
| 279 | cs_high_time: ChipSelectHighTime::_1Cycle, | 273 | cs_high_time: ChipSelectHighTime::_1Cycle, |
| 280 | fifo_threshold: FIFOThresholdLevel::_16Bytes, | 274 | fifo_threshold: FIFOThresholdLevel::_16Bytes, |
| 281 | }; | 275 | }; |
| 282 | let driver = Qspi::new_blocking_bank1( | 276 | let driver = Qspi::new_blocking_bank1(p.QUADSPI, p.PD11, p.PD12, p.PE2, p.PD13, p.PB2, p.PB10, config); |
| 283 | p.QUADSPI, p.PD11, p.PD12, p.PE2, p.PD13, p.PB2, p.PB10, config, | ||
| 284 | ); | ||
| 285 | let mut flash = FlashMemory::new(driver); | 277 | let mut flash = FlashMemory::new(driver); |
| 286 | let flash_id = flash.read_id(); | 278 | let flash_id = flash.read_id(); |
| 287 | info!("FLASH ID: {:?}", flash_id); | 279 | info!("FLASH ID: {:?}", flash_id); |
