File tree 3 files changed +7
-3
lines changed
3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ version = "0.4.2"
13
13
aligned = " 0.1.1"
14
14
bare-metal = " 0.1.0"
15
15
volatile-register = " 0.2.0"
16
+ untagged-option = " 0.1.1"
16
17
17
18
[features ]
18
- cm7-r0p1 = []
19
+ cm7-r0p1 = []
Original file line number Diff line number Diff line change 15
15
16
16
extern crate aligned;
17
17
extern crate bare_metal;
18
+ extern crate untagged_option;
18
19
extern crate volatile_register;
19
20
20
21
#[ macro_use]
@@ -31,3 +32,4 @@ pub mod peripheral;
31
32
pub mod register;
32
33
33
34
pub use peripheral:: Peripherals ;
35
+ pub use untagged_option:: UntaggedOption ;
Original file line number Diff line number Diff line change @@ -54,13 +54,14 @@ macro_rules! singleton {
54
54
( : $ty: ty = $expr: expr) => {
55
55
$crate:: interrupt:: free( |_| unsafe {
56
56
static mut USED : bool = false ;
57
- static mut VAR : $ty = $expr ;
57
+ static mut VAR : $crate :: UntaggedOption <$ty> = $crate :: UntaggedOption { none : ( ) } ;
58
58
59
59
if USED {
60
60
None
61
61
} else {
62
62
USED = true ;
63
- let var: & ' static mut _ = & mut VAR ;
63
+ VAR . some = $expr;
64
+ let var: & ' static mut _ = & mut VAR . some;
64
65
Some ( var)
65
66
}
66
67
} )
You can’t perform that action at this time.
0 commit comments