From abcb4c60cdad7be8a1107da26e77e7f4bbf7816d Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Wed, 3 Jan 2024 18:08:54 +0000 Subject: [PATCH] Fix code example in docs --- rp2040-hal/src/adc.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rp2040-hal/src/adc.rs b/rp2040-hal/src/adc.rs index 1e0a6a3e5..cc9691e77 100644 --- a/rp2040-hal/src/adc.rs +++ b/rp2040-hal/src/adc.rs @@ -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(); @@ -373,7 +371,7 @@ impl Adc { } /// Enable free-running mode by setting the start_many flag. - pub fn free_running(&mut self, pin: &mut AdcPin) { + pub fn free_running(&mut self, pin: &AdcPin) { self.device .cs .modify(|_, w| w.ainsel().variant(pin.channel()).start_many().set_bit());