Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: TS_DISCO_F746NG LCD_DISCO_F746NG BSP_DISCO_F746NG BUTTON_GROUP
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:
-
iTimeMS Integration time aGain Gain addr I2C address *theWire Wire 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:
-
r Red value g Green value b Blue 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:
-
r Red value g Green value b Blue 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:
-
x Base number y Exponent
- Returns:
- x raised to the power of y
Enables the device Disables the device (putting it in lower power sleep mode)
- Parameters:
-
en Enable (True/False)
Definition at line 70 of file Adafruit_APDS9960.cpp.
| void enableColor | ( | boolean | en = true ) |
Enable color readings on APDS9960.
- Parameters:
-
en Enable (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:
-
en Enable (True/False)
Definition at line 370 of file Adafruit_APDS9960.cpp.
| void enableProximity | ( | boolean | en = true ) |
Enable proximity readings on APDS9960.
- Parameters:
-
en Enable (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 | ( | ) |
| 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:
-
*r Red value *g Green value *b Blue value *c Clear 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 | ( | ) |
| 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:
-
aGain Gain
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:
-
iTimeMS Integration time
Definition at line 138 of file Adafruit_APDS9960.cpp.
| void setGestureDimensions | ( | uint8_t | dims ) |
Sets gesture dimensions.
- Parameters:
-
dims Dimensions (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:
-
thresh Threshold (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:
-
gain Gain (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_up Up offset offset_down Down offset offset_left Left offset offset_right Right offset
Definition at line 356 of file Adafruit_APDS9960.cpp.
| void setGestureProximityThreshold | ( | uint8_t | thresh ) |
Sets gesture sensor threshold.
- Parameters:
-
thresh Threshold
Definition at line 341 of file Adafruit_APDS9960.cpp.
| void setIntLimits | ( | uint16_t | low, |
| uint16_t | high | ||
| ) |
Sets interrupt limits.
- Parameters:
-
low Low limit high High 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:
-
drive LED Drive boost LED Boost
Definition at line 468 of file Adafruit_APDS9960.cpp.
| void setProxGain | ( | apds9960PGain_t | pGain ) |
Adjusts the Proximity gain on the APDS9960.
- Parameters:
-
pGain Gain
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:
-
low Low threshold high High threshold persistance Persistance
Definition at line 267 of file Adafruit_APDS9960.cpp.
| void setProxPulse | ( | apds9960PPulseLen_t | pLen, |
| uint8_t | pulses | ||
| ) |
Sets number of proxmity pulses.
- Parameters:
-
pLen Pulse Length pulses Number of pulses
Definition at line 217 of file Adafruit_APDS9960.cpp.
Generated on Fri Jul 22 2022 06:03:14 by
1.7.2