48#include "px_adc_cfg.h"
51#if ( !defined(PX_ADC_CFG_ADC1_EN ) \
52 || !defined(PX_ADC_CFG_CLK ) \
53 || !defined(PX_ADC_CFG_SAMPLE_TIME ) \
54 || !defined(PX_ADC_CFG_RES ) \
55 || !defined(PX_ADC_CFG_OVERSAMPLING ) \
56 || !defined(PX_ADC_CFG_OVERSAMPLING_SHIFT) )
57#error "One or more options not defined in 'px_adc_cfg.h'"
59#if (PX_ADC_CFG_ADC1_EN > 1)
60#error "PX_ADC_CFG_ADCx_EN must be 0 or 1"
64#define PX_ADC_CFG_PER_COUNT (PX_ADC_CFG_ADC1_EN)
65#if (PX_ADC_CFG_PER_COUNT == 0)
66#error "No peripherals enabled"
212#define PX_ADC_CH_TO_BITMASK(ch) ((uint32_t)1 << (ch))
struct px_adc_per_s * adc_per
ADC peripheral data.
px_adc_cfg_sample_time_t
Specify ADC sampling time.
px_adc_cfg_oversampling_shift_t
Specify ADC oversampling.
px_adc_cfg_oversampling_t
Specify ADC oversampling.
void px_adc_init(void)
Initialise ADC driver.
px_adc_nr_t
Specify ADC peripheral.
px_adc_cfg_res_t
Specify ADC resolution.
px_adc_ch_t
Specify ADC channel.
bool px_adc_close(px_adc_handle_t *handle)
Close specified device.
bool px_adc_open(px_adc_handle_t *handle, px_adc_nr_t adc_nr)
Open ADC peripheral using predefined (default) parameters.
px_adc_cfg_clk_t
Specify ADC peripheral clock source.
uint16_t px_adc_sample(px_adc_handle_t *handle, px_adc_ch_t ch)
Perform a single measurement on the specified ADC channel.
@ PX_ADC_CFG_SAMPLE_TIME_160_5
160.5 ADC clock cycles
@ PX_ADC_CFG_SAMPLE_TIME_3_5
3.5 ADC clock cycles
@ PX_ADC_CFG_SAMPLE_TIME_7_5
7.5 ADC clock cycles
@ PX_ADC_CFG_SAMPLE_TIME_1_5
1.5 ADC clock cycles
@ PX_ADC_CFG_SAMPLE_TIME_39_5
39.5 ADC clock cycles
@ PX_ADC_CFG_SAMPLE_TIME_19_5
19.5 ADC clock cycles
@ PX_ADC_CFG_SAMPLE_TIME_79_5
79.5 ADC clock cycles
@ PX_ADC_CFG_SAMPLE_TIME_12_5
12.5 ADC clock cycles
@ PX_ADC_CFG_OVERSAMPLING_SHIFT_4
Shift 4-bits.
@ PX_ADC_CFG_OVERSAMPLING_SHIFT_1
Shift 1-bit.
@ PX_ADC_CFG_OVERSAMPLING_SHIFT_8
Shift 8-bits.
@ PX_ADC_CFG_OVERSAMPLING_SHIFT_7
Shift 7-bits.
@ PX_ADC_CFG_OVERSAMPLING_SHIFT_2
Shift 2-bits.
@ PX_ADC_CFG_OVERSAMPLING_SHIFT_6
Shift 6-bits.
@ PX_ADC_CFG_OVERSAMPLING_SHIFT_5
Shift 5-bits.
@ PX_ADC_CFG_OVERSAMPLING_SHIFT_NONE
No shift.
@ PX_ADC_CFG_OVERSAMPLING_SHIFT_3
Shift 3-bits.
@ PX_ADC_CFG_OVERSAMPLING_64
64 x oversampling
@ PX_ADC_CFG_OVERSAMPLING_4
4 x oversampling
@ PX_ADC_CFG_OVERSAMPLING_8
8 x oversampling
@ PX_ADC_CFG_OVERSAMPLING_16
16 x oversampling
@ PX_ADC_CFG_OVERSAMPLING_2
2 x oversampling
@ PX_ADC_CFG_OVERSAMPLING_32
32 x oversampling
@ PX_ADC_CFG_OVERSAMPLING_256
256 x oversampling
@ PX_ADC_CFG_OVERSAMPLING_128
128 x oversampling
@ PX_ADC_CFG_OVERSAMPLING_NONE
No oversampling.
@ PX_ADC_CFG_RES_12_BITS
12-bit resolution
@ PX_ADC_CFG_RES_6_BITS
6-bit resolution
@ PX_ADC_CFG_RES_10_BITS
10-bit resolution
@ PX_ADC_CFG_RES_8_BITS
8-bit resolution
@ PX_ADC_CH0
ADC Channel 0.
@ PX_ADC_CH5
ADC Channel 5.
@ PX_ADC_CH15
ADC Channel 15.
@ PX_ADC_CH18
Temperature sensor (Tsense)
@ PX_ADC_CH3
ADC Channel 3.
@ PX_ADC_CH8
ADC Channel 8.
@ PX_ADC_CH1
ADC Channel 1.
@ PX_ADC_CH12
ADC Channel 12.
@ PX_ADC_CH10
ADC Channel 10.
@ PX_ADC_CH17
Internal Voltage Reference (Vrefint)
@ PX_ADC_CH2
ADC Channel 2.
@ PX_ADC_CH13
ADC Channel 13.
@ PX_ADC_CH11
ADC Channel 11.
@ PX_ADC_CH6
ADC Channel 6.
@ PX_ADC_CH7
ADC Channel 7.
@ PX_ADC_CH4
ADC Channel 4.
@ PX_ADC_CH9
ADC Channel 9.
@ PX_ADC_CH14
ADC Channel 14.
@ PX_ADC_CFG_CLK_PCLK_DIV2
Peripheral Clock / 2.
@ PX_ADC_CFG_CLK_PCLK
Peripheral Clock.
@ PX_ADC_CFG_CLK_PCLK_DIV4
Peripheral Clock / 4.