Sebastien Luzy / Mbed OS Code_capteur-APDS9960_ecran-STM32F746G-DISCO

Dependencies:   TS_DISCO_F746NG LCD_DISCO_F746NG BSP_DISCO_F746NG BUTTON_GROUP

Embed: (wiki syntax)

« Back to documentation index

Adafruit_APDS9960 Class Reference

Adafruit_APDS9960 Class Reference

Class that stores state and functions for interacting with APDS9960 Sensor. More...

#include <Adafruit_APDS9960.h>

Public Member Functions

boolean begin (I2C *theWire, uint16_t iTimeMS=10, apds9960AGain_t=APDS9960_AGAIN_4X, uint8_t addr=APDS9960_ADDRESS)
 Initializes I2C and configures the sensor.
void setADCIntegrationTime (uint16_t iTimeMS)
 Sets the integration time for the ADC of the APDS9960, in millis.
float getADCIntegrationTime ()
 Returns the integration time for the ADC of the APDS9960, in millis.
void setADCGain (apds9960AGain_t gain)
 Adjusts the color/ALS gain on the APDS9960 (adjusts the sensitivity to light)
apds9960AGain_t getADCGain ()
 Returns the ADC gain.
void setLED (apds9960LedDrive_t drive, apds9960LedBoost_t boost)
 Set LED brightness for proximity/gesture.
void enableProximity (boolean en=true)
 Enable proximity readings on APDS9960.
void setProxGain (apds9960PGain_t gain)
 Adjusts the Proximity gain on the APDS9960.
apds9960PGain_t getProxGain ()
 Returns the Proximity gain on the APDS9960.
void setProxPulse (apds9960PPulseLen_t pLen, uint8_t pulses)
 Sets number of proxmity pulses.
void enableProximityInterrupt ()
 Enable proximity interrupts.
void disableProximityInterrupt ()
 Disable proximity interrupts.
uint8_t readProximity ()
 Read proximity data.
void setProximityInterruptThreshold (uint8_t low, uint8_t high, uint8_t persistance=4)
 Set proxmity interrupt thresholds.
bool getProximityInterrupt ()
 Returns proxmity interrupt status.
void enableGesture (boolean en=true)
 Enable gesture readings on APDS9960.
bool gestureValid ()
 Returns validity status of a gesture.
void setGestureDimensions (uint8_t dims)
 Sets gesture dimensions.
void setGestureFIFOThreshold (uint8_t thresh)
 Sets gesture FIFO Threshold.
void setGestureGain (uint8_t gain)
 Sets gesture sensor gain.
void setGestureProximityThreshold (uint8_t thresh)
 Sets gesture sensor threshold.
void setGestureOffset (uint8_t offset_up, uint8_t offset_down, uint8_t offset_left, uint8_t offset_right)
 Sets gesture sensor offset.
uint8_t readGesture ()
 Reads gesture.
void resetCounts ()
 Resets gesture counts.
void enableColor (boolean en=true)
 Enable color readings on APDS9960.
bool colorDataReady ()
 Returns status of color data.
void getColorData (uint16_t *r, uint16_t *g, uint16_t *b, uint16_t *c)
 Reads the raw red, green, blue and clear channel values.
uint16_t calculateColorTemperature (uint16_t r, uint16_t g, uint16_t b)
 Converts the raw R/G/B values to color temperature in degrees Kelvin.
uint16_t calculateLux (uint16_t r, uint16_t g, uint16_t b)
 Calculate ambient light values.
void enableColorInterrupt ()
 Enables color interrupt.
void disableColorInterrupt ()
 Disables color interrupt.
void clearInterrupt ()
 Clears interrupt.
void setIntLimits (uint16_t l, uint16_t h)
 Sets interrupt limits.
void enable (boolean en=true)
 Implements missing powf function.

Detailed Description

Class that stores state and functions for interacting with APDS9960 Sensor.

Definition at line 176 of file Adafruit_APDS9960.h.


Member Function Documentation

boolean begin ( I2C *  theWire,
uint16_t  iTimeMS = 10,
apds9960AGain_t  aGain = APDS9960_AGAIN_4X,
uint8_t  addr = APDS9960_ADDRESS 
)

Initializes I2C and configures the sensor.

Parameters:
iTimeMSIntegration time
aGainGain
addrI2C address
*theWireWire object
Returns:
True if initialization was successful, otherwise false.

Definition at line 87 of file Adafruit_APDS9960.cpp.

uint16_t calculateColorTemperature ( uint16_t  r,
uint16_t  g,
uint16_t  b 
)

Converts the raw R/G/B values to color temperature in degrees Kelvin.

Parameters:
rRed value
gGreen value
bBlue value
Returns:
Color temperature

Definition at line 527 of file Adafruit_APDS9960.cpp.

uint16_t calculateLux ( uint16_t  r,
uint16_t  g,
uint16_t  b 
)

Calculate ambient light values.

Parameters:
rRed value
gGreen value
bBlue value
Returns:
LUX value

Definition at line 567 of file Adafruit_APDS9960.cpp.

void clearInterrupt (  )

Clears interrupt.

Definition at line 596 of file Adafruit_APDS9960.cpp.

bool colorDataReady (  )

Returns status of color data.

Returns:
True if color data ready, False otherwise

Definition at line 492 of file Adafruit_APDS9960.cpp.

void disableColorInterrupt (  )

Disables color interrupt.

Definition at line 588 of file Adafruit_APDS9960.cpp.

void disableProximityInterrupt (  )

Disable proximity interrupts.

Definition at line 253 of file Adafruit_APDS9960.cpp.

void enable ( boolean  en = true )

Implements missing powf function.

Parameters:
xBase number
yExponent
Returns:
x raised to the power of y

Enables the device Disables the device (putting it in lower power sleep mode)

Parameters:
enEnable (True/False)

Definition at line 70 of file Adafruit_APDS9960.cpp.

void enableColor ( boolean  en = true )

Enable color readings on APDS9960.

Parameters:
enEnable (True/False)

Definition at line 483 of file Adafruit_APDS9960.cpp.

void enableColorInterrupt (  )

Enables color interrupt.

Definition at line 580 of file Adafruit_APDS9960.cpp.

void enableGesture ( boolean  en = true )

Enable gesture readings on APDS9960.

Parameters:
enEnable (True/False)

Definition at line 370 of file Adafruit_APDS9960.cpp.

void enableProximity ( boolean  en = true )

Enable proximity readings on APDS9960.

Parameters:
enEnable (True/False)

Definition at line 235 of file Adafruit_APDS9960.cpp.

void enableProximityInterrupt (  )

Enable proximity interrupts.

Definition at line 244 of file Adafruit_APDS9960.cpp.

bool gestureValid (  )

Returns validity status of a gesture.

Returns:
Status (True/False)

Definition at line 298 of file Adafruit_APDS9960.cpp.

apds9960AGain_t getADCGain (  )

Returns the ADC gain.

Returns:
ADC gain

Definition at line 186 of file Adafruit_APDS9960.cpp.

float getADCIntegrationTime (  )

Returns the integration time for the ADC of the APDS9960, in millis.

Returns:
Integration time

Definition at line 158 of file Adafruit_APDS9960.cpp.

void getColorData ( uint16_t *  r,
uint16_t *  g,
uint16_t *  b,
uint16_t *  c 
)

Reads the raw red, green, blue and clear channel values.

Parameters:
*rRed value
*gGreen value
*bBlue value
*cClear channel value

Definition at line 508 of file Adafruit_APDS9960.cpp.

apds9960PGain_t getProxGain (  )

Returns the Proximity gain on the APDS9960.

Returns:
Proxmity gain

Definition at line 206 of file Adafruit_APDS9960.cpp.

bool getProximityInterrupt (  )

Returns proxmity interrupt status.

Returns:
True if enabled, false otherwise.

Definition at line 283 of file Adafruit_APDS9960.cpp.

uint8_t readGesture (  )

Reads gesture.

Returns:
Received gesture (APDS9960_DOWN APDS9960_UP, APDS9960_LEFT APDS9960_RIGHT)

Definition at line 396 of file Adafruit_APDS9960.cpp.

uint8_t readProximity (  )

Read proximity data.

Returns:
Proximity

Definition at line 292 of file Adafruit_APDS9960.cpp.

void resetCounts (  )

Resets gesture counts.

Definition at line 383 of file Adafruit_APDS9960.cpp.

void setADCGain ( apds9960AGain_t  aGain )

Adjusts the color/ALS gain on the APDS9960 (adjusts the sensitivity to light)

Parameters:
aGainGain

Definition at line 175 of file Adafruit_APDS9960.cpp.

void setADCIntegrationTime ( uint16_t  iTimeMS )

Sets the integration time for the ADC of the APDS9960, in millis.

Parameters:
iTimeMSIntegration time

Definition at line 138 of file Adafruit_APDS9960.cpp.

void setGestureDimensions ( uint8_t  dims )

Sets gesture dimensions.

Parameters:
dimsDimensions (APDS9960_DIMENSIONS_ALL, APDS9960_DIMENSIONS_UP_DOWM, APDS9960_DIMENSIONS_UP_DOWN, APGS9960_DIMENSIONS_LEFT_RIGHT)

Definition at line 309 of file Adafruit_APDS9960.cpp.

void setGestureFIFOThreshold ( uint8_t  thresh )

Sets gesture FIFO Threshold.

Parameters:
threshThreshold (APDS9960_GFIFO_1, APDS9960_GFIFO_4, APDS9960_GFIFO_8, APDS9960_GFIFO_16)

Definition at line 320 of file Adafruit_APDS9960.cpp.

void setGestureGain ( uint8_t  gain )

Sets gesture sensor gain.

Parameters:
gainGain (APDS9960_GAIN_1, APDS9960_GAIN_2, APDS9960_GAIN_4, APDS9960_GAIN_8)

Definition at line 331 of file Adafruit_APDS9960.cpp.

void setGestureOffset ( uint8_t  offset_up,
uint8_t  offset_down,
uint8_t  offset_left,
uint8_t  offset_right 
)

Sets gesture sensor offset.

Parameters:
offset_upUp offset
offset_downDown offset
offset_leftLeft offset
offset_rightRight offset

Definition at line 356 of file Adafruit_APDS9960.cpp.

void setGestureProximityThreshold ( uint8_t  thresh )

Sets gesture sensor threshold.

Parameters:
threshThreshold

Definition at line 341 of file Adafruit_APDS9960.cpp.

void setIntLimits ( uint16_t  low,
uint16_t  high 
)

Sets interrupt limits.

Parameters:
lowLow limit
highHigh limit

Definition at line 607 of file Adafruit_APDS9960.cpp.

void setLED ( apds9960LedDrive_t  drive,
apds9960LedBoost_t  boost 
)

Set LED brightness for proximity/gesture.

Parameters:
driveLED Drive
boostLED Boost

Definition at line 468 of file Adafruit_APDS9960.cpp.

void setProxGain ( apds9960PGain_t  pGain )

Adjusts the Proximity gain on the APDS9960.

Parameters:
pGainGain

Definition at line 195 of file Adafruit_APDS9960.cpp.

void setProximityInterruptThreshold ( uint8_t  low,
uint8_t  high,
uint8_t  persistance = 4 
)

Set proxmity interrupt thresholds.

Parameters:
lowLow threshold
highHigh threshold
persistancePersistance

Definition at line 267 of file Adafruit_APDS9960.cpp.

void setProxPulse ( apds9960PPulseLen_t  pLen,
uint8_t  pulses 
)

Sets number of proxmity pulses.

Parameters:
pLenPulse Length
pulsesNumber of pulses

Definition at line 217 of file Adafruit_APDS9960.cpp.