APM:Libraries
|
Analog-to-Digital Conversion (ADC) header. More...
Go to the source code of this file.
Classes | |
struct | adc_dev |
Macros | |
#define | ADC_Channel_0 ((uint8_t)0x00) |
#define | ADC_Channel_1 ((uint8_t)0x01) |
#define | ADC_Channel_2 ((uint8_t)0x02) |
#define | ADC_Channel_3 ((uint8_t)0x03) |
#define | ADC_Channel_4 ((uint8_t)0x04) |
#define | ADC_Channel_5 ((uint8_t)0x05) |
#define | ADC_Channel_6 ((uint8_t)0x06) |
#define | ADC_Channel_7 ((uint8_t)0x07) |
#define | ADC_Channel_8 ((uint8_t)0x08) |
#define | ADC_Channel_9 ((uint8_t)0x09) |
#define | ADC_Channel_10 ((uint8_t)0x0A) |
#define | ADC_Channel_11 ((uint8_t)0x0B) |
#define | ADC_Channel_12 ((uint8_t)0x0C) |
#define | ADC_Channel_13 ((uint8_t)0x0D) |
#define | ADC_Channel_14 ((uint8_t)0x0E) |
#define | ADC_Channel_15 ((uint8_t)0x0F) |
#define | ADC_Channel_16 ((uint8_t)0x10) |
#define | ADC_Channel_17 ((uint8_t)0x11) |
#define | ADC_Channel_18 ((uint8_t)0x12) |
#define | ADC_Channel_TempSensor ((uint8_t)ADC_Channel_16) |
#define | ADC_Channel_Vrefint ((uint8_t)ADC_Channel_17) |
#define | ADC_Channel_Vbat ((uint8_t)ADC_Channel_18) |
#define | ADC_SampleTime_3Cycles ((uint8_t)0x00) |
#define | ADC_SampleTime_15Cycles ((uint8_t)0x01) |
#define | ADC_SampleTime_28Cycles ((uint8_t)0x02) |
#define | ADC_SampleTime_56Cycles ((uint8_t)0x03) |
#define | ADC_SampleTime_84Cycles ((uint8_t)0x04) |
#define | ADC_SampleTime_112Cycles ((uint8_t)0x05) |
#define | ADC_SampleTime_144Cycles ((uint8_t)0x06) |
#define | ADC_SampleTime_480Cycles ((uint8_t)0x07) |
#define | SMPR_SMP_SET ((uint32_t)0x00000007) |
#define | SQR_SQ_SET ((uint32_t)0x0000001F) |
#define | SQR1_L_RESET ((uint32_t)0xFE0FFFFF) |
Typedefs | |
typedef struct adc_dev | adc_dev |
Functions | |
void | adc_init (const adc_dev *dev) |
Initialize an ADC peripheral. More... | |
void | adc_foreach (void(*fn)(const adc_dev *)) |
Call a function on all ADC devices. More... | |
uint16_t | adc_read (const adc_dev *dev, uint8_t channel) |
uint16_t | vref_read (void) |
uint16_t | temp_read (void) |
static void | adc_set_reg_seqlen (const adc_dev *dev, uint8_t length) |
Set the regular channel sequence length. More... | |
static void | adc_channel_config (const adc_dev *dev, uint8_t channel, uint8_t rank, uint8_t sampleTime) |
static void | adc_enable (const adc_dev *dev) |
Enable an adc peripheral. More... | |
static void | adc_disable (const adc_dev *dev) |
Disable an ADC peripheral. More... | |
static void | adc_disable_all (void) |
Disable all ADC peripherals. More... | |
static void | adc_start_conv (const adc_dev *dev) |
static void | adc_vref_enable () |
static void | adc_vref_disable () |
Variables | |
const adc_dev *const | _ADC1 |
const adc_dev *const | _ADC2 |
const adc_dev *const | _ADC3 |
const adc_dev | _adc1 |
const adc_dev | _adc2 |
const adc_dev | _adc3 |
Analog-to-Digital Conversion (ADC) header.
Definition in file adc.h.
#define ADC_Channel_16 ((uint8_t)0x10) |
Definition at line 46 of file adc.h.
Referenced by adc_init().
#define ADC_Channel_17 ((uint8_t)0x11) |
Definition at line 47 of file adc.h.
Referenced by adc_init(), and F4Light::AnalogSource::setup_read().
#define ADC_Channel_9 ((uint8_t)0x09) |
Definition at line 39 of file adc.h.
Referenced by adc_channel_config().
#define ADC_Channel_TempSensor ((uint8_t)ADC_Channel_16) |
#define ADC_Channel_Vbat ((uint8_t)ADC_Channel_18) |
#define ADC_Channel_Vrefint ((uint8_t)ADC_Channel_17) |
#define ADC_SampleTime_56Cycles ((uint8_t)0x03) |
Definition at line 57 of file adc.h.
Referenced by adc_init().
#define ADC_SampleTime_84Cycles ((uint8_t)0x04) |
Definition at line 58 of file adc.h.
Referenced by adc_init(), and F4Light::AnalogSource::setup_read().
#define SMPR_SMP_SET ((uint32_t)0x00000007) |
Definition at line 63 of file adc.h.
Referenced by adc_channel_config().
#define SQR1_L_RESET ((uint32_t)0xFE0FFFFF) |
Definition at line 65 of file adc.h.
Referenced by adc_set_reg_seqlen().
#define SQR_SQ_SET ((uint32_t)0x0000001F) |
Definition at line 64 of file adc.h.
Referenced by adc_channel_config().
|
inlinestatic |
Definition at line 104 of file adc.h.
Referenced by adc_init(), and F4Light::AnalogSource::setup_read().
|
inlinestatic |
Disable an ADC peripheral.
dev | ADC device to disable |
Definition at line 141 of file adc.h.
Referenced by adc_disable_all(), adc_init(), and F4Light::AnalogSource::stop_read().
|
inlinestatic |
|
inlinestatic |
Enable an adc peripheral.
dev | ADC device to enable |
Definition at line 131 of file adc.h.
Referenced by adc_init(), F4Light::AnalogSource::set_pin(), and F4Light::AnalogSource::setup_read().
void adc_foreach | ( | void(*)(const adc_dev *) | fn | ) |
Call a function on all ADC devices.
fn | Function to call on each ADC device. |
Definition at line 41 of file adc.c.
Referenced by adc_disable_all().
void adc_init | ( | const adc_dev * | dev | ) |
Initialize an ADC peripheral.
Initializes the RCC clock line for the given peripheral. Resets ADC device registers.
dev | ADC peripheral to initialize |
Definition at line 56 of file adc.c.
Referenced by F4Light::AnalogSource::set_pin().
uint16_t adc_read | ( | const adc_dev * | dev, |
uint8_t | channel | ||
) |
|
inlinestatic |
Set the regular channel sequence length.
Defines the total number of conversions in the regular channel conversion sequence.
dev | ADC device. |
length | Regular channel sequence length, from 1 to 16. |
Definition at line 86 of file adc.h.
Referenced by adc_init(), and F4Light::AnalogSource::setup_read().
|
inlinestatic |
Definition at line 152 of file adc.h.
Referenced by F4Light::AnalogIn::_timer_event().
|
inlinestatic |
Definition at line 163 of file adc.h.
Referenced by F4Light::AnalogSource::stop_read().
|
inlinestatic |
Definition at line 158 of file adc.h.
Referenced by F4Light::AnalogSource::setup_read().
uint16_t temp_read | ( | void | ) |
uint16_t vref_read | ( | void | ) |
const adc_dev* const _ADC1 |
ADC1 device.
Definition at line 20 of file adc.c.
Referenced by F4Light::AnalogSource::_find_device().