libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
f0/adc.h File Reference
Include dependency graph for f0/adc.h:

Go to the source code of this file.

Macros

#define ADC   ADC_BASE
 
#define ADC1   ADC_BASE/* for API compatibility */
 
#define ADC1_ISR   ADC_ISR(ADC)
 
#define ADC1_IER   ADC_IER(ADC)
 
#define ADC1_CR   ADC_CR(ADC)
 
#define ADC1_CFGR1   ADC_CFGR1(ADC)
 
#define ADC1_CFGR2   ADC_CFGR2(ADC)
 
#define ADC1_SMPR1   ADC_SMPR1(ADC)
 
#define ADC_SMPR(adc)   ADC_SMPR1(adc) /* Compatibility */
 
#define ADC1_SMPR   ADC_SMPR1(ADC) /* Compatibility */
 
#define ADC1_TR1   ADC_TR1(ADC)
 
#define ADC_TR(adc)   ADC_TR1(adc) /* Compatibility */
 
#define ADC1_TR   ADC1_TR(ADC) /* Compatibility */
 
#define ADC1_CHSELR   ADC_CHSELR(ADC)
 
#define ADC1_DR   ADC_DR(ADC)
 
#define ADC1_CCR   ADC_CCR(ADC)
 
#define ADC_CFGR1_ALIGN   (1 << 5)
 ALIGN: Data alignment. More...
 
#define ADC_CFGR1_EXTSEL_SHIFT   6
 
#define ADC_CFGR1_EXTSEL_MASK   0x7
 
#define ADC_CFGR1_EXTSEL_TIM1_TRGO   0x0
 
#define ADC_CFGR1_EXTSEL_TIM1_CC4   0x1
 
#define ADC_CFGR1_EXTSEL_TIM2_TRGO   0x2
 
#define ADC_CFGR1_EXTSEL_TIM3_TRGO   0x3
 
#define ADC_CFGR1_EXTSEL_TIM15_TRGO   0x4
 
#define ADC_CFGR2_CKMODE_SHIFT   30
 
#define ADC_CFGR2_CKMODE   (3 << ADC_CFGR2_CKMODE_SHIFT)
 
#define ADC_CFGR2_CKMODE_CK_ADC   (0 << ADC_CFGR2_CKMODE_SHIFT)
 
#define ADC_CFGR2_CKMODE_PCLK_DIV2   (1 << ADC_CFGR2_CKMODE_SHIFT)
 
#define ADC_CFGR2_CKMODE_PCLK_DIV4   (2 << ADC_CFGR2_CKMODE_SHIFT)
 
#define ADC_SMPR_SMP_SHIFT   0
 
#define ADC_SMPR_SMP   (7 << ADC_SMPR_SMP_SHIFT)
 
#define ADC_SMPR_SMP_001DOT5   (0 << ADC_SMPR_SMP_SHIFT)
 
#define ADC_SMPR_SMP_007DOT5   (1 << ADC_SMPR_SMP_SHIFT)
 
#define ADC_SMPR_SMP_013DOT5   (2 << ADC_SMPR_SMP_SHIFT)
 
#define ADC_SMPR_SMP_028DOT5   (3 << ADC_SMPR_SMP_SHIFT)
 
#define ADC_SMPR_SMP_041DOT5   (4 << ADC_SMPR_SMP_SHIFT)
 
#define ADC_SMPR_SMP_055DOT5   (5 << ADC_SMPR_SMP_SHIFT)
 
#define ADC_SMPR_SMP_071DOT5   (6 << ADC_SMPR_SMP_SHIFT)
 
#define ADC_SMPR_SMP_239DOT5   (7 << ADC_SMPR_SMP_SHIFT)
 
#define ADC_RESOLUTION_12BIT   ADC_CFGR1_RES_12_BIT
 
#define ADC_RESOLUTION_10BIT   ADC_CFGR1_RES_10_BIT
 
#define ADC_RESOLUTION_8BIT   ADC_CFGR1_RES_8_BIT
 
#define ADC_RESOLUTION_6BIT   ADC_CFGR1_RES_6_BIT
 
#define ADC_SMPTIME_001DOT5   ADC_SMPR_SMP_001DOT5
 
#define ADC_SMPTIME_007DOT5   ADC_SMPR_SMP_007DOT5
 
#define ADC_SMPTIME_013DOT5   ADC_SMPR_SMP_013DOT5
 
#define ADC_SMPTIME_028DOT5   ADC_SMPR_SMP_028DOT5
 
#define ADC_SMPTIME_041DOT5   ADC_SMPR_SMP_041DOT5
 
#define ADC_SMPTIME_055DOT5   ADC_SMPR_SMP_055DOT5
 
#define ADC_SMPTIME_071DOT5   ADC_SMPR_SMP_071DOT5
 
#define ADC_SMPTIME_239DOT5   ADC_SMPR_SMP_239DOT5
 
#define ADC_CLKSOURCE_ADC   ADC_CFGR2_CKMODE_CK_ADC
 
#define ADC_CLKSOURCE_PCLK_DIV2   ADC_CFGR2_CKMODE_PCLK_DIV2
 
#define ADC_CLKSOURCE_PCLK_DIV4   ADC_CFGR2_CKMODE_PCLK_DIV4
 
#define ADC_CHANNEL_TEMP   16
 
#define ADC_CHANNEL_VREF   17
 
#define ADC_CHANNEL_VBAT   18
 

Enumerations

enum  adc_opmode { ADC_MODE_SEQUENTIAL , ADC_MODE_SCAN , ADC_MODE_SCAN_INFINITE }
 

Functions

void adc_enable_discontinuous_mode (uint32_t adc)
 ADC Enable Discontinuous Mode for Regular Conversions. More...
 
void adc_disable_discontinuous_mode (uint32_t adc)
 ADC Disable Discontinuous Mode for Regular Conversions. More...
 
void adc_set_operation_mode (uint32_t adc, enum adc_opmode opmode)
 ADC Set operation mode. More...
 
void adc_enable_external_trigger_regular (uint32_t adc, uint32_t trigger, uint32_t polarity)
 ADC Enable an External Trigger for Regular Channels. More...
 
void adc_disable_external_trigger_regular (uint32_t adc)
 ADC Disable an External Trigger for Regular Channels. More...
 
void adc_enable_watchdog_interrupt (uint32_t adc)
 ADC Enable Analog Watchdog Interrupt. More...
 
void adc_disable_watchdog_interrupt (uint32_t adc)
 ADC Disable Regular End-Of-Conversion Interrupt. More...
 
bool adc_get_watchdog_flag (uint32_t adc)
 ADC Read the Analog Watchdog Flag. More...
 
void adc_clear_watchdog_flag (uint32_t adc)
 ADC Clear Analog Watchdog Flag. More...
 
void adc_enable_eoc_sequence_interrupt (uint32_t adc)
 ADC Enable Regular End-Of-Conversion Sequence Interrupt. More...
 
void adc_disable_eoc_sequence_interrupt (uint32_t adc)
 ADC Disable Regular End-Of-Conversion Sequence Interrupt. More...
 
bool adc_get_eoc_sequence_flag (uint32_t adc)
 ADC Read the Regular End-Of-Conversion Sequence Flag. More...
 
void adc_clear_eoc_sequence_flag (uint32_t adc)
 ADC Clear Regular End-Of-Conversion Sequence Flag. More...
 
void adc_set_clk_source (uint32_t adc, uint32_t source)
 ADC Set Clock Source. 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) LIBOPENCM3_DEPRECATED("see adc_calibrate/_async")
 ADC Start the calibration procedure. More...
 
void adc_calibrate_wait_finish (uint32_t adc) LIBOPENCM3_DEPRECATED("see adc_is_calibrating")
 ADC Wait to finish the ADC calibration procedure. More...
 
void adc_enable_analog_watchdog_on_all_channels (uint32_t adc)
 ADC Enable Analog Watchdog for All Channels. More...
 
void adc_enable_analog_watchdog_on_selected_channel (uint32_t adc, uint8_t chan)
 ADC Enable Analog Watchdog for a Selected Channel. More...
 
void adc_disable_analog_watchdog (uint32_t adc)
 ADC Disable Analog Watchdog. More...
 
void adc_set_watchdog_high_threshold (uint32_t adc, uint16_t threshold)
 ADC Set Analog Watchdog Upper Threshold. More...
 
void adc_set_watchdog_low_threshold (uint32_t adc, uint16_t threshold)
 ADC Set Analog Watchdog Lower Threshold. More...
 

Macro Definition Documentation

◆ ADC1_CCR

#define ADC1_CCR   ADC_CCR(ADC)

Definition at line 68 of file f0/adc.h.

◆ ADC1_CFGR1

#define ADC1_CFGR1   ADC_CFGR1(ADC)

Definition at line 58 of file f0/adc.h.

◆ ADC1_CFGR2

#define ADC1_CFGR2   ADC_CFGR2(ADC)

Definition at line 59 of file f0/adc.h.

◆ ADC1_CHSELR

#define ADC1_CHSELR   ADC_CHSELR(ADC)

Definition at line 66 of file f0/adc.h.

◆ ADC1_CR

#define ADC1_CR   ADC_CR(ADC)

Definition at line 57 of file f0/adc.h.

◆ ADC1_DR

#define ADC1_DR   ADC_DR(ADC)

Definition at line 67 of file f0/adc.h.

◆ ADC1_IER

#define ADC1_IER   ADC_IER(ADC)

Definition at line 56 of file f0/adc.h.

◆ ADC1_ISR

#define ADC1_ISR   ADC_ISR(ADC)

Definition at line 55 of file f0/adc.h.

◆ ADC1_SMPR

#define ADC1_SMPR   ADC_SMPR1(ADC) /* Compatibility */

Definition at line 62 of file f0/adc.h.

◆ ADC1_SMPR1

#define ADC1_SMPR1   ADC_SMPR1(ADC)

Definition at line 60 of file f0/adc.h.

◆ ADC1_TR

#define ADC1_TR   ADC1_TR(ADC) /* Compatibility */

Definition at line 65 of file f0/adc.h.

◆ ADC1_TR1

#define ADC1_TR1   ADC_TR1(ADC)

Definition at line 63 of file f0/adc.h.

◆ ADC_CFGR1_ALIGN

#define ADC_CFGR1_ALIGN   (1 << 5)

ALIGN: Data alignment.

Definition at line 77 of file f0/adc.h.

◆ ADC_CFGR1_EXTSEL_MASK

#define ADC_CFGR1_EXTSEL_MASK   0x7

Definition at line 81 of file f0/adc.h.

◆ ADC_CFGR1_EXTSEL_SHIFT

#define ADC_CFGR1_EXTSEL_SHIFT   6

Definition at line 80 of file f0/adc.h.

◆ ADC_CFGR2_CKMODE

#define ADC_CFGR2_CKMODE   (3 << ADC_CFGR2_CKMODE_SHIFT)

Definition at line 94 of file f0/adc.h.

◆ ADC_CFGR2_CKMODE_CK_ADC

#define ADC_CFGR2_CKMODE_CK_ADC   (0 << ADC_CFGR2_CKMODE_SHIFT)

Definition at line 95 of file f0/adc.h.

◆ ADC_CFGR2_CKMODE_PCLK_DIV2

#define ADC_CFGR2_CKMODE_PCLK_DIV2   (1 << ADC_CFGR2_CKMODE_SHIFT)

Definition at line 96 of file f0/adc.h.

◆ ADC_CFGR2_CKMODE_PCLK_DIV4

#define ADC_CFGR2_CKMODE_PCLK_DIV4   (2 << ADC_CFGR2_CKMODE_SHIFT)

Definition at line 97 of file f0/adc.h.

◆ ADC_CFGR2_CKMODE_SHIFT

#define ADC_CFGR2_CKMODE_SHIFT   30

Definition at line 93 of file f0/adc.h.

◆ ADC_SMPR

#define ADC_SMPR (   adc)    ADC_SMPR1(adc) /* Compatibility */

Definition at line 61 of file f0/adc.h.

◆ ADC_SMPR_SMP

#define ADC_SMPR_SMP   (7 << ADC_SMPR_SMP_SHIFT)

Definition at line 102 of file f0/adc.h.

◆ ADC_SMPR_SMP_001DOT5

#define ADC_SMPR_SMP_001DOT5   (0 << ADC_SMPR_SMP_SHIFT)

Definition at line 103 of file f0/adc.h.

◆ ADC_SMPR_SMP_007DOT5

#define ADC_SMPR_SMP_007DOT5   (1 << ADC_SMPR_SMP_SHIFT)

Definition at line 104 of file f0/adc.h.

◆ ADC_SMPR_SMP_013DOT5

#define ADC_SMPR_SMP_013DOT5   (2 << ADC_SMPR_SMP_SHIFT)

Definition at line 105 of file f0/adc.h.

◆ ADC_SMPR_SMP_028DOT5

#define ADC_SMPR_SMP_028DOT5   (3 << ADC_SMPR_SMP_SHIFT)

Definition at line 106 of file f0/adc.h.

◆ ADC_SMPR_SMP_041DOT5

#define ADC_SMPR_SMP_041DOT5   (4 << ADC_SMPR_SMP_SHIFT)

Definition at line 107 of file f0/adc.h.

◆ ADC_SMPR_SMP_055DOT5

#define ADC_SMPR_SMP_055DOT5   (5 << ADC_SMPR_SMP_SHIFT)

Definition at line 108 of file f0/adc.h.

◆ ADC_SMPR_SMP_071DOT5

#define ADC_SMPR_SMP_071DOT5   (6 << ADC_SMPR_SMP_SHIFT)

Definition at line 109 of file f0/adc.h.

◆ ADC_SMPR_SMP_239DOT5

#define ADC_SMPR_SMP_239DOT5   (7 << ADC_SMPR_SMP_SHIFT)

Definition at line 110 of file f0/adc.h.

◆ ADC_SMPR_SMP_SHIFT

#define ADC_SMPR_SMP_SHIFT   0

Definition at line 101 of file f0/adc.h.

◆ ADC_TR

#define ADC_TR (   adc)    ADC_TR1(adc) /* Compatibility */

Definition at line 64 of file f0/adc.h.