Skip to content

Commit c9c5695

Browse files
committed
Update doc
1 parent 97fd4e4 commit c9c5695

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/observable.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@ pub trait Observable: Sized {
8282
/// be used instead of the peripheral to pass as arguments to other peripherals.
8383
///
8484
/// ```
85+
/// let cp = cortex_m::Peripherals::take().unwrap();
8586
/// let dp = stm32::Peripherals::take().unwrap();
8687
/// let mut rcc = dp.RCC.constrain();
8788
///
8889
/// let gpioa = dp.GPIOA.split(&mut rcc);
8990
///
90-
/// let (comp1, comp2, ..) = dp.COMP.split(&mut rcc);
91+
/// let (comp1, ..) = dp.COMP.split(&mut rcc);
9192
///
9293
/// let (pa1, [pa1_token]) = gpioa // <- The pin to keep track of
9394
/// .pa1
@@ -97,10 +98,10 @@ pub trait Observable: Sized {
9798
///
9899
/// // Only pa1_token and pa0 consumed here
99100
/// let comp1 = comp1.comparator(pa1_token, pa0, Config::default(), &rcc.clocks);
100-
/// let comp1 = comp1.enable();
101+
/// let _comp1 = comp1.enable(); // <-- TODO: Do things with comparator
101102
///
102103
/// let mut delay = cp.SYST.delay(&rcc.clocks);
103-
/// let mut adc = dp.ADC2.claim_and_configure(
104+
/// let mut adc = dp.ADC1.claim_and_configure(
104105
/// stm32g4xx_hal::adc::ClockSource::SystemClock,
105106
/// &rcc,
106107
/// stm32g4xx_hal::adc::config::AdcConfig::default(),
@@ -109,10 +110,9 @@ pub trait Observable: Sized {
109110
/// );
110111
///
111112
/// // Can not reconfigure pa1 here
112-
///
113113
/// loop {
114114
/// // Can still use pa1 here
115-
/// let sample = adc.convert(&pa1, SampleTime::Cycles_640_5);
115+
/// let sample = adc.convert(pa1.as_ref(), SampleTime::Cycles_640_5);
116116
/// defmt::info!("Reading: {}", sample);
117117
/// delay.delay(1000.millis());
118118
/// }

0 commit comments

Comments
 (0)