Sensorian  1.0
C API Reference Guide Library
APDS9300.c File Reference

APDS9300 driver. More...

#include "APDS9300.h"
#include "i2c.h"
#include "math.h"

Go to the source code of this file.

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...
 
void APDS9300_WriteByte (unsigned char data)
 Writes a single byte of data to the current sensor register. Function assumes that I2C peripheral is preconfigured. More...
 
void APDS9300_WriteRegister (unsigned char reg, unsigned char data)
 Writes a byte to the specific register. More...
 
void APDS9300_WriteWord (unsigned char reg, unsigned int data)
 Writes a word to the specific register. More...
 
char APDS9300_ReadByte (char reg)
 Reads a single byte from the given sensor register. More...
 
unsigned int APDS9300_ReadWordReg (char reg)
 Read word from register. More...
 
unsigned int APDS9300_ReadWord (void)
 Read a single word from the sensor. Assumes register pointer is preset. More...
 

Detailed Description

APDS9300 driver.

Author
D.Qendri
Date
28 Oct 2014

Definition in file APDS9300.c.

Function Documentation

char APDS9300_ReadByte ( char  reg)

Reads a single byte from the given sensor register.

Parameters
regAddress of sensor register
Returns
Val Value of sensor register

Definition at line 254 of file APDS9300.c.

unsigned int APDS9300_ReadWord ( void  )

Read a single word from the sensor. Assumes register pointer is preset.

Returns
value 16bit word read from the preset register

Definition at line 273 of file APDS9300.c.

unsigned int APDS9300_ReadWordReg ( char  reg)

Read word from register.

Parameters
regRegister address
Returns
val 16bit word content of register

Definition at line 264 of file APDS9300.c.

void APDS9300_WriteByte ( unsigned char  data)

Writes a single byte of data to the current sensor register. Function assumes that I2C peripheral is preconfigured.

Parameters
dataData byte to write to the pointer reg.
Returns
none

Definition at line 219 of file APDS9300.c.

void APDS9300_WriteRegister ( unsigned char  reg,
unsigned char  data 
)

Writes a byte to the specific register.

Parameters
regAddress of sensor register
dataValue to be written on the sensor register.
Returns
none

Definition at line 230 of file APDS9300.c.

void APDS9300_WriteWord ( unsigned char  reg,
unsigned int  data 
)

Writes a word to the specific register.

Parameters
regAddress of sensor register
data16 bit data to be written on the sensor register.
Returns
none

Definition at line 241 of file APDS9300.c.