![]() |
SparkFun Ambient Light Sensor - VEML7700
v2.0.0-1-g1693613
Library for the SparkFun Ambient Light Sensor - VEML7700
|
Driver class for the VEML7700 ambient light sensor. More...
#include <sfDevVEML7700.h>
Public Member Functions | |
sfDevVEML7700 () | |
sfTkError_t | begin (sfTkIBus *theBus=nullptr) |
Initializes the VEML7700 device on the specified bus. More... | |
bool | isConnected () |
Checks if the VEML7700 sensor is connected and responding. More... | |
sfTkError_t | setShutdown (bool) |
Sets the shutdown mode of the VEML7700 device. More... | |
sfTkError_t | powerOn (void) |
Powers on the VEML7700 device by clearing the shutdown mode. More... | |
sfTkError_t | shutdown (void) |
Puts the VEML7700 device into shutdown mode. More... | |
bool | isShutdown (void) |
Checks if the VEML7700 device is currently in shutdown mode. More... | |
sfTkError_t | enableInterrupt (bool) |
Enables or disables the interrupt functionality of the VEML7700 device. More... | |
bool | isInterruptEnabled (void) |
Checks if the interrupt feature is enabled on the VEML7700 device. More... | |
sfTkError_t | setPersistenceProtect (VEML7700_persistence_protect_t pp) |
Sets the persistence protection mode for the VEML7700 sensor. More... | |
sfTkError_t | getPersistenceProtect (VEML7700_persistence_protect_t &pp) |
Retrieves the current persistence protection setting from the VEML7700 sensor. More... | |
VEML7700_persistence_protect_t | persistenceProtect (void) |
Gets the current persistence protection setting of the VEML7700 sensor. More... | |
VEML7700_persistence_protect_t | getPersistenceProtect (void) |
Get the Persistence Protect object - this is for backward compatibility. More... | |
const char * | persistenceProtectString (void) |
Returns a string representation of the current persistence protection setting. More... | |
const char * | getPersistenceProtectStr (void) |
Get the Persistence Protect object - this is for backward compatibility. More... | |
sfTkError_t | setIntegrationTime (VEML7700_integration_time_t it) |
Sets the integration time for the VEML7700 sensor. More... | |
sfTkError_t | getIntegrationTime (VEML7700_integration_time_t &it) |
Retrieves the current integration time setting from the VEML7700 sensor. More... | |
VEML7700_integration_time_t | integrationTime (void) |
Gets the current integration time setting of the VEML7700 sensor. More... | |
VEML7700_integration_time_t | getIntegrationTime (void) |
Get the Integration Time object - this is for backward compatibility. More... | |
const char * | integrationTimeString (void) |
Returns a string representation of the current integration time setting. More... | |
const char * | getIntegrationTimeStr (void) |
Get the Integration Time string - this is for backward compatibility. More... | |
sfTkError_t | setSensitivityMode (VEML7700_sensitivity_mode_t sm) |
Sets the sensitivity mode for the VEML7700 sensor. More... | |
sfTkError_t | getSensitivityMode (VEML7700_sensitivity_mode_t &sm) |
Retrieves the current sensitivity mode setting from the VEML7700 sensor. More... | |
VEML7700_sensitivity_mode_t | sensitivityMode (void) |
Gets the current sensitivity mode setting of the VEML7700 sensor. More... | |
VEML7700_sensitivity_mode_t | getSensitivityMode (void) |
Get the Sensitivity Mode object - this is for backward compatibility. More... | |
const char * | sensitivityModeString (void) |
Returns a string representation of the current sensitivity mode setting. More... | |
const char * | getSensitivityModeStr (void) |
Get the Sensitivity Mode string - this is for backward compatibility. More... | |
sfTkError_t | setHighThreshold (uint16_t threshold) |
Sets the high threshold value for the VEML7700 sensor. More... | |
sfTkError_t | getHighThreshold (uint16_t &threshold) |
Retrieves the current high threshold value from the VEML7700 sensor. More... | |
uint16_t | highThreshold (void) |
Gets the current high threshold value of the VEML7700 sensor. More... | |
uint16_t | getHighThreshold (void) |
Get the High Threshold object - this is for backward compatibility. More... | |
sfTkError_t | setLowThreshold (uint16_t threshold) |
Sets the low threshold value for the VEML7700 sensor. More... | |
sfTkError_t | getLowThreshold (uint16_t &threshold) |
Retrieves the current low threshold value from the VEML7700 sensor. More... | |
uint16_t | lowThreshold (void) |
Gets the current low threshold value of the VEML7700 sensor. More... | |
uint16_t | getLowThreshold (void) |
Get the Low Threshold object - this is for backward compatibility. More... | |
sfTkError_t | getAmbientLight (uint16_t &ambient) |
Retrieves the ambient light measurement from the VEML7700 sensor. More... | |
uint16_t | getAmbientLight (void) |
Reads the ambient light measurement from the VEML7700 sensor. More... | |
sfTkError_t | getWhiteLevel (uint16_t &whiteLevel) |
Retrieves the current white light level measured by the VEML7700 sensor. More... | |
uint16_t | getWhiteLevel (void) |
Reads the current white light level from the VEML7700 sensor. More... | |
sfTkError_t | getLux (float &lux) |
Retrieves the current ambient light level in lux. More... | |
float | getLux (void) |
Reads the current ambient light level in lux. More... | |
VEML7700_interrupt_status_t | interruptStatus (void) |
Retrieves the current interrupt status from the VEML7700 sensor. More... | |
VEML7700_interrupt_status_t | getInterruptStatus (void) |
Gets the interrupt status of the VEML7700 sensor. More... | |
Driver class for the VEML7700 ambient light sensor.
Communication interface for the VEML7700
This class provides an interface to configure and read data from the VEML7700 sensor. It supports sensor initialization, configuration of operational parameters, threshold settings, interrupt management, and reading ambient light and white level measurements.
Usage:
|
inline |
sfTkError_t sfDevVEML7700::begin | ( | sfTkIBus * | theBus = nullptr | ) |
Initializes the VEML7700 device on the specified bus.
This function sets up communication with the VEML7700 sensor using the provided bus interface. If no bus is specified, the method will fail and return an error.
theBus | Pointer to the bus interface (sfTkIBus) to use for communication. Defaults to nullptr. |
Write _configurationRegister into the VEML7700_CONFIGURATION_REGISTER. This will place the device into a known state, in case it was configured previously and remained powered on when the code was restarted.
sfTkError_t sfDevVEML7700::enableInterrupt | ( | bool | bEnable | ) |
Enables or disables the interrupt functionality of the VEML7700 device.
When enabled, the device will generate an interrupt signal based on its configuration.
enable | Set to true to enable interrupts, false to disable. |
sfTkError_t sfDevVEML7700::getAmbientLight | ( | uint16_t & | ambient | ) |
Retrieves the ambient light measurement from the VEML7700 sensor.
Read the sensor data
This function reads the current ambient light value and stores it in the provided reference variable.
[out] | ambient | Reference to a uint16_t variable where the ambient light value will be stored. |
uint16_t sfDevVEML7700::getAmbientLight | ( | void | ) |
Reads the ambient light measurement from the VEML7700 sensor.
This function retrieves the current ambient light value.
sfTkError_t sfDevVEML7700::getHighThreshold | ( | uint16_t & | threshold | ) |
Retrieves the current high threshold value from the VEML7700 sensor.
This function reads the sensor's configuration to obtain the currently set high threshold value.
[out] | threshold | Reference to a uint16_t variable where the high threshold will be stored. |
|
inline |
Get the High Threshold object - this is for backward compatibility.
sfTkError_t sfDevVEML7700::getIntegrationTime | ( | VEML7700_integration_time_t & | it | ) |
Retrieves the current integration time setting from the VEML7700 sensor.
This function reads the sensor's configuration to determine the currently set integration time.
[out] | it | Reference to a VEML7700_integration_time_t variable where the integration time will be stored. |
|
inline |
Get the Integration Time object - this is for backward compatibility.
|
inline |
Get the Integration Time string - this is for backward compatibility.
|
inline |
Gets the interrupt status of the VEML7700 sensor.
sfTkError_t sfDevVEML7700::getLowThreshold | ( | uint16_t & | threshold | ) |
Retrieves the current low threshold value from the VEML7700 sensor.
This function reads the sensor's configuration to obtain the currently set low threshold value.
[out] | threshold | Reference to a uint16_t variable where the low threshold will be stored. |
|
inline |
Get the Low Threshold object - this is for backward compatibility.
sfTkError_t sfDevVEML7700::getLux | ( | float & | lux | ) |
Retrieves the current ambient light level in lux.
This function reads the sensor and calculates the ambient light intensity, storing the result in the provided reference variable.
lux | Reference to a float variable where the measured lux value will be stored. |
float sfDevVEML7700::getLux | ( | void | ) |
Reads the current ambient light level in lux.
This function calculates the lux value based on the sensor's ambient light measurement.
sfTkError_t sfDevVEML7700::getPersistenceProtect | ( | VEML7700_persistence_protect_t & | pp | ) |
Retrieves the current persistence protection setting from the VEML7700 sensor.
This function queries the sensor for its persistence protection configuration, which determines how many consecutive out-of-threshold measurements are required before an interrupt is triggered.
[out] | pp | Reference to a VEML7700_persistence_protect_t variable where the persistence protection value will be stored. |
|
inline |
Get the Persistence Protect object - this is for backward compatibility.
|
inline |
Get the Persistence Protect object - this is for backward compatibility.
sfTkError_t sfDevVEML7700::getSensitivityMode | ( | VEML7700_sensitivity_mode_t & | sm | ) |
Retrieves the current sensitivity mode setting from the VEML7700 sensor.
This function reads the sensor's configuration to determine the currently set sensitivity mode.
[out] | sm | Reference to a VEML7700_sensitivity_mode_t variable where the sensitivity mode will be stored. |
|
inline |
Get the Sensitivity Mode object - this is for backward compatibility.
|
inline |
Get the Sensitivity Mode string - this is for backward compatibility.
sfTkError_t sfDevVEML7700::getWhiteLevel | ( | uint16_t & | whiteLevel | ) |
Retrieves the current white light level measured by the VEML7700 sensor.
This function reads the white channel value from the sensor and stores it in the provided reference variable.
[out] | whiteLevel | Reference to a uint16_t variable where the white light level will be stored. |
uint16_t sfDevVEML7700::getWhiteLevel | ( | void | ) |
Reads the current white light level from the VEML7700 sensor.
This function retrieves the white channel value measured by the sensor.
uint16_t sfDevVEML7700::highThreshold | ( | void | ) |
Gets the current high threshold value of the VEML7700 sensor.
This function retrieves the high threshold that is currently configured for the sensor.
VEML7700_integration_time_t sfDevVEML7700::integrationTime | ( | void | ) |
Gets the current integration time setting of the VEML7700 sensor.
This function retrieves the integration time that is currently configured for the sensor.
const char * sfDevVEML7700::integrationTimeString | ( | void | ) |
Returns a string representation of the current integration time setting.
This function provides a human-readable string that describes the current integration time.
VEML7700_interrupt_status_t sfDevVEML7700::interruptStatus | ( | void | ) |
Retrieves the current interrupt status from the VEML7700 sensor.
This function queries the VEML7700 sensor for its interrupt status, indicating whether a threshold event has occurred (such as crossing high or low limits). The returned status can be used to determine if further action is required, such as reading sensor data or clearing the interrupt.
bool sfDevVEML7700::isConnected | ( | void | ) |
Checks if the VEML7700 sensor is connected and responding.
bool sfDevVEML7700::isInterruptEnabled | ( | void | ) |
Checks if the interrupt feature is enabled on the VEML7700 device.
bool sfDevVEML7700::isShutdown | ( | void | ) |
Checks if the VEML7700 device is currently in shutdown mode.
This function returns true if the device is in shutdown mode, meaning it is not actively measuring. Otherwise, it returns false.
uint16_t sfDevVEML7700::lowThreshold | ( | void | ) |
Gets the current low threshold value of the VEML7700 sensor.
This function retrieves the low threshold that is currently configured for the sensor.
VEML7700_persistence_protect_t sfDevVEML7700::persistenceProtect | ( | void | ) |
Gets the current persistence protection setting of the VEML7700 sensor.
This function returns the persistence protection configuration, which determines how many consecutive out-of-range measurements are required before an interrupt is triggered.
const char * sfDevVEML7700::persistenceProtectString | ( | void | ) |
Returns a string representation of the current persistence protection setting.
This function provides a human-readable string that describes the current persistence protection mode.
|
inline |
Powers on the VEML7700 device by clearing the shutdown mode.
This function calls setShutdown(false) to enable the device's operation.
VEML7700_sensitivity_mode_t sfDevVEML7700::sensitivityMode | ( | void | ) |
Gets the current sensitivity mode setting of the VEML7700 sensor.
This function retrieves the sensitivity mode that is currently configured for the sensor.
const char * sfDevVEML7700::sensitivityModeString | ( | void | ) |
Returns a string representation of the current sensitivity mode setting.
This function provides a human-readable string that describes the current sensitivity mode.
sfTkError_t sfDevVEML7700::setHighThreshold | ( | uint16_t | threshold | ) |
Sets the high threshold value for the VEML7700 sensor.
This function configures the high threshold for the sensor's interrupt. When the measured value exceeds this threshold, an interrupt will be triggered.
threshold | The high threshold value to set (16-bit unsigned integer): 0x0000 to 0xFFFF |
sfTkError_t sfDevVEML7700::setIntegrationTime | ( | VEML7700_integration_time_t | it | ) |
Sets the integration time for the VEML7700 sensor.
This function configures the integration time, which determines the duration over which the sensor accumulates light before taking a measurement. Adjusting the integration time can affect the sensitivity and range of the sensor readings.
it | The desired integration time, specified as a value of the VEML7700_integration_time_t enumeration. |
sfTkError_t sfDevVEML7700::setLowThreshold | ( | uint16_t | threshold | ) |
Sets the low threshold value for the VEML7700 sensor.
This function configures the sensor to trigger an interrupt or event when the measured value falls below the specified threshold.
threshold | The low threshold value to set (16-bit unsigned integer): 0x0000 to 0xFFFF |
sfTkError_t sfDevVEML7700::setPersistenceProtect | ( | VEML7700_persistence_protect_t | pp | ) |
Sets the persistence protection mode for the VEML7700 sensor.
This function configures the persistence protection setting, which determines how many consecutive out-of-threshold events are required before an interrupt is triggered.
pp | The persistence protection mode to set. This should be a value of type VEML7700_persistence_protect_t. Valid values are: VEML7700_PERSISTENCE_1 VEML7700_PERSISTENCE_2 VEML7700_PERSISTENCE_4 VEML7700_PERSISTENCE_8 |
sfTkError_t sfDevVEML7700::setSensitivityMode | ( | VEML7700_sensitivity_mode_t | sm | ) |
Sets the sensitivity mode for the VEML7700 sensor.
This function configures the sensor's sensitivity mode, which affects the measurement range and resolution. The sensitivity mode should be selected based on the application's lighting conditions.
sm | The desired sensitivity mode, specified as a VEML7700_sensitivity_mode_t enum value. |
sfTkError_t sfDevVEML7700::setShutdown | ( | bool | shutdown | ) |
Sets the shutdown mode of the VEML7700 device.
Configuration controls
This function enables or disables the shutdown mode of the sensor. When shutdown mode is enabled, the device enters a low-power state.
shutdown | If true, the device will enter shutdown mode; if false, it will operate normally. |
|
inline |
Puts the VEML7700 device into shutdown mode.
This function calls setShutdown(true) to transition the device into a low-power state.