@@ -144,31 +144,31 @@ macro_rules! pwm_pin {
144
144
impl PwmChannels <$TIMX, $C> {
145
145
//NOTE(unsafe) atomic write with no side effects
146
146
#[ inline]
147
- fn disable( & mut self ) {
147
+ pub fn disable( & mut self ) {
148
148
unsafe { bb:: clear( & ( * <$TIMX>:: ptr( ) ) . ccer, $bit) }
149
149
}
150
150
151
151
//NOTE(unsafe) atomic write with no side effects
152
152
#[ inline]
153
- fn enable( & mut self ) {
153
+ pub fn enable( & mut self ) {
154
154
unsafe { bb:: set( & ( * <$TIMX>:: ptr( ) ) . ccer, $bit) }
155
155
}
156
156
157
157
//NOTE(unsafe) atomic read with no side effects
158
158
#[ inline]
159
- fn get_duty( & self ) -> u16 {
159
+ pub fn get_duty( & self ) -> u16 {
160
160
unsafe { ( * <$TIMX>:: ptr( ) ) . $ccr. read( ) . ccr( ) . bits( ) as u16 }
161
161
}
162
162
163
163
//NOTE(unsafe) atomic read with no side effects
164
164
#[ inline]
165
- fn get_max_duty( & self ) -> u16 {
165
+ pub fn get_max_duty( & self ) -> u16 {
166
166
unsafe { ( * <$TIMX>:: ptr( ) ) . arr. read( ) . arr( ) . bits( ) as u16 }
167
167
}
168
168
169
169
//NOTE(unsafe) atomic write with no side effects
170
170
#[ inline]
171
- fn set_duty( & mut self , duty: u16 ) {
171
+ pub fn set_duty( & mut self , duty: u16 ) {
172
172
unsafe { ( * <$TIMX>:: ptr( ) ) . $ccr. write( |w| w. ccr( ) . bits( duty. into( ) ) ) }
173
173
}
174
174
}
@@ -191,7 +191,7 @@ macro_rules! pwm_pin {
191
191
self . set_duty( duty)
192
192
}
193
193
}
194
- }
194
+ } ;
195
195
}
196
196
197
197
macro_rules! pwm_all_channels {
@@ -269,7 +269,7 @@ macro_rules! pwm_all_channels {
269
269
}
270
270
271
271
macro_rules! pwm_2_channels {
272
- ( $( $TIMX: ident : ( $timX: ident, $pclk: ident, $ppre: ident) , ) +) => {
272
+ ( $( $TIMX: ty : ( $timX: ident, $pclk: ident, $ppre: ident) , ) +) => {
273
273
$(
274
274
pub fn $timX<P , PINS , T >( tim: $TIMX, _pins: PINS , clocks: Clocks , freq: T ) -> PINS :: Channels
275
275
where
@@ -281,8 +281,8 @@ macro_rules! pwm_2_channels {
281
281
//NOTE(unsafe) this reference will only be used for atomic writes with no side effects
282
282
let rcc = & ( * RCC :: ptr( ) ) ;
283
283
// Enable and reset the timer peripheral
284
- $TIMX:: enable( rcc) ;
285
- $TIMX:: reset( rcc) ;
284
+ < $TIMX> :: enable( rcc) ;
285
+ < $TIMX> :: reset( rcc) ;
286
286
}
287
287
}
288
288
if PINS :: C1 {
@@ -332,7 +332,7 @@ macro_rules! pwm_2_channels {
332
332
}
333
333
334
334
macro_rules! pwm_1_channel {
335
- ( $( $TIMX: ident : ( $timX: ident, $pclk: ident, $ppre: ident) , ) +) => {
335
+ ( $( $TIMX: ty : ( $timX: ident, $pclk: ident, $ppre: ident) , ) +) => {
336
336
$(
337
337
pub fn $timX<P , PINS , T >( tim: $TIMX, _pins: PINS , clocks: Clocks , freq: T ) -> PINS :: Channels
338
338
where
@@ -344,8 +344,8 @@ macro_rules! pwm_1_channel {
344
344
//NOTE(unsafe) this reference will only be used for atomic writes with no side effects
345
345
let rcc = & ( * RCC :: ptr( ) ) ;
346
346
// Enable and reset the timer peripheral
347
- $TIMX:: enable( rcc) ;
348
- $TIMX:: reset( rcc) ;
347
+ < $TIMX> :: enable( rcc) ;
348
+ < $TIMX> :: reset( rcc) ;
349
349
}
350
350
}
351
351
if PINS :: C1 {
@@ -392,32 +392,36 @@ macro_rules! pwm_pin_tim5 {
392
392
impl PwmChannels <$TIMX, $C> {
393
393
//NOTE(unsafe) atomic write with no side effects
394
394
#[ inline]
395
- fn disable( & mut self ) {
395
+ pub fn disable( & mut self ) {
396
396
unsafe { bb:: clear( & ( * <$TIMX>:: ptr( ) ) . ccer, 0 ) }
397
397
}
398
398
399
399
//NOTE(unsafe) atomic write with no side effects
400
400
#[ inline]
401
- fn enable( & mut self ) {
401
+ pub fn enable( & mut self ) {
402
402
unsafe { bb:: set( & ( * <$TIMX>:: ptr( ) ) . ccer, 0 ) }
403
403
}
404
404
405
405
//NOTE(unsafe) atomic read with no side effects
406
406
#[ inline]
407
- fn get_duty( & self ) -> u16 {
407
+ pub fn get_duty( & self ) -> u16 {
408
408
unsafe { ( * <$TIMX>:: ptr( ) ) . $ccr. read( ) . ccr1_l( ) . bits( ) as u16 }
409
409
}
410
410
411
411
//NOTE(unsafe) atomic read with no side effects
412
412
#[ inline]
413
- fn get_max_duty( & self ) -> u16 {
413
+ pub fn get_max_duty( & self ) -> u16 {
414
414
unsafe { ( * <$TIMX>:: ptr( ) ) . arr. read( ) . arr_l( ) . bits( ) as u16 }
415
415
}
416
416
417
417
//NOTE(unsafe) atomic write with no side effects
418
418
#[ inline]
419
- fn set_duty( & mut self , duty: u16 ) {
420
- unsafe { ( * <$TIMX>:: ptr( ) ) . $ccr. write( |w| w. ccr1_l( ) . bits( duty. into( ) ) ) }
419
+ pub fn set_duty( & mut self , duty: u16 ) {
420
+ unsafe {
421
+ ( * <$TIMX>:: ptr( ) )
422
+ . $ccr
423
+ . write( |w| w. ccr1_l( ) . bits( duty. into( ) ) )
424
+ }
421
425
}
422
426
}
423
427
@@ -439,12 +443,12 @@ macro_rules! pwm_pin_tim5 {
439
443
self . set_duty( duty)
440
444
}
441
445
}
442
- }
446
+ } ;
443
447
}
444
448
445
449
#[ cfg( feature = "stm32f410" ) ]
446
450
macro_rules! pwm_tim5_f410 {
447
- ( $( $TIMX: ident : ( $timX: ident, $pclk: ident, $ppre: ident) , ) +) => {
451
+ ( $( $TIMX: ty : ( $timX: ident, $pclk: ident, $ppre: ident) , ) +) => {
448
452
$(
449
453
pub fn $timX<P , PINS , T >( tim: $TIMX, _pins: PINS , clocks: Clocks , freq: T ) -> PINS :: Channels
450
454
where
@@ -456,8 +460,8 @@ macro_rules! pwm_tim5_f410 {
456
460
//NOTE(unsafe) this reference will only be used for atomic writes with no side effects
457
461
let rcc = & ( * RCC :: ptr( ) ) ;
458
462
// Enable and reset the timer peripheral
459
- $TIMX:: enable( rcc) ;
460
- $TIMX:: reset( rcc) ;
463
+ < $TIMX> :: enable( rcc) ;
464
+ < $TIMX> :: reset( rcc) ;
461
465
}
462
466
}
463
467
if PINS :: C1 {
0 commit comments