File tree Expand file tree Collapse file tree 1 file changed +25
-3
lines changed
Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change 11use crate :: {
2- bb, hal as pwm ,
2+ bb,
33 time:: Hertz ,
44 timer:: { General , Timer } ,
55} ;
66use cast:: u16;
7- use core:: { marker:: PhantomData , mem:: MaybeUninit } ;
7+ use core:: { convert :: Infallible , marker:: PhantomData , mem:: MaybeUninit } ;
88
99pub trait Pins < TIM , P > {
1010 const C1 : bool = false ;
@@ -132,8 +132,9 @@ macro_rules! pwm_pin {
132132 }
133133 }
134134
135- impl pwm :: PwmPin for PwmChannels <$TIMX, $C> {
135+ impl embedded_hal :: PwmPin for PwmChannels <$TIMX, $C> {
136136 type Duty = u16 ;
137+
137138 fn disable( & mut self ) {
138139 self . disable( )
139140 }
@@ -150,6 +151,27 @@ macro_rules! pwm_pin {
150151 self . set_duty( duty)
151152 }
152153 }
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+ }
153175 } ;
154176}
155177
You can’t perform that action at this time.
0 commit comments