|
3 | 3 | #![feature(type_alias_impl_trait)] |
4 | 4 | #![feature(impl_trait_in_assoc_type)] |
5 | 5 |
|
6 | | -use ch32_hal::flash::{Flash, FLASH_BASE}; |
| 6 | +use ch32_hal::flash::Flash; |
7 | 7 | use ch32_hal::rcc::*; |
8 | 8 | use ch32_hal::{interrupt, println}; |
9 | 9 | use embassy_executor::Spawner; |
@@ -41,27 +41,27 @@ async fn main(_spawner: Spawner) -> ! { |
41 | 41 | Timer::after_millis(1000).await; |
42 | 42 |
|
43 | 43 | let mut f = Flash::new_blocking(p.FLASH); |
44 | | - const size: u32 = 256; |
| 44 | + const SIZE: u32 = 256; |
45 | 45 | let start: u32 = 1024 * 32; |
46 | 46 | let stop = start + 256 * 3; |
47 | | - for offset in (start..stop).step_by(size as usize) { |
48 | | - println!("Testing offset: {:#X}, size: {:#X}", offset, size); |
| 47 | + for offset in (start..stop).step_by(SIZE as usize) { |
| 48 | + println!("Testing offset: {:#X}, size: {:#X}", offset, SIZE); |
49 | 49 |
|
50 | 50 | println!("Reading..."); |
51 | 51 | let mut buf = [0u8; 32]; |
52 | 52 | println!("{:?}", f.blocking_read(offset, &mut buf)); |
53 | 53 | println!("Read: {:?}", buf); |
54 | 54 |
|
55 | 55 | println!("Erasing..."); |
56 | | - println!("{:?}", f.blocking_erase(offset, offset + size)); |
| 56 | + println!("{:?}", f.blocking_erase(offset, offset + SIZE)); |
57 | 57 |
|
58 | 58 | println!("Reading..."); |
59 | 59 | let mut buf = [0u8; 32]; |
60 | 60 | println!("{:?}", f.blocking_read(offset, &mut buf)); |
61 | 61 | println!("Read after erase: {:?}", buf); |
62 | 62 |
|
63 | 63 | println!("Writing..."); |
64 | | - println!("{:?}", f.blocking_write(offset, &[0xabu8; size as usize])); |
| 64 | + println!("{:?}", f.blocking_write(offset, &[0xabu8; SIZE as usize])); |
65 | 65 |
|
66 | 66 | println!("Reading..."); |
67 | 67 | let mut buf = [0u8; 32]; |
|
0 commit comments