40 #include "sys/clock.h"
44 #include "dev/adc-sensor.h"
48 #define ADC_ALS_PWR_PORT_BASE GPIO_PORT_TO_BASE(ADC_ALS_PWR_PORT)
49 #define ADC_ALS_PWR_PIN_MASK GPIO_PIN_MASK(ADC_ALS_PWR_PIN)
50 #define ADC_ALS_OUT_PIN_MASK GPIO_PIN_MASK(ADC_ALS_OUT_PIN)
67 GPIO_SET_PIN(ADC_ALS_PWR_PORT_BASE, ADC_ALS_PWR_PIN_MASK);
77 GPIO_CLR_PIN(ADC_ALS_PWR_PORT_BASE, ADC_ALS_PWR_PIN_MASK);
84 configure(
int type,
int value)
90 GPIO_CLR_PIN(ADC_ALS_PWR_PORT_BASE, ADC_ALS_PWR_PIN_MASK);
109 SENSORS_SENSOR(adc_sensor, ADC_SENSOR, value, configure, status);
#define GPIO_A_NUM
GPIO_A: 0.
#define IOC_OVERRIDE_ANA
Analog Enable.
#define ADC_ALS_PWR_PIN
ALS power GPIO control pin.
#define GPIO_A_BASE
GPIO_A.
void clock_delay_usec(uint16_t dt)
Delay a given number of microseconds.
#define ADC_ALS_OUT_PIN
ALS output ADC input pin on port A.
Header file with register and macro declarations for the cc2538 GPIO module.
#define ADC_SENSOR_VDD_3
On-chip VDD / 3.
#define SOC_ADC_ADCCON_REF_INT
Internal reference.
#define GPIO_CLR_PIN(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE low.
void ioc_set_over(uint8_t port, uint8_t pin, uint8_t over)
Set Port:Pin override function.
#define GPIO_SET_INPUT(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE to input.
Header file with declarations for the I/O Control module.
#define SOC_ADC_ADCCON_DIV_512
512 decimation rate (12 bits ENOB)
#define SOC_ADC_ADCCON_CH_VDD_3
VDD/3.
#define IOC_OVERRIDE_DIS
Override Disabled.
#define GPIO_SOFTWARE_CONTROL(PORT_BASE, PIN_MASK)
Configure the pin to be software controlled with PIN_MASK of port with PORT_BASE. ...
#define GPIO_SET_OUTPUT(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE to output.
#define ADC_SENSOR_TEMP
On-chip temperature.
#define ADC_ALS_PWR_PORT
ALS power GPIO control port.
#define SOC_ADC_ADCCON_CH_AIN0
AIN0.
int16_t adc_get(uint8_t channel, uint8_t ref, uint8_t div)
Performs a single conversion on a given ADC channel.
#define GPIO_SET_PIN(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE high.
void adc_init(void)
Initializes the ADC controller.
#define ADC_SENSOR_ALS
Ambient light sensor.
#define SOC_ADC_ADCCON_CH_TEMP
Temperature sensor.