ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
APDS9999 Class Reference

A class for managing the Adafruit APDS9999 sensor. More...

#include <APDS9999.h>

Collaboration diagram for APDS9999:

Static Public Member Functions

static bool Initialize (uint8_t threshold)
 Initializes the APDS9999 sensor.
 
static bool isBooped ()
 Checks if the sensor is "booped" (close proximity detected).
 
static void ResetI2CBus ()
 Resets the I2C bus in case of communication issues.
 
static uint8_t GetValue ()
 Retrieves the current proximity value.
 
static uint16_t GetBrightness ()
 Retrieves the current brightness value.
 

Static Private Attributes

static Adafruit_APDS9999 apds
 Instance of the Adafruit APDS9999 sensor.
 
static uint16_t proximity
 Current proximity value.
 
static uint16_t threshold
 Threshold value for proximity detection.
 
static MinFilter< 10 > minF = MinFilter<10>(false)
 Minimum filter for smoothing proximity values.
 
static TimeStep timeStep = TimeStep(5)
 Time utility for managing timing intervals.
 
static float minimum = 0.0f
 Minimum detected value.
 
static bool didBegin = false
 Flag indicating if the sensor has been initialized.
 
static bool isBright = false
 Flag indicating if brightness detection is enabled.
 
static bool isProx = false
 Flag indicating if proximity detection is enabled.
 

Detailed Description

A class for managing the Adafruit APDS9999 sensor.

The APDS9999 class provides methods for initializing the sensor, detecting proximity and brightness, and determining if the sensor is close enough to trigger a "boop" detection.

Definition at line 27 of file APDS9999.h.

Member Function Documentation

◆ GetBrightness()

uint16_t GetBrightness ( )
static

Retrieves the current brightness value.

Returns
The current brightness value as a 16-bit integer.

Definition at line 91 of file APDS9999.cpp.

References apds, didBegin, and isBright.

◆ GetValue()

uint8_t GetValue ( )
static

Retrieves the current proximity value.

Returns
The current proximity value as an 8-bit integer.

Definition at line 66 of file APDS9999.cpp.

References apds, didBegin, isProx, proximity, and ResetI2CBus().

Referenced by isBooped().

◆ Initialize()

bool Initialize ( uint8_t  threshold)
static

Initializes the APDS9999 sensor.

Parameters
thresholdThe threshold for proximity detection.
Returns
True if initialization is successful, false otherwise.

Definition at line 14 of file APDS9999.cpp.

References apds, didBegin, and threshold.

Referenced by ProtogenProject::Initialize().

◆ isBooped()

bool isBooped ( )
static

Checks if the sensor is "booped" (close proximity detected).

Returns
True if the sensor is booped, false otherwise.

Definition at line 47 of file APDS9999.cpp.

References MinFilter< memory >::Filter(), GetValue(), TimeStep::IsReady(), minF, minimum, proximity, threshold, and timeStep.

Referenced by ProtogenProject::UpdateFace().

◆ ResetI2CBus()

void ResetI2CBus ( )
static

Resets the I2C bus in case of communication issues.

Definition at line 59 of file APDS9999.cpp.

Referenced by GetValue().

Member Data Documentation

◆ apds

Adafruit_APDS9999 apds
staticprivate

Instance of the Adafruit APDS9999 sensor.

Definition at line 29 of file APDS9999.h.

Referenced by GetBrightness(), GetValue(), and Initialize().

◆ didBegin

bool didBegin = false
staticprivate

Flag indicating if the sensor has been initialized.

Definition at line 35 of file APDS9999.h.

Referenced by GetBrightness(), GetValue(), and Initialize().

◆ isBright

bool isBright = false
staticprivate

Flag indicating if brightness detection is enabled.

Definition at line 36 of file APDS9999.h.

Referenced by GetBrightness().

◆ isProx

bool isProx = false
staticprivate

Flag indicating if proximity detection is enabled.

Definition at line 37 of file APDS9999.h.

Referenced by GetValue().

◆ minF

MinFilter< 10 > minF = MinFilter<10>(false)
staticprivate

Minimum filter for smoothing proximity values.

Definition at line 32 of file APDS9999.h.

Referenced by isBooped().

◆ minimum

float minimum = 0.0f
staticprivate

Minimum detected value.

Definition at line 34 of file APDS9999.h.

Referenced by isBooped().

◆ proximity

uint16_t proximity
staticprivate

Current proximity value.

Definition at line 30 of file APDS9999.h.

Referenced by GetValue(), and isBooped().

◆ threshold

uint16_t threshold
staticprivate

Threshold value for proximity detection.

Definition at line 31 of file APDS9999.h.

Referenced by Initialize(), and isBooped().

◆ timeStep

TimeStep timeStep = TimeStep(5)
staticprivate

Time utility for managing timing intervals.

Definition at line 33 of file APDS9999.h.

Referenced by isBooped().


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