28 #ifndef __APDS9300_H__
29 #define __APDS9300_H__
37 #define APDS9300ADDR 0x29
42 #define THRESHLOWLOW 0x02
43 #define THRESHLOWHIGH 0x03
44 #define THRESHHIGHLOW 0x04
45 #define THRESHHIGHHIGH 0x05
46 #define INTERRUPT 0x06
50 #define DATA0HIGH 0x0D
52 #define DATA1HIGH 0x0F
58 #define CMD_CLEAR_INT 0x40
70 #define INTEG13_7MS 0x00
71 #define INTEG101MS 0x01
72 #define INTEG402MS 0x02
73 #define MANUAL_INTEG 0x03
77 #define INTERR_DISMASK 0xCF //INTR bits zero
78 #define INTERR_ENA 0x10 //Level interrupts
80 #define EVERYCYCLE 0x00
81 #define OUTSIDE_THRESH 0x01
82 #define PER2_OUT_RANGE 0x02
83 #define PER4_OUT_RANGE 0x04
84 #define PER10_OUT_RANGE 0x0A
85 #define PER15_OUT_RANGE 0x0F
113 float AL_Lux(
unsigned int ch0,
unsigned int ch1);
void AL_SetSamplingTime(sampTime_t sampling_time)
Sets the sampling time for the sensor,can be one of three predetermined values.
void APDS9300_WriteByte(unsigned char data)
Writes a single byte of data to the current sensor register. Function assumes that I2C peripheral is ...
void AL_SetIntHighThreshold(unsigned int highthreshvalue)
Sets the high threshold value for the interrupt.
unsigned int APDS9300_ReadWordReg(char reg)
Read word from register.
char APDS9300_ReadByte(char reg)
Reads a single byte from the given sensor register.
unsigned int APDS9300_ReadWord(void)
Read a single word from the sensor. Assumes register pointer is preset.
unsigned char AL_ChipID(void)
Returns the CHIP id.
void APDS9300_WriteWord(unsigned char reg, unsigned int data)
Writes a word to the specific register.
unsigned char AL_Initialize(void)
Powers on the sensor , sets sensor gain to 1x and clears any existing interrupts. ...
void AL_SetIntLowThreshold(unsigned int lowthreshvalue)
Sets the low threshold value for the interrupt.
unsigned char AL_SetGain(gain val)
Set sensor gain. Default gain value is GAIN_1 or 1x.
void AL_PowerState(powerState state)
Set the sensor power state to either POWER_ON or POWER_OFF.
void AL_ConfigureInterrupt(unsigned char enable, unsigned char persistence)
Enables or disables the interrupt and sets the persistence of interrupt occurences The interrupt will...
void AL_Clear_Interrupt(void)
Clear any existing interrupts.
void APDS9300_WriteRegister(unsigned char reg, unsigned char data)
Writes a byte to the specific register.
unsigned int AL_ReadChannel(channel chan)
Reads the value from one of the two photodiode channels.
float AL_Lux(unsigned int ch0, unsigned int ch1)
Computes LUX ambient light value from sensor data.