Struct stm32_hal2::adc::Adc[][src]

pub struct Adc<R> {
    pub regs: R,
    pub cfg: AdcConfig,
    // some fields omitted
}
Expand description

Represents an Analog to Digital Converter (ADC) peripheral.

Fields

regs: R

ADC Register

cfg: AdcConfig

Implementations

Initialize an ADC peripheral, including configuration register writes, and enabling and resetting its RCC peripheral clock.

Sets up adc in one shot mode for a single channel

Set the ADC conversion sequence length, between 1 and 16.

Set the alignment mode.

If any conversions are in progress, stop them. This is a step listed in the RMs for disable, and calibration procedures. See L4 RM: 16.4.17. When the ADSTP bit is set by software, any ongoing regular conversion is aborted with partial result discarded (ADC_DR register is not updated with the current conversion). When the JADSTP bit is set by software, any ongoing injected conversion is aborted with partial result discarded (ADC_JDRy register is not updated with the current conversion). The scan sequence is also aborted and reset (meaning that relaunching the ADC would restart a new sequence).

Check if the ADC is enabled.

Check if the ADC voltage regulator is enabled.

Enable the ADC voltage regulator, and exit deep sleep mode (some MCUs)

Disable power, eg to save power in low power modes. Inferred from RM, we should run this before entering STOP mode, in conjunction with with disabling the ADC.

Calibrate. See L4 RM, 16.5.8, or F404 RM, section 15.3.8. Stores calibration values, which can be re-inserted later, eg after entering ADC deep sleep mode, or MCU STANDBY or VBAT.

Insert a previously-saved calibration value into the ADC. Se L4 RM, 16.4.8.

Select single-ended, or differential conversions for a given channel.

Select a sequence to sample, by inputting a single channel and position.

Select the sample time for a given channel.

Convert a raw measurement into a voltage in Volts, using the calibrated VDDA. See RM0394, section 16.4.34

Start a conversion: Either a single measurement, or continuous conversions. See L4 RM 16.4.15 for details.

Read data from a conversion. In OneShot mode, this will generally be run right after start_conversion.

Take a single reading, in OneShot mode

Take a one shot reading, using DMA. See L44 RM, 16.4.27: “DMA one shot mode”. Note that the channel argument is only used on F3 and L4.

Enable a specific type of ADC interrupt.

Clear an interrupt flag of the specified type. Consider running this in the corresponding ISR.

Trait Implementations

Error type returned by ADC methods

Request that the ADC begin a conversion on the specified pin Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.