@@ -15,7 +15,7 @@ trait GpioRegExt {
15
15
fn in_low ( & self , pos : u8 ) -> bool ;
16
16
fn out_low ( & self , pos : u8 ) -> bool ;
17
17
fn set_high ( & self , pos : u8 ) ;
18
- fn set_low ( & self , pos : u8 ) ;
18
+ fn set_low ( & self , pos : u8 ) ;
19
19
}
20
20
21
21
pub struct AF0 ;
@@ -56,7 +56,7 @@ pub struct Output<MODE> {
56
56
/// Push pull output (type state)
57
57
pub struct PushPull ;
58
58
59
- use embedded_hal:: digital:: { InputPin , OutputPin , StatefulOutputPin , toggleable } ;
59
+ use embedded_hal:: digital:: { toggleable , InputPin , OutputPin , StatefulOutputPin } ;
60
60
61
61
/// Fully erased pin
62
62
pub struct Pin < MODE > {
@@ -109,28 +109,28 @@ impl<MODE> InputPin for Pin<Input<MODE>> {
109
109
110
110
macro_rules! gpio_trait {
111
111
( $gpiox: ident) => {
112
- impl GpioRegExt for crate :: stm32:: $gpiox:: RegisterBlock {
113
- fn in_low( & self , pos : u8 ) -> bool {
114
- // NOTE(unsafe) atomic read with no side effects
115
- self . idr. read( ) . bits( ) & ( 1 << pos) == 0
116
- }
112
+ impl GpioRegExt for crate :: stm32:: $gpiox:: RegisterBlock {
113
+ fn in_low( & self , pos: u8 ) -> bool {
114
+ // NOTE(unsafe) atomic read with no side effects
115
+ self . idr. read( ) . bits( ) & ( 1 << pos) == 0
116
+ }
117
117
118
- fn out_low( & self , pos: u8 ) -> bool {
119
- // NOTE(unsafe) atomic read with no side effects
120
- self . odr. read( ) . bits( ) & ( 1 << pos) == 0
121
- }
118
+ fn out_low( & self , pos: u8 ) -> bool {
119
+ // NOTE(unsafe) atomic read with no side effects
120
+ self . odr. read( ) . bits( ) & ( 1 << pos) == 0
121
+ }
122
122
123
- fn set_high( & self , pos: u8 ) {
124
- // NOTE(unsafe) atomic write to a stateless register
125
- unsafe { self . bsrr. write( |w| w. bits( 1 << pos) ) }
126
- }
123
+ fn set_high( & self , pos: u8 ) {
124
+ // NOTE(unsafe) atomic write to a stateless register
125
+ unsafe { self . bsrr. write( |w| w. bits( 1 << pos) ) }
126
+ }
127
127
128
- fn set_low( & self , pos: u8 ) {
129
- // NOTE(unsafe) atomic write to a stateless register
130
- unsafe { self . bsrr. write( |w| w. bits( 1 << ( pos + 16 ) ) ) }
131
- }
132
- }
133
- }
128
+ fn set_low( & self , pos: u8 ) {
129
+ // NOTE(unsafe) atomic write to a stateless register
130
+ unsafe { self . bsrr. write( |w| w. bits( 1 << ( pos + 16 ) ) ) }
131
+ }
132
+ }
133
+ } ;
134
134
}
135
135
136
136
gpio_trait ! ( gpioa) ;
0 commit comments