libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
ADC Basic configuration API

ADC Basic configuration API. More...

Collaboration diagram for ADC Basic configuration API:

Functions

void adc_set_clk_source (uint32_t adc, uint32_t source)
 ADC Set Clock Source. More...
 
void adc_set_regular_sequence (uint32_t adc, uint8_t length, uint8_t channel[])
 ADC Set a Regular Channel Conversion Sequence. More...
 
void adc_set_sample_time_on_all_channels (uint32_t adc, uint8_t time)
 ADC Set the Sample Time for All Channels. More...
 
void adc_enable_vbat_sensor (void)
 ADC Enable The VBat Sensor. More...
 
void adc_disable_vbat_sensor (void)
 ADC Disable The VBat Sensor. More...
 
void adc_calibrate_start (uint32_t adc)
 ADC Start the calibration procedure. More...
 
void adc_calibrate_wait_finish (uint32_t adc)
 ADC Wait to finish the ADC calibration procedure. More...
 

Detailed Description

ADC Basic configuration API.

Function Documentation

◆ adc_calibrate_start()

void adc_calibrate_start ( uint32_t  adc)

ADC Start the calibration procedure.

Deprecated:
Replaced by adc_calibrate/_async/is_calibrating
Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 410 of file adc.c.

References ADC_CR, and ADC_CR_ADCAL.

◆ adc_calibrate_wait_finish()

void adc_calibrate_wait_finish ( uint32_t  adc)

ADC Wait to finish the ADC calibration procedure.

Deprecated:
Replaced by adc_calibrate/_async/is_calibrating
Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 422 of file adc.c.

References ADC_CR, and ADC_CR_ADCAL.

◆ adc_disable_vbat_sensor()

void adc_disable_vbat_sensor ( void  )

ADC Disable The VBat Sensor.

Disabling this will reduce power consumption from the battery voltage measurement.

Definition at line 398 of file adc.c.

References ADC1, and ADC_CCR.

◆ adc_enable_vbat_sensor()

void adc_enable_vbat_sensor ( void  )

ADC Enable The VBat Sensor.

This enables the battery voltage measurements on channel 17.

Definition at line 386 of file adc.c.

References ADC1, ADC_CCR, and ADC_CCR_VBATEN.

◆ adc_set_clk_source()

void adc_set_clk_source ( uint32_t  adc,
uint32_t  source 
)

ADC Set Clock Source.

The ADC clock taken from the many sources.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)
[in]sourceUnsigned int32. Source (ADC clock source)

Definition at line 309 of file adc.c.

References ADC_CFGR2.

◆ adc_set_regular_sequence()

void adc_set_regular_sequence ( uint32_t  adc,
uint8_t  length,
uint8_t  channel[] 
)

ADC Set a Regular Channel Conversion Sequence.

Define a sequence of channels to be converted as a regular group with a length from 1 to 18 channels. If this is called during conversion, the current conversion is reset and conversion begins again with the newly defined group.

Warning
This core doesn't support the random order of ADC conversions. The channel list must be ordered by channel number.
Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)
[in]lengthUnsigned int8. Number of channels in the group.
[in]channelUnsigned int8[]. Set of channels to convert, integers 0..18.

Definition at line 331 of file adc.c.

References ADC_CFGR1, ADC_CFGR1_SCANDIR, ADC_CHSELR, and cm3_assert_not_reached.

◆ adc_set_sample_time_on_all_channels()

void adc_set_sample_time_on_all_channels ( uint32_t  adc,
uint8_t  time 
)

ADC Set the Sample Time for All Channels.

The sampling time can be selected in ADC clock cycles from 1.5 to 239.5, same for all channels.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)
[in]timeUnsigned int8. Sampling time selection (ADC sampling time)

Definition at line 375 of file adc.c.

References ADC_SMPR, and ADC_SMPR_SMP.