Appiko
Macros | Enumerations | Functions
Simple ADC driver

A simple driver for the SAADC unit to get ADC values. The spec of this module are: 12 bit resolution, internal reference of 0.6 V, single ended conversion, input impedance of upto 100k Ohm and a blocking class for the conversion period of 12 us. More...

Macros

#define SIMPLE_ADC_CHANNEL_USED   SAADC_CHANNEL_USED_SIMPLE_ADC
 

Enumerations

enum  simple_adc_input_t
 Input selection for the analog-to-digital converter.
 
enum  simple_adc_gain_t {
  SIMPLE_ADC_GAIN1_6 = SAADC_CH_CONFIG_GAIN_Gain1_6, SIMPLE_ADC_GAIN1_5 = SAADC_CH_CONFIG_GAIN_Gain1_5, SIMPLE_ADC_GAIN1_4 = SAADC_CH_CONFIG_GAIN_Gain1_4, SIMPLE_ADC_GAIN1_3 = SAADC_CH_CONFIG_GAIN_Gain1_3,
  SIMPLE_ADC_GAIN1_2 = SAADC_CH_CONFIG_GAIN_Gain1_2, SIMPLE_ADC_GAIN1 = SAADC_CH_CONFIG_GAIN_Gain1, SIMPLE_ADC_GAIN2 = SAADC_CH_CONFIG_GAIN_Gain2, SIMPLE_ADC_GAIN4 = SAADC_CH_CONFIG_GAIN_Gain4
}
 Gain factor of the ADC input source. More...
 

Functions

uint32_t simple_adc_get_value (simple_adc_gain_t gain, simple_adc_input_t pin)
 This function initializes the SAADC peripheral, gets an ADC value and then deinitializes The function blocks for about 13 us for the ADC sampling to occur. More...
 

Detailed Description

Macro Definition Documentation

◆ SIMPLE_ADC_CHANNEL_USED

#define SIMPLE_ADC_CHANNEL_USED   SAADC_CHANNEL_USED_SIMPLE_ADC

To assign default SAADC channel to this module if nothing is mentioned

Definition at line 47 of file simple_adc.h.

Enumeration Type Documentation

◆ simple_adc_gain_t

Enumerator
SIMPLE_ADC_GAIN1_6 

Gain factor 1/6.

SIMPLE_ADC_GAIN1_5 

Gain factor 1/5.

SIMPLE_ADC_GAIN1_4 

Gain factor 1/4.

SIMPLE_ADC_GAIN1_3 

Gain factor 1/3.

SIMPLE_ADC_GAIN1_2 

Gain factor 1/2.

SIMPLE_ADC_GAIN1 

Gain factor 1.

SIMPLE_ADC_GAIN2 

Gain factor 2.

SIMPLE_ADC_GAIN4 

Gain factor 4.

Definition at line 68 of file simple_adc.h.

Function Documentation

◆ simple_adc_get_value()

uint32_t simple_adc_get_value ( simple_adc_gain_t  gain,
simple_adc_input_t  pin 
)
Parameters
gainThe gain applied to the analog input to the ADC unit
pinThe pin at which the analog sample needs to be converted to digital
Warning
There are only a few pins that can be used with the ADC peripheral, check in the datasheet
Returns
The converted digital value of the analog signal

Definition at line 25 of file simple_adc.c.

Referenced by aa_aaa_battery_status(), led_sense_get(), oper_manage_check_update(), and rc_test().