libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy::Apds9960< Transport > Class Template Reference

Device support for APDS9960 gesture / RGB / proximity sensor. More...

Detailed Description

template<typename Transport>
class daisy::Apds9960< Transport >

Device support for APDS9960 gesture / RGB / proximity sensor.

Author
beserge
Date
December 2021

#include <apds9960.h>

Classes

struct  Config
 

Public Types

enum  Result { OK = 0 , ERR }
 

Public Member Functions

 Apds9960 ()
 
 ~Apds9960 ()
 
void enable (bool en=true)
 
Result Init (Config config)
 
void SetADCIntegrationTime (uint16_t iTimeMS)
 
float GetADCIntegrationTime ()
 
void SetADCGain (uint8_t aGain)
 
void SetGestureOffset (uint8_t offset_up, uint8_t offset_down, uint8_t offset_left, uint8_t offset_right)
 
void SetGestureDimensions (uint8_t dims)
 
void SetGestureFIFOThreshold (uint8_t thresh)
 
void SetGestureGain (uint8_t gain)
 
void SetGestureProximityThreshold (uint8_t thresh)
 
void Enable (bool en)
 
void EnableGesture (bool en)
 
void EnableProximity (bool en)
 
void EnableColor (bool en)
 
void SetColorInterrupt (bool en)
 
void SetProximityInterrupt (bool en)
 
void ClearInterrupt ()
 
void ResetCounts ()
 
void Write8 (uint8_t reg, uint8_t data)
 
uint8_t Read8 (uint8_t reg)
 
uint16_t Read16R (uint8_t reg)
 
uint8_t ReadProximity ()
 
void SetProxGain (uint8_t pGain)
 
uint8_t GetProxGain ()
 
void SetProxPulse (uint8_t pLen, uint8_t pulses)
 
bool GestureValid ()
 
uint8_t ReadGesture ()
 
void SetLED (uint8_t drive, uint8_t boost)
 
uint16_t CalculateColorTemperature (uint16_t r, uint16_t g, uint16_t b)
 
uint16_t CalculateLux (uint16_t r, uint16_t g, uint16_t b)
 
void SetIntLimits (uint16_t low, uint16_t high)
 
bool ColorDataReady ()
 
uint16_t GetColorDataRed ()
 
uint16_t GetColorDataGreen ()
 
uint16_t GetColorDataBlue ()
 
uint16_t GetColorDataClear ()
 
void GetColorData (uint16_t *r, uint16_t *g, uint16_t *b, uint16_t *c)
 

Member Enumeration Documentation

◆ Result

Enumerator
OK 
ERR 

Constructor & Destructor Documentation

◆ Apds9960()

template<typename Transport >
daisy::Apds9960< Transport >::Apds9960 ( )
inline

◆ ~Apds9960()

template<typename Transport >
daisy::Apds9960< Transport >::~Apds9960 ( )
inline

Member Function Documentation

◆ CalculateColorTemperature()

template<typename Transport >
uint16_t daisy::Apds9960< Transport >::CalculateColorTemperature ( uint16_t  r,
uint16_t  g,
uint16_t  b 
)
inline

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

Parameters
rRed value
gGreen value
bBlue value
Returns
Color temperature

◆ CalculateLux()

template<typename Transport >
uint16_t daisy::Apds9960< Transport >::CalculateLux ( uint16_t  r,
uint16_t  g,
uint16_t  b 
)
inline

Calculate ambient light values

Parameters
rRed value
gGreen value
bBlue value
Returns
LUX value

◆ ClearInterrupt()

template<typename Transport >
void daisy::Apds9960< Transport >::ClearInterrupt ( )
inline

Clears interrupt

◆ ColorDataReady()

template<typename Transport >
bool daisy::Apds9960< Transport >::ColorDataReady ( )
inline

Returns status of color data

Returns
True if color data ready, False otherwise

◆ Enable()

template<typename Transport >
void daisy::Apds9960< Transport >::Enable ( bool  en)
inline

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

Parameters
enEnable

◆ enable()

template<typename Transport >
void daisy::Apds9960< Transport >::enable ( bool  en = true)

◆ EnableColor()

template<typename Transport >
void daisy::Apds9960< Transport >::EnableColor ( bool  en)
inline

Enable color readings

Parameters
enEnable

◆ EnableGesture()

template<typename Transport >
void daisy::Apds9960< Transport >::EnableGesture ( bool  en)
inline

Enable gesture readings

Parameters
enEnable

◆ EnableProximity()

template<typename Transport >
void daisy::Apds9960< Transport >::EnableProximity ( bool  en)
inline

Enable proximity readings

Parameters
enEnable

◆ GestureValid()

template<typename Transport >
bool daisy::Apds9960< Transport >::GestureValid ( )
inline

Returns validity status of a gesture

Returns
Status (True/False)

◆ GetADCIntegrationTime()

template<typename Transport >
float daisy::Apds9960< Transport >::GetADCIntegrationTime ( )
inline

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

Returns
Integration time

◆ GetColorData()

template<typename Transport >
void daisy::Apds9960< Transport >::GetColorData ( uint16_t r,
uint16_t g,
uint16_t b,
uint16_t c 
)
inline

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

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

◆ GetColorDataBlue()

template<typename Transport >
uint16_t daisy::Apds9960< Transport >::GetColorDataBlue ( )
inline

Reads the raw blue channel value

Returns
Blue channel value

◆ GetColorDataClear()

template<typename Transport >
uint16_t daisy::Apds9960< Transport >::GetColorDataClear ( )
inline

Reads the raw clear channel value

Returns
Clear channel value

◆ GetColorDataGreen()

template<typename Transport >
uint16_t daisy::Apds9960< Transport >::GetColorDataGreen ( )
inline

Reads the raw green channel value

Returns
Green channel value

◆ GetColorDataRed()

template<typename Transport >
uint16_t daisy::Apds9960< Transport >::GetColorDataRed ( )
inline

Reads the raw red channel value

Returns
Red channel value

◆ GetProxGain()

template<typename Transport >
uint8_t daisy::Apds9960< Transport >::GetProxGain ( )
inline

Returns the Proximity gain on the APDS9960

Returns
Proxmity gain

◆ Init()

template<typename Transport >
Result daisy::Apds9960< Transport >::Init ( Config  config)
inline

Initialize the APDS9960 device

Parameters
configConfiguration settings

◆ Read16R()

template<typename Transport >
uint16_t daisy::Apds9960< Transport >::Read16R ( uint8_t  reg)
inline

◆ Read8()

template<typename Transport >
uint8_t daisy::Apds9960< Transport >::Read8 ( uint8_t  reg)
inline

◆ ReadGesture()

template<typename Transport >
uint8_t daisy::Apds9960< Transport >::ReadGesture ( )
inline

Reads gesture

Returns
Received gesture (1,4) -> {UP, DOWN, LEFT, RIGHT}

< Gesture Up

< Gesture Down

< Gesture Left

< Gesture Right

◆ ReadProximity()

template<typename Transport >
uint8_t daisy::Apds9960< Transport >::ReadProximity ( )
inline

Read proximity data

Returns
Proximity

◆ ResetCounts()

template<typename Transport >
void daisy::Apds9960< Transport >::ResetCounts ( )
inline

Resets gesture counts

◆ SetADCGain()

template<typename Transport >
void daisy::Apds9960< Transport >::SetADCGain ( uint8_t  aGain)
inline

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

Parameters
aGainGain

◆ SetADCIntegrationTime()

template<typename Transport >
void daisy::Apds9960< Transport >::SetADCIntegrationTime ( uint16_t  iTimeMS)
inline

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

Parameters
iTimeMSIntegration time

◆ SetColorInterrupt()

template<typename Transport >
void daisy::Apds9960< Transport >::SetColorInterrupt ( bool  en)
inline

Enables/disables color interrupt

Parameters
enEnable / disable

◆ SetGestureDimensions()

template<typename Transport >
void daisy::Apds9960< Transport >::SetGestureDimensions ( uint8_t  dims)
inline

Sets gesture dimensions

Parameters
dimsDimensions

◆ SetGestureFIFOThreshold()

template<typename Transport >
void daisy::Apds9960< Transport >::SetGestureFIFOThreshold ( uint8_t  thresh)
inline

Sets gesture FIFO Threshold

Parameters
threshThreshold

◆ SetGestureGain()

template<typename Transport >
void daisy::Apds9960< Transport >::SetGestureGain ( uint8_t  gain)
inline

Sets gesture sensor gain

Parameters
gainGain

◆ SetGestureOffset()

template<typename Transport >
void daisy::Apds9960< Transport >::SetGestureOffset ( uint8_t  offset_up,
uint8_t  offset_down,
uint8_t  offset_left,
uint8_t  offset_right 
)
inline

Sets gesture sensor offset

Parameters
offset_upUp offset
offset_downDown offset
offset_leftLeft offset
offset_rightRight offset

◆ SetGestureProximityThreshold()

template<typename Transport >
void daisy::Apds9960< Transport >::SetGestureProximityThreshold ( uint8_t  thresh)
inline

Sets gesture sensor threshold

Parameters
threshThreshold

◆ SetIntLimits()

template<typename Transport >
void daisy::Apds9960< Transport >::SetIntLimits ( uint16_t  low,
uint16_t  high 
)
inline

Sets interrupt limits

Parameters
lowLow limit
highHigh limit

◆ SetLED()

template<typename Transport >
void daisy::Apds9960< Transport >::SetLED ( uint8_t  drive,
uint8_t  boost 
)
inline

Set LED brightness for proximity/gesture

Parameters
driveLED Drive (0,3) -> {100mA, 50mA, 25mA, 12.5mA}
boostLED Boost (0,3) -> {100%, 150%, 200%, 300%}

◆ SetProxGain()

template<typename Transport >
void daisy::Apds9960< Transport >::SetProxGain ( uint8_t  pGain)
inline

Adjusts the Proximity gain on the APDS9960

Parameters
pGainGain

◆ SetProximityInterrupt()

template<typename Transport >
void daisy::Apds9960< Transport >::SetProximityInterrupt ( bool  en)
inline

Enables / Disables color interrupt

Parameters
enEnable / disable

◆ SetProxPulse()

template<typename Transport >
void daisy::Apds9960< Transport >::SetProxPulse ( uint8_t  pLen,
uint8_t  pulses 
)
inline

Sets number of proxmity pulses

Parameters
pLenPulse Length
pulsesNumber of pulses

◆ Write8()

template<typename Transport >
void daisy::Apds9960< Transport >::Write8 ( uint8_t  reg,
uint8_t  data 
)
inline

The documentation for this class was generated from the following file: