@@ -135,13 +135,14 @@ macro_rules! pwm_all_channels {
135
135
T : Into <Hertz >,
136
136
{
137
137
{
138
- //NOTE(unsafe) this reference will only be used for atomic writes with no side effects
139
- let rcc = unsafe { & ( * RCC :: ptr( ) ) } ;
140
-
141
- // Enable and reset the timer peripheral, it's the same bit position for both registers
142
- bb:: set( & rcc. $apbenr, $bit) ;
143
- bb:: set( & rcc. $apbrstr, $bit) ;
144
- bb:: clear( & rcc. $apbrstr, $bit) ;
138
+ unsafe {
139
+ //NOTE(unsafe) this reference will only be used for atomic writes with no side effects
140
+ let rcc = & ( * RCC :: ptr( ) ) ;
141
+ // Enable and reset the timer peripheral, it's the same bit position for both registers
142
+ bb:: set( & rcc. $apbenr, $bit) ;
143
+ bb:: set( & rcc. $apbrstr, $bit) ;
144
+ bb:: clear( & rcc. $apbrstr, $bit) ;
145
+ }
145
146
}
146
147
if PINS :: C1 {
147
148
tim. ccmr1_output( )
@@ -320,13 +321,14 @@ macro_rules! pwm_2_channels {
320
321
T : Into <Hertz >,
321
322
{
322
323
{
323
- //NOTE(unsafe) this reference will only be used for atomic writes with no side effects
324
- let rcc = unsafe { & ( * RCC :: ptr( ) ) } ;
325
-
326
- // Enable and reset the timer peripheral, it's the same bit position for both registers
327
- bb:: set( & rcc. $apbenr, $bit) ;
328
- bb:: set( & rcc. $apbrstr, $bit) ;
329
- bb:: clear( & rcc. $apbrstr, $bit) ;
324
+ unsafe {
325
+ //NOTE(unsafe) this reference will only be used for atomic writes with no side effects
326
+ let rcc = & ( * RCC :: ptr( ) ) ;
327
+ // Enable and reset the timer peripheral, it's the same bit position for both registers
328
+ bb:: set( & rcc. $apbenr, $bit) ;
329
+ bb:: set( & rcc. $apbrstr, $bit) ;
330
+ bb:: clear( & rcc. $apbrstr, $bit) ;
331
+ }
330
332
}
331
333
if PINS :: C1 {
332
334
//NOTE(unsafe) 6 is a valid value to write to oc1m
@@ -438,13 +440,14 @@ macro_rules! pwm_1_channel {
438
440
T : Into <Hertz >,
439
441
{
440
442
{
441
- //NOTE(unsafe) this reference will only be used for atomic writes with no side effects
442
- let rcc = unsafe { & ( * RCC :: ptr( ) ) } ;
443
-
444
- // Enable and reset the timer peripheral, it's the same bit position for both registers
445
- bb:: set( & rcc. $apbenr, $bit) ;
446
- bb:: set( & rcc. $apbrstr, $bit) ;
447
- bb:: clear( & rcc. $apbrstr, $bit) ;
443
+ unsafe {
444
+ //NOTE(unsafe) this reference will only be used for atomic writes with no side effects
445
+ let rcc = & ( * RCC :: ptr( ) ) ;
446
+ // Enable and reset the timer peripheral, it's the same bit position for both registers
447
+ bb:: set( & rcc. $apbenr, $bit) ;
448
+ bb:: set( & rcc. $apbrstr, $bit) ;
449
+ bb:: clear( & rcc. $apbrstr, $bit) ;
450
+ }
448
451
}
449
452
if PINS :: C1 {
450
453
//NOTE(unsafe) 6 is a valid value to write to oc1m
@@ -521,13 +524,14 @@ macro_rules! pwm_tim5_f410 {
521
524
T : Into <Hertz >,
522
525
{
523
526
{
524
- //NOTE(unsafe) this reference will only be used for atomic writes with no side effects
525
- let rcc = unsafe { & ( * RCC :: ptr( ) ) } ;
526
-
527
- // Enable and reset the timer peripheral, it's the same bit position for both registers
528
- bb:: set( & rcc. $apbenr, $bit) ;
529
- bb:: set( & rcc. $apbrstr, $bit) ;
530
- bb:: clear( & rcc. $apbrstr, $bit) ;
527
+ unsafe {
528
+ //NOTE(unsafe) this reference will only be used for atomic writes with no side effects
529
+ let rcc = & ( * RCC :: ptr( ) ) ;
530
+ // Enable and reset the timer peripheral, it's the same bit position for both registers
531
+ bb:: set( & rcc. $apbenr, $bit) ;
532
+ bb:: set( & rcc. $apbrstr, $bit) ;
533
+ bb:: clear( & rcc. $apbrstr, $bit) ;
534
+ }
531
535
}
532
536
if PINS :: C1 {
533
537
tim. ccmr1_output( )
0 commit comments