11use crate :: pac:: rcc:: cfgr:: { HPRE , SW } ;
2+ use crate :: pac:: rcc:: RegisterBlock as RccRB ;
23use crate :: pac:: { self , rcc, RCC } ;
34
45use super :: { BusClock , BusTimerClock , RccBus } ;
@@ -9,10 +10,8 @@ use fugit::RateExtU32;
910mod pll;
1011
1112mod enable;
12- use crate :: pac:: rcc:: RegisterBlock as RccRB ;
1313
1414/// Enable/disable peripheral
15- #[ allow( clippy:: missing_safety_doc) ]
1615pub trait Enable : RccBus {
1716 /// Enables peripheral
1817 fn enable ( rcc : & mut RCC ) ;
@@ -33,21 +32,20 @@ pub trait Enable: RccBus {
3332 ///
3433 /// Enables peripheral. Takes access to RCC internally
3534 unsafe fn enable_unchecked ( ) {
36- let mut rcc = pac :: RCC :: steal ( ) ;
35+ let mut rcc = RCC :: steal ( ) ;
3736 Self :: enable ( & mut rcc) ;
3837 }
3938
4039 /// # Safety
4140 ///
4241 /// Disables peripheral. Takes access to RCC internally
4342 unsafe fn disable_unchecked ( ) {
44- let mut rcc = pac :: RCC :: steal ( ) ;
43+ let mut rcc = RCC :: steal ( ) ;
4544 Self :: disable ( & mut rcc) ;
4645 }
4746}
4847
4948/// Low power enable/disable peripheral
50- #[ allow( clippy:: missing_safety_doc) ]
5149pub trait LPEnable : RccBus {
5250 /// Enables peripheral in low power mode
5351 fn enable_in_low_power ( rcc : & mut RCC ) ;
@@ -68,21 +66,20 @@ pub trait LPEnable: RccBus {
6866 ///
6967 /// Enables peripheral in low power mode. Takes access to RCC internally
7068 unsafe fn enable_in_low_power_unchecked ( ) {
71- let mut rcc = pac :: RCC :: steal ( ) ;
69+ let mut rcc = RCC :: steal ( ) ;
7270 Self :: enable_in_low_power ( & mut rcc) ;
7371 }
7472
7573 /// # Safety
7674 ///
7775 /// Disables peripheral in low power mode. Takes access to RCC internally
7876 unsafe fn disable_in_low_power_unchecked ( ) {
79- let mut rcc = pac :: RCC :: steal ( ) ;
77+ let mut rcc = RCC :: steal ( ) ;
8078 Self :: disable_in_low_power ( & mut rcc) ;
8179 }
8280}
8381
8482/// Reset peripheral
85- #[ allow( clippy:: missing_safety_doc) ]
8683pub trait Reset : RccBus {
8784 /// Resets peripheral
8885 fn reset ( rcc : & mut RCC ) ;
@@ -91,7 +88,7 @@ pub trait Reset: RccBus {
9188 ///
9289 /// Resets peripheral. Takes access to RCC internally
9390 unsafe fn reset_unchecked ( ) {
94- let mut rcc = pac :: RCC :: steal ( ) ;
91+ let mut rcc = RCC :: steal ( ) ;
9592 Self :: reset ( & mut rcc) ;
9693 }
9794}
@@ -103,14 +100,12 @@ pub trait RccExt {
103100}
104101
105102macro_rules! bus_struct {
106- ( $( $ ( # [ $attr : meta ] ) * $busX: ident => ( $EN: ident, $en: ident, $LPEN: ident, $lpen: ident, $RST: ident, $rst: ident, $doc: literal) , ) +) => {
103+ ( $( $busX: ident => ( $EN: ident, $en: ident, $LPEN: ident, $lpen: ident, $RST: ident, $rst: ident, $doc: literal) , ) +) => {
107104 $(
108- $( #[ $attr] ) *
109105 #[ doc = $doc]
110106 #[ non_exhaustive]
111107 pub struct $busX;
112108
113- $( #[ $attr] ) *
114109 impl $busX {
115110 pub ( crate ) fn enr( rcc: & RccRB ) -> & rcc:: $EN {
116111 rcc. $en( )
@@ -132,11 +127,13 @@ bus_struct! {
132127 APB1 => ( APB1ENR , apb1enr, APB1LPENR , apb1lpenr, APB1RSTR , apb1rstr, "Advanced Peripheral Bus 1 (APB1) registers" ) ,
133128 APB2 => ( APB2ENR , apb2enr, APB2LPENR , apb2lpenr, APB2RSTR , apb2rstr, "Advanced Peripheral Bus 2 (APB2) registers" ) ,
134129 AHB1 => ( AHB1ENR , ahb1enr, AHB1LPENR , ahb1lpenr, AHB1RSTR , ahb1rstr, "Advanced High-performance Bus 1 (AHB1) registers" ) ,
135- #[ cfg( not( feature = "gpio-f410" ) ) ]
136- AHB2 => ( AHB2ENR , ahb2enr, AHB2LPENR , ahb2lpenr, AHB2RSTR , ahb2rstr, "Advanced High-performance Bus 2 (AHB2) registers" ) ,
137130 //#[cfg(any(feature = "fsmc", feature = "fmc"))]
138131 //AHB3 => (AHB3ENR, ahb3enr, AHB3LPENR, ahb3lpenr, AHB3RSTR, ahb3rstr, "Advanced High-performance Bus 3 (AHB3) registers"),
139132}
133+ #[ cfg( not( feature = "gpio-f410" ) ) ]
134+ bus_struct ! {
135+ AHB2 => ( AHB2ENR , ahb2enr, AHB2LPENR , ahb2lpenr, AHB2RSTR , ahb2rstr, "Advanced High-performance Bus 2 (AHB2) registers" ) ,
136+ }
140137
141138/// AMBA High-performance Bus 3 (AHB3) registers
142139#[ cfg( any( feature = "fsmc" , feature = "fmc" ) ) ]
0 commit comments