Sensorian  1.0
C API Reference Guide Library
Ambient Light Sensor

Functions

unsigned char AL_Initialize (void)
 Powers on the sensor , sets sensor gain to 1x and clears any existing interrupts. More...
 
void AL_PowerState (powerState state)
 Set the sensor power state to either POWER_ON or POWER_OFF. More...
 
unsigned char AL_ChipID (void)
 Returns the CHIP id. More...
 
unsigned int AL_ReadChannel (channel chan)
 Reads the value from one of the two photodiode channels. More...
 
float AL_Lux (unsigned int ch0, unsigned int ch1)
 Computes LUX ambient light value from sensor data. More...
 
unsigned char AL_SetGain (gain val)
 Set sensor gain. Default gain value is GAIN_1 or 1x. More...
 
void AL_SetSamplingTime (sampTime_t sampling_time)
 Sets the sampling time for the sensor,can be one of three predetermined values. More...
 
void AL_SetIntLowThreshold (unsigned int lowthreshvalue)
 Sets the low threshold value for the interrupt. More...
 
void AL_SetIntHighThreshold (unsigned int highthreshvalue)
 Sets the high threshold value for the interrupt. More...
 
void AL_Clear_Interrupt (void)
 Clear any existing interrupts. More...
 
void AL_ConfigureInterrupt (unsigned char enable, unsigned char persistence)
 Enables or disables the interrupt and sets the persistence of interrupt occurences The interrupt will fire after x occurences outside the threshold values Default values are interrupts enabled and interrupts enabled. More...
 

Detailed Description

These functions expose the capabilities of the APDS9300 ambient light sensor

Function Documentation

unsigned char AL_ChipID ( void  )

Returns the CHIP id.

Returns
partID Chip ID

Definition at line 65 of file APDS9300.c.

void AL_Clear_Interrupt ( void  )

Clear any existing interrupts.

Returns
none

Definition at line 183 of file APDS9300.c.

void AL_ConfigureInterrupt ( unsigned char  enable,
unsigned char  persistence 
)

Enables or disables the interrupt and sets the persistence of interrupt occurences The interrupt will fire after x occurences outside the threshold values Default values are interrupts enabled and interrupts enabled.

Parameters
enableEnables or disable interrupts 1/0 to enable/disable
persistenceValue from 0 to 16 for value 0 interrupts occur after every sample
Returns
none

Definition at line 196 of file APDS9300.c.

unsigned char AL_Initialize ( void  )

Powers on the sensor , sets sensor gain to 1x and clears any existing interrupts.

Returns
control Contents of control register

Definition at line 42 of file APDS9300.c.

float AL_Lux ( unsigned int  ch0,
unsigned int  ch1 
)

Computes LUX ambient light value from sensor data.

Parameters
ch0Channel 1 value
ch1Channel 2 value
Returns
Lux Float value of ambient light intensity.

Definition at line 103 of file APDS9300.c.

void AL_PowerState ( powerState  state)

Set the sensor power state to either POWER_ON or POWER_OFF.

Parameters
statePower state of the sensor.
Returns
none

Definition at line 54 of file APDS9300.c.

unsigned int AL_ReadChannel ( channel  chan)

Reads the value from one of the two photodiode channels.

Parameters
chanChannel id
Returns
channelValue 16 bit sensor data representing ambient light value on the corresponding channel spectrum.

Definition at line 77 of file APDS9300.c.

unsigned char AL_SetGain ( gain  val)

Set sensor gain. Default gain value is GAIN_1 or 1x.

Parameters
valGain type can be GAIN_1 or GAIN_16 for gain of 1x or 16x.
Returns
val Gain mode

Definition at line 126 of file APDS9300.c.

void AL_SetIntHighThreshold ( unsigned int  highthreshvalue)

Sets the high threshold value for the interrupt.

Parameters
highthreshvalueInterrupt high threshold value
Returns
none

Definition at line 174 of file APDS9300.c.

void AL_SetIntLowThreshold ( unsigned int  lowthreshvalue)

Sets the low threshold value for the interrupt.

Parameters
lowthreshvalueInterrupt low threshold value
Returns
none

Definition at line 164 of file APDS9300.c.

void AL_SetSamplingTime ( sampTime_t  sampling_time)

Sets the sampling time for the sensor,can be one of three predetermined values.

Parameters
sampling_timecan be 0x00,0x01,0x02
Returns
none

Definition at line 153 of file APDS9300.c.