42 #include "lib/sensors.h" 49 #include <ti/drivers/ADC.h> 53 static ADC_Handle adc_handle;
58 ADC_Params adc_params;
59 ADC_Params_init(&adc_params);
61 adc_handle = ADC_open(Board_ADCALS, &adc_params);
62 if(adc_handle == NULL) {
70 config(
int type,
int enable)
77 gpio_hal_arch_pin_set_output(Board_ALS_PWR);
78 gpio_hal_arch_pin_set_input(Board_ALS_OUT);
81 gpio_hal_arch_set_pin(Board_ALS_PWR);
84 gpio_hal_arch_clear_pin(Board_ALS_PWR);
98 uint16_t adc_value = 0;
99 int_fast16_t res = ADC_convert(adc_handle, &adc_value);
100 if(res != ADC_STATUS_SUCCESS) {
104 return (
int)adc_value;
Header file for the SmartRF06 EB ALS sensor.
void clock_delay_usec(uint16_t dt)
Delay a given number of microseconds.
Timer library header file.
Header file for the GPIO HAL.
const struct sensors_sensor als_sensor
Exports a global symbol to be used by the sensor API.