@@ -318,18 +318,10 @@ macro_rules! pwm_2_channels {
318
318
rcc. regs. $apbrstr. modify( |_, w| w. $timXrst( ) . clear_bit( ) ) ;
319
319
320
320
if PINS :: C1 {
321
- //NOTE(unsafe) 6 is a valid value to write to oc1m
322
- unsafe {
323
- tim. ccmr1_output( )
324
- . modify( |_, w| w. oc1pe( ) . set_bit( ) . oc1m( ) . bits( 6 ) ) ;
325
- }
321
+ tim. ccmr1_output( ) . modify( |_, w| w. oc1pe( ) . set_bit( ) . oc1m( ) . bits( 6 ) ) ;
326
322
}
327
323
if PINS :: C2 {
328
- //NOTE(unsafe) 6 is a valid value to write to oc1m
329
- unsafe {
330
- tim. ccmr1_output( )
331
- . modify( |_, w| w. oc2pe( ) . set_bit( ) . oc1m( ) . bits( 6 ) ) ;
332
- }
324
+ tim. ccmr1_output( ) . modify( |_, w| w. oc2pe( ) . set_bit( ) . oc1m( ) . bits( 6 ) ) ;
333
325
}
334
326
335
327
// If pclk is prescaled from hclk, the frequency fed into the timers is doubled
@@ -379,7 +371,7 @@ macro_rules! pwm_2_channels {
379
371
380
372
//NOTE(unsafe) atomic read with no side effects
381
373
fn get_duty( & self ) -> u16 {
382
- unsafe { ( * $TIMX:: ptr( ) ) . ccr1. read( ) . ccr1 ( ) . bits( ) as u16 }
374
+ unsafe { ( * $TIMX:: ptr( ) ) . ccr1. read( ) . ccr ( ) . bits( ) as u16 }
383
375
}
384
376
385
377
//NOTE(unsafe) atomic read with no side effects
@@ -389,7 +381,7 @@ macro_rules! pwm_2_channels {
389
381
390
382
//NOTE(unsafe) atomic write with no side effects
391
383
fn set_duty( & mut self , duty: u16 ) {
392
- unsafe { ( * $TIMX:: ptr( ) ) . ccr1. write( |w| w. ccr1 ( ) . bits( duty. into( ) ) ) }
384
+ unsafe { ( * $TIMX:: ptr( ) ) . ccr1. write( |w| w. ccr ( ) . bits( duty. into( ) ) ) }
393
385
}
394
386
}
395
387
@@ -408,7 +400,7 @@ macro_rules! pwm_2_channels {
408
400
409
401
//NOTE(unsafe) atomic read with no side effects
410
402
fn get_duty( & self ) -> u16 {
411
- unsafe { ( * $TIMX:: ptr( ) ) . ccr2. read( ) . ccr2 ( ) . bits( ) as u16 }
403
+ unsafe { ( * $TIMX:: ptr( ) ) . ccr2. read( ) . ccr ( ) . bits( ) as u16 }
412
404
}
413
405
414
406
//NOTE(unsafe) atomic read with no side effects
@@ -418,7 +410,7 @@ macro_rules! pwm_2_channels {
418
410
419
411
//NOTE(unsafe) atomic write with no side effects
420
412
fn set_duty( & mut self , duty: u16 ) {
421
- unsafe { ( * $TIMX:: ptr( ) ) . ccr2. write( |w| w. ccr2 ( ) . bits( duty. into( ) ) ) }
413
+ unsafe { ( * $TIMX:: ptr( ) ) . ccr2. write( |w| w. ccr ( ) . bits( duty. into( ) ) ) }
422
414
}
423
415
}
424
416
) +
@@ -440,11 +432,7 @@ macro_rules! pwm_1_channel {
440
432
rcc. regs. $apbrstr. modify( |_, w| w. $timXrst( ) . clear_bit( ) ) ;
441
433
442
434
if PINS :: C1 {
443
- //NOTE(unsafe) 6 is a valid value to write to oc1m
444
- unsafe {
445
- tim. ccmr1_output( )
446
- . modify( |_, w| w. oc1pe( ) . set_bit( ) . oc1m( ) . bits( 6 ) ) ;
447
- }
435
+ tim. ccmr1_output( ) . modify( |_, w| w. oc1pe( ) . set_bit( ) . oc1m( ) . bits( 6 ) ) ;
448
436
}
449
437
450
438
// If pclk is prescaled from hclk, the frequency fed into the timers is doubled
@@ -524,11 +512,7 @@ macro_rules! pwm_1_channel_with_complementary_outputs {
524
512
rcc. regs. $apbrstr. modify( |_, w| w. $timXrst( ) . clear_bit( ) ) ;
525
513
526
514
if PINS :: C1 {
527
- //NOTE(unsafe) 6 is a valid value to write to oc1m
528
- unsafe {
529
- tim. ccmr1_output( )
530
- . modify( |_, w| w. oc1pe( ) . set_bit( ) . oc1m( ) . bits( 6 ) ) ;
531
- }
515
+ tim. ccmr1_output( ) . modify( |_, w| w. oc1pe( ) . set_bit( ) . oc1m( ) . bits( 6 ) ) ;
532
516
}
533
517
534
518
// If pclk is prescaled from hclk, the frequency fed into the timers is doubled
@@ -579,7 +563,7 @@ macro_rules! pwm_1_channel_with_complementary_outputs {
579
563
580
564
//NOTE(unsafe) atomic read with no side effects
581
565
fn get_duty( & self ) -> u16 {
582
- unsafe { ( * $TIMX:: ptr( ) ) . ccr1. read( ) . ccr1 ( ) . bits( ) as u16 }
566
+ unsafe { ( * $TIMX:: ptr( ) ) . ccr1. read( ) . ccr ( ) . bits( ) as u16 }
583
567
}
584
568
585
569
//NOTE(unsafe) atomic read with no side effects
@@ -589,7 +573,7 @@ macro_rules! pwm_1_channel_with_complementary_outputs {
589
573
590
574
//NOTE(unsafe) atomic write with no side effects
591
575
fn set_duty( & mut self , duty: u16 ) {
592
- unsafe { ( * $TIMX:: ptr( ) ) . ccr1. write( |w| w. ccr1 ( ) . bits( duty. into( ) ) ) }
576
+ unsafe { ( * $TIMX:: ptr( ) ) . ccr1. write( |w| w. ccr ( ) . bits( duty. into( ) ) ) }
593
577
}
594
578
}
595
579
) +
0 commit comments