File tree 1 file changed +25
-3
lines changed
1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change 1
1
use crate :: {
2
- bb, hal as pwm ,
2
+ bb,
3
3
time:: Hertz ,
4
4
timer:: { General , Timer } ,
5
5
} ;
6
6
use cast:: u16;
7
- use core:: { marker:: PhantomData , mem:: MaybeUninit } ;
7
+ use core:: { convert :: Infallible , marker:: PhantomData , mem:: MaybeUninit } ;
8
8
9
9
pub trait Pins < TIM , P > {
10
10
const C1 : bool = false ;
@@ -132,8 +132,9 @@ macro_rules! pwm_pin {
132
132
}
133
133
}
134
134
135
- impl pwm :: PwmPin for PwmChannels <$TIMX, $C> {
135
+ impl embedded_hal :: PwmPin for PwmChannels <$TIMX, $C> {
136
136
type Duty = u16 ;
137
+
137
138
fn disable( & mut self ) {
138
139
self . disable( )
139
140
}
@@ -150,6 +151,27 @@ macro_rules! pwm_pin {
150
151
self . set_duty( duty)
151
152
}
152
153
}
154
+
155
+ impl embedded_hal_one:: pwm:: blocking:: PwmPin for PwmChannels <$TIMX, $C> {
156
+ type Error = Infallible ;
157
+ type Duty = u16 ;
158
+
159
+ fn disable( & mut self ) -> Result <( ) , Self :: Error > {
160
+ Ok ( self . disable( ) )
161
+ }
162
+ fn enable( & mut self ) -> Result <( ) , Self :: Error > {
163
+ Ok ( self . enable( ) )
164
+ }
165
+ fn get_duty( & self ) -> Result <Self :: Duty , Self :: Error > {
166
+ Ok ( self . get_duty( ) )
167
+ }
168
+ fn get_max_duty( & self ) -> Result <Self :: Duty , Self :: Error > {
169
+ Ok ( self . get_max_duty( ) )
170
+ }
171
+ fn set_duty( & mut self , duty: Self :: Duty ) -> Result <( ) , Self :: Error > {
172
+ Ok ( self . set_duty( duty) )
173
+ }
174
+ }
153
175
} ;
154
176
}
155
177
You can’t perform that action at this time.
0 commit comments