Contiki-NG
Loading...
Searching...
No Matches

Driver for the cc2538 ADC controller. More...

Files

file  arch/cpu/cc2538/dev/adc.c
 Implementation of the cc2538 ADC driver.
file  arch/cpu/cc2538/dev/adc.h
 Header file for the cc2538 ADC driver.

ADC functions

void adc_init (void)
 Initializes the ADC controller.
int16_t adc_get (uint8_t channel, uint8_t ref, uint8_t div)
 Performs a single conversion on a given ADC channel.

Detailed Description

Driver for the cc2538 ADC controller.

Function Documentation

◆ adc_get()

int16_t adc_get ( uint8_t channel,
uint8_t ref,
uint8_t div )

Performs a single conversion on a given ADC channel.

Parameters
channelThe channel used for the conversion: SOC_ADC_ADCCON_CH_x
refThe reference voltage used for the conversion: SOC_ADC_ADCCON_REF_x
divThe decimation rate used for the conversion: SOC_ADC_ADCCON_DIV_x
Returns
Signed 16-bit conversion result: 2's complement, ENOBs in MSBs
Note
PD[5:4] are not usable when the temperature sensor is selected.

< Temperature sensor

< Test register 0

< Test register 0

< Connect temperature sensor to ADC

< Analog test control

< Analog test control

< Controls the analog test mode

< Analog test mode: enable temperature sensor

< ADC Control 3

< ADC Control 3

< Reference voltage for extra

< Decimation rate for extra

< Single channel select

< ADC Control 1

< End of conversion

< ADC Result, least significant part

< ADC Result, most significant part

< Temperature sensor

< Analog test control

< Test register 0

Definition at line 57 of file adc.c.

References CCTEST_TR0, CCTEST_TR0_ADCTM, RFCORE_XREG_ATEST, RFCORE_XREG_ATEST_ATEST_CTRL, RFCORE_XREG_ATEST_ATEST_CTRL_TEMP, SOC_ADC_ADCCON1, SOC_ADC_ADCCON1_EOC, SOC_ADC_ADCCON3, SOC_ADC_ADCCON3_ECH, SOC_ADC_ADCCON3_EDIV, SOC_ADC_ADCCON3_EREF, SOC_ADC_ADCCON_CH_TEMP, SOC_ADC_ADCH, and SOC_ADC_ADCL.

Referenced by value().

◆ adc_init()

void adc_init ( void )

Initializes the ADC controller.

< ADC Control 1

< Start select

Definition at line 50 of file adc.c.

References SOC_ADC_ADCCON1, and SOC_ADC_ADCCON1_STSEL.

Referenced by configure(), and platform_init_stage_three().