Skip to content

Commit

Permalink
Fix code example in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jannic committed Jan 3, 2024
1 parent da4a415 commit abcb4c6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions rp2040-hal/src/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,8 @@
//! let mut adc = Adc::new(peripherals.ADC, &mut peripherals.RESETS);
//! // Configure one of the pins as an ADC input
//! let mut adc_pin_0 = AdcPin::new(pins.gpio26.into_floating_input()).unwrap();
//! // Read at least once to configure ADC channel and trigger first conversion
//! let _: u16 = adc.read(&mut adc_pin_0).unwrap();
//! // Enable free-running mode
//! adc.free_running(true);
//! adc.free_running(&adc_pin_0);
//! // Read the ADC counts from the ADC channel whenever necessary
//! loop {
//! let pin_adc_counts: u16 = adc.read_single();
Expand Down Expand Up @@ -373,7 +371,7 @@ impl Adc {
}

/// Enable free-running mode by setting the start_many flag.
pub fn free_running<T: AnyPin>(&mut self, pin: &mut AdcPin<T>) {
pub fn free_running<T: AnyPin>(&mut self, pin: &AdcPin<T>) {
self.device
.cs
.modify(|_, w| w.ainsel().variant(pin.channel()).start_many().set_bit());
Expand Down

0 comments on commit abcb4c6

Please sign in to comment.