Skip to content

Commit 1a9cd22

Browse files
author
Brandon Matthews
committed
Fix doc tests for ADC module
1 parent 40c121c commit 1a9cd22

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/adc.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ use nb;
1818
/// struct Analog(()); // marker type to denote a pin in "analog" mode
1919
///
2020
/// // GPIO 1 pin 1 can supply an ADC channel when it is configured in Analog mode
21-
/// impl Channel for Gpio1Pin1<Analog> {
21+
/// impl Channel<Adc1> for Gpio1Pin1<Analog> {
2222
/// type ID = u8; // ADC channels are identified numerically
2323
///
24-
/// const CHANNEL: u8 = 7; // GPIO pin 1 is connected to ADC channel 7
24+
/// fn channel() -> u8 { 7_u8 } // GPIO pin 1 is connected to ADC channel 7
2525
/// }
2626
///
2727
/// struct Adc2; // ADC with two banks of 16 channels
2828
/// struct Gpio2PinA<MODE>(PhantomData<MODE>);
2929
/// struct AltFun(()); // marker type to denote some alternate function mode for the pin
3030
///
3131
/// // GPIO 2 pin A can supply an ADC channel when it's configured in some alternate function mode
32-
/// impl Channel for Gpio2PinA<AltFun> {
32+
/// impl Channel<Adc2> for Gpio2PinA<AltFun> {
3333
/// type ID = (u8, u8); // ADC channels are identified by bank number and channel number
3434
///
35-
/// const CHANNEL: (u8, u8) = (0, 3);
35+
/// fn channel() -> (u8, u8) { (0, 3) } // bank 0 channel 3
3636
/// }
3737
/// ```
3838
#[cfg(feature = "unproven")]
@@ -72,12 +72,12 @@ pub trait Channel<ADC> {
7272
/// impl<WORD, PIN> OneShot<MyAdc, WORD, PIN> for MyAdc
7373
/// where
7474
/// WORD: From<u16>,
75-
/// PIN: Channel<ID=u8>,
75+
/// PIN: Channel<MyAdc, ID=u8>,
7676
/// {
7777
/// type Error = ();
7878
///
7979
/// fn read(&mut self, _pin: &mut PIN) -> nb::Result<WORD, Self::Error> {
80-
/// let chan = 1 << PIN::CHANNEL;
80+
/// let chan = 1 << PIN::channel();
8181
/// self.power_up();
8282
/// let result = self.do_conversion(chan);
8383
/// self.power_down();

0 commit comments

Comments
 (0)