Struct stm32f1xx_hal::adc::Adc

source ·
pub struct Adc<ADC> { /* private fields */ }
Expand description

ADC configuration

Implementations§

Temperature sensor is connected to channel 16 on ADC1. This sensor can be used to measure ambient temperature of the device. However note that the returned value is not an absolute temperature value.

In particular, according to section 11.10 from Reference Manual RM0008 Rev 20: “The temperature sensor output voltage changes linearly with temperature. The offset of this line varies from chip to chip due to process variation (up to 45 °C from one chip to another). The internal temperature sensor is more suited to applications that detect temperature variations instead of absolute temperatures. If accurate temperature readings are needed, an external temperature sensor part should be used.”

Formula to calculate temperature value is also taken from the section 11.10.

Internal reference voltage Vrefint is connected to channel 17 on ADC1. According to section 5.3.4 “Embedded reference voltage” from STM32F1xx datasheets, typical value of this reference voltage is 1200 mV.

This value is useful when ADC readings need to be converted into voltages. For instance, reading from any ADC channel can be converted into voltage (mV) using the following formula: v_chan = adc.read(chan) * 1200 / adc.read_vref()

Init a new Adc

Sets all configurable parameters to one-shot defaults, performs a boot-time calibration.

Save current ADC config

Restore saved ADC config

Reset the ADC config to default, return existing config

Set ADC sampling time

Options can be found in SampleTime.

Set the Adc result alignment

Options can be found in Align.

Returns the largest possible sample value for the current settings

Powers down the ADC, disables the ADC clock and releases the ADC Peripheral

Init a new Adc

Sets all configurable parameters to one-shot defaults, performs a boot-time calibration.

Save current ADC config

Restore saved ADC config

Reset the ADC config to default, return existing config

Set ADC sampling time

Options can be found in SampleTime.

Set the Adc result alignment

Options can be found in Align.

Returns the largest possible sample value for the current settings

Powers down the ADC, disables the ADC clock and releases the ADC Peripheral

Init a new Adc

Sets all configurable parameters to one-shot defaults, performs a boot-time calibration.

Save current ADC config

Restore saved ADC config

Reset the ADC config to default, return existing config

Set ADC sampling time

Options can be found in SampleTime.

Set the Adc result alignment

Options can be found in Align.

Returns the largest possible sample value for the current settings

Powers down the ADC, disables the ADC clock and releases the ADC Peripheral

Trait Implementations§

Set ADC sampling time for particular channel
ADC Set a Regular Channel Conversion Sequence Read more
Set ADC continuous conversion Read more
Set ADC discontinuous mode Read more
Set ADC sampling time for particular channel
ADC Set a Regular Channel Conversion Sequence Read more
Set ADC continuous conversion Read more
Set ADC discontinuous mode Read more
Set ADC sampling time for particular channel
ADC Set a Regular Channel Conversion Sequence Read more
Set ADC continuous conversion Read more
Set ADC discontinuous mode Read more
Error type returned by ADC methods
Request that the ADC begin a conversion on the specified pin Read more
Error type returned by ADC methods
Request that the ADC begin a conversion on the specified pin Read more
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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.