File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,18 @@ const FLASH_KEY1: u32 = 0x4567_0123;
19
19
const FLASH_KEY2 : u32 = 0xCDEF_89AB ;
20
20
21
21
impl FlashPage {
22
+ /// This gives the starting address of a flash page in physical address
22
23
pub const fn to_address ( & self ) -> usize {
23
24
FLASH_START + self . 0 * PAGE_SIZE as usize
24
25
}
25
26
}
26
27
27
28
pub trait FlashExt {
29
+ /// Unlocks Flash memory for erasure and writing
28
30
fn unlock ( self ) -> core:: result:: Result < UnlockedFlash , FLASH > ;
29
31
}
30
32
31
33
impl FlashExt for FLASH {
32
- /// Unlocks Flash memory for erasure and writing
33
34
fn unlock ( self ) -> core:: result:: Result < UnlockedFlash , FLASH > {
34
35
// Wait, while the memory interface is busy.
35
36
while self . sr . read ( ) . bsy ( ) . bit_is_set ( ) { }
@@ -47,6 +48,7 @@ impl FlashExt for FLASH {
47
48
}
48
49
}
49
50
51
+ /// Handle for an unlocked flash on which operations can be performed
50
52
pub struct UnlockedFlash {
51
53
f : FLASH ,
52
54
}
You can’t perform that action at this time.
0 commit comments