@@ -1007,8 +1007,13 @@ impl From<ClockSource> for u8 {
1007
1007
/// used to create an ADC instance from the stm32::Adc
1008
1008
pub trait AdcClaim < TYPE > {
1009
1009
/// create a disabled ADC instance from the stm32::Adc
1010
- fn claim ( self , cs : ClockSource , rcc : & Rcc , delay : & mut impl DelayUs < u8 > )
1011
- -> Adc < TYPE , Disabled > ;
1010
+ fn claim (
1011
+ self ,
1012
+ cs : ClockSource ,
1013
+ rcc : & Rcc ,
1014
+ delay : & mut impl DelayUs < u8 > ,
1015
+ reset : bool ,
1016
+ ) -> Adc < TYPE , Disabled > ;
1012
1017
1013
1018
/// create an enabled ADC instance from the stm32::Adc
1014
1019
fn claim_and_configure (
@@ -1017,6 +1022,7 @@ pub trait AdcClaim<TYPE> {
1017
1022
rcc : & Rcc ,
1018
1023
config : config:: AdcConfig ,
1019
1024
delay : & mut impl DelayUs < u8 > ,
1025
+ reset : bool ,
1020
1026
) -> Adc < TYPE , Configured > ;
1021
1027
}
1022
1028
@@ -1701,11 +1707,11 @@ macro_rules! adc {
1701
1707
/// * `reset` - should a reset be performed. This is provided because on some devices multiple ADCs share the same common reset
1702
1708
/// TODO: fix needing SYST
1703
1709
#[ inline( always) ]
1704
- fn claim( self , cs: ClockSource , rcc: & Rcc , delay: & mut impl DelayUs <u8 >) -> Adc <stm32:: $adc_type, Disabled > {
1710
+ fn claim( self , cs: ClockSource , rcc: & Rcc , delay: & mut impl DelayUs <u8 >, reset : bool ) -> Adc <stm32:: $adc_type, Disabled > {
1705
1711
unsafe {
1706
1712
let rcc_ptr = & ( * stm32:: RCC :: ptr( ) ) ;
1707
1713
stm32:: $adc_type:: enable( rcc_ptr) ;
1708
- stm32:: $adc_type:: reset( rcc_ptr) ;
1714
+ if reset { stm32:: $adc_type:: reset( rcc_ptr) ; }
1709
1715
}
1710
1716
Self :: configure_clock_source( cs, rcc) ;
1711
1717
@@ -1725,8 +1731,8 @@ macro_rules! adc {
1725
1731
1726
1732
/// claims and configures the Adc
1727
1733
#[ inline( always) ]
1728
- fn claim_and_configure( self , cs: ClockSource , rcc: & Rcc , config: config:: AdcConfig , delay: & mut impl DelayUs <u8 >) -> Adc <stm32:: $adc_type, Configured > {
1729
- let mut adc = self . claim( cs, rcc, delay) ;
1734
+ fn claim_and_configure( self , cs: ClockSource , rcc: & Rcc , config: config:: AdcConfig , delay: & mut impl DelayUs <u8 >, reset : bool ) -> Adc <stm32:: $adc_type, Configured > {
1735
+ let mut adc = self . claim( cs, rcc, delay, reset ) ;
1730
1736
adc. adc. config = config;
1731
1737
1732
1738
// If the user specified a VDDA, use that over the internally determined value.
0 commit comments