SparkFun Ambient Light Sensor - VEML7700  v2.0.0-1-g1693613
Library for the SparkFun Ambient Light Sensor - VEML7700
Loading...
Searching...
No Matches
SparkFunVEML7700 Class Reference

Class for interfacing with the VMEL7700 sensor using I2C communication. More...

#include <SparkFun_VEML7700_Arduino_Library.h>

Inheritance diagram for SparkFunVEML7700:

Public Member Functions

bool begin (const uint8_t address=SF_VEML7700_DEFAULT_ADDRESS, TwoWire &wirePort=Wire)
 Begins the Device with I2C as the communication bus. More...
 
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 getPersistenceProtect (void)
 Get the Persistence Protect object - this is for backward compatibility. More...
 
VEML7700_persistence_protect_t persistenceProtect (void)
 Gets the current persistence protection setting of the VEML7700 sensor. 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 getIntegrationTime (void)
 Get the Integration Time object - this is for backward compatibility. More...
 
VEML7700_integration_time_t integrationTime (void)
 Gets the current integration time setting of the VEML7700 sensor. 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 getSensitivityMode (void)
 Get the Sensitivity Mode object - this is for backward compatibility. More...
 
VEML7700_sensitivity_mode_t sensitivityMode (void)
 Gets the current sensitivity mode setting of the VEML7700 sensor. 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 getHighThreshold (void)
 Get the High Threshold object - this is for backward compatibility. More...
 
uint16_t highThreshold (void)
 Gets the current high threshold value of the VEML7700 sensor. 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 getLowThreshold (void)
 Get the Low Threshold object - this is for backward compatibility. More...
 
uint16_t lowThreshold (void)
 Gets the current low threshold value of the VEML7700 sensor. 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...
 

Detailed Description

Class for interfacing with the VMEL7700 sensor using I2C communication.

This class provides methods to initialize and communicate with the BMV080 sensor over an I2C bus. It inherits from the sfDevVEML7700 class and uses the SparkFun Toolkit for I2C communication.

See also
sfDevVEML7700

Member Function Documentation

◆ begin() [1/2]

bool SparkFunVEML7700::begin ( const uint8_t  address = SF_VEML7700_DEFAULT_ADDRESS,
TwoWire &  wirePort = Wire 
)
inline

Begins the Device with I2C as the communication bus.

This method initializes the I2C bus and sets up communication with the VEML7700 sensor.

Parameters
addressI2C device address to use for the sensor
wirePortWire port to use for I2C communication
Returns
True if successful, false otherwise

◆ begin() [2/2]

sfTkError_t sfDevVEML7700::begin ( sfTkIBus *  theBus = nullptr)
inherited

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.

Parameters
theBusPointer to the bus interface (sfTkIBus) to use for communication. Defaults to nullptr.
Returns
sfTkError_t Error code indicating the result of the initialization.

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.

◆ enableInterrupt()

sfTkError_t sfDevVEML7700::enableInterrupt ( bool  bEnable)
inherited

Enables or disables the interrupt functionality of the VEML7700 device.

When enabled, the device will generate an interrupt signal based on its configuration.

Parameters
enableSet to true to enable interrupts, false to disable.
Returns
sfTkError_t Error code indicating success or failure of the operation.

◆ getAmbientLight() [1/2]

sfTkError_t sfDevVEML7700::getAmbientLight ( uint16_t &  ambient)
inherited

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.

Parameters
[out]ambientReference to a uint16_t variable where the ambient light value will be stored.
Returns
sfTkError_t Error code indicating the status of the operation.

◆ getAmbientLight() [2/2]

uint16_t sfDevVEML7700::getAmbientLight ( void  )
inherited

Reads the ambient light measurement from the VEML7700 sensor.

This function retrieves the current ambient light value.

Returns
uint16_t The ambient light value (16-bit unsigned integer): 0x0000 to 0xFFFF

◆ getHighThreshold() [1/2]

sfTkError_t sfDevVEML7700::getHighThreshold ( uint16_t &  threshold)
inherited

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.

Parameters
[out]thresholdReference to a uint16_t variable where the high threshold will be stored.
Returns
sfTkError_t Error code indicating success or failure of the operation.

◆ getHighThreshold() [2/2]

uint16_t sfDevVEML7700::getHighThreshold ( void  )
inlineinherited

Get the High Threshold object - this is for backward compatibility.

Deprecated:
since version 2.0.0, use highThreshold() instead.
Returns
uint16_t The current high threshold value (16-bit unsigned integer): 0x0000 to 0xFFFF

◆ getIntegrationTime() [1/2]

sfTkError_t sfDevVEML7700::getIntegrationTime ( VEML7700_integration_time_t it)
inherited

Retrieves the current integration time setting from the VEML7700 sensor.

This function reads the sensor's configuration to determine the currently set integration time.

Parameters
[out]itReference to a VEML7700_integration_time_t variable where the integration time will be stored.
Returns
sfTkError_t Error code indicating success or failure of the operation.

◆ getIntegrationTime() [2/2]

VEML7700_integration_time_t sfDevVEML7700::getIntegrationTime ( void  )
inlineinherited

Get the Integration Time object - this is for backward compatibility.

Deprecated:
since version 2.0.0, use integrationTime() instead.
Returns
VEML7700_integration_time_t

◆ getIntegrationTimeStr()

const char * sfDevVEML7700::getIntegrationTimeStr ( void  )
inlineinherited

Get the Integration Time string - this is for backward compatibility.

Deprecated:
since version 2.0.0, use integrationTimeString() instead.
Returns
const char* A string representing the integration time setting.

◆ getInterruptStatus()

VEML7700_interrupt_status_t sfDevVEML7700::getInterruptStatus ( void  )
inlineinherited

Gets the interrupt status of the VEML7700 sensor.

Deprecated:
since version 2.0.0, use interruptStatus() instead.
Returns
VEML7700_interrupt_status_t The current interrupt status of the sensor.

◆ getLowThreshold() [1/2]

sfTkError_t sfDevVEML7700::getLowThreshold ( uint16_t &  threshold)
inherited

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.

Parameters
[out]thresholdReference to a uint16_t variable where the low threshold will be stored.
Returns
sfTkError_t Error code indicating success or failure of the operation.

◆ getLowThreshold() [2/2]

uint16_t sfDevVEML7700::getLowThreshold ( void  )
inlineinherited

Get the Low Threshold object - this is for backward compatibility.

Deprecated:
since version 2.0.0, use lowThreshold() instead.
Returns
uint16_t The current low threshold value (16-bit unsigned integer): 0x0000 to 0xFFFF

◆ getLux() [1/2]

sfTkError_t sfDevVEML7700::getLux ( float &  lux)
inherited

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.

Parameters
luxReference to a float variable where the measured lux value will be stored.
Returns
sfTkError_t Error code indicating success or type of failure.

◆ getLux() [2/2]

float sfDevVEML7700::getLux ( void  )
inherited

Reads the current ambient light level in lux.

This function calculates the lux value based on the sensor's ambient light measurement.

Returns
float The calculated lux value, or kVEML7700ValueError if an error occurs.

◆ getPersistenceProtect() [1/2]

sfTkError_t sfDevVEML7700::getPersistenceProtect ( VEML7700_persistence_protect_t pp)
inherited

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.

Parameters
[out]ppReference to a VEML7700_persistence_protect_t variable where the persistence protection value will be stored.
Returns
sfTkError_t Error code indicating success or failure of the operation.

◆ getPersistenceProtect() [2/2]

VEML7700_persistence_protect_t sfDevVEML7700::getPersistenceProtect ( void  )
inlineinherited

Get the Persistence Protect object - this is for backward compatibility.

Deprecated:
since version 2.0.0, use persistenceProtect() instead.
Returns
VEML7700_persistence_protect_t

◆ getPersistenceProtectStr()

const char * sfDevVEML7700::getPersistenceProtectStr ( void  )
inlineinherited

Get the Persistence Protect object - this is for backward compatibility.

Deprecated:
since version 2.0.0, use persistenceProtect() instead.
Returns
VEML7700_persistence_protect_t

◆ getSensitivityMode() [1/2]

sfTkError_t sfDevVEML7700::getSensitivityMode ( VEML7700_sensitivity_mode_t sm)
inherited

Retrieves the current sensitivity mode setting from the VEML7700 sensor.

This function reads the sensor's configuration to determine the currently set sensitivity mode.

Parameters
[out]smReference to a VEML7700_sensitivity_mode_t variable where the sensitivity mode will be stored.
Returns
sfTkError_t Error code indicating success or failure of the operation.

◆ getSensitivityMode() [2/2]

VEML7700_sensitivity_mode_t sfDevVEML7700::getSensitivityMode ( void  )
inlineinherited

Get the Sensitivity Mode object - this is for backward compatibility.

Deprecated:
since version 2.0.0, use sensitivityMode() instead.
Returns
VEML7700_sensitivity_mode_t

◆ getSensitivityModeStr()

const char * sfDevVEML7700::getSensitivityModeStr ( void  )
inlineinherited

Get the Sensitivity Mode string - this is for backward compatibility.

Deprecated:
since version 2.0.0, use sensitivityModeString() instead.
Returns
const char* A string representing the sensitivity mode setting.

◆ getWhiteLevel() [1/2]

sfTkError_t sfDevVEML7700::getWhiteLevel ( uint16_t &  whiteLevel)
inherited

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.

Parameters
[out]whiteLevelReference to a uint16_t variable where the white light level will be stored.
Returns
sfTkError_t Error code indicating the status of the operation.

◆ getWhiteLevel() [2/2]

uint16_t sfDevVEML7700::getWhiteLevel ( void  )
inherited

Reads the current white light level from the VEML7700 sensor.

This function retrieves the white channel value measured by the sensor.

Returns
uint16_t The white light level (16-bit unsigned integer): 0x0000 to 0xFFFF

◆ highThreshold()

uint16_t sfDevVEML7700::highThreshold ( void  )
inherited

Gets the current high threshold value of the VEML7700 sensor.

This function retrieves the high threshold that is currently configured for the sensor.

Returns
uint16_t The current high threshold value (16-bit unsigned integer): 0x0000 to 0xFFFF

◆ integrationTime()

VEML7700_integration_time_t sfDevVEML7700::integrationTime ( void  )
inherited

Gets the current integration time setting of the VEML7700 sensor.

This function retrieves the integration time that is currently configured for the sensor.

Returns
VEML7700_integration_time_t The current integration time setting.

◆ integrationTimeString()

const char * sfDevVEML7700::integrationTimeString ( void  )
inherited

Returns a string representation of the current integration time setting.

This function provides a human-readable string that describes the current integration time.

Returns
const char* A string representing the integration time setting.

◆ interruptStatus()

VEML7700_interrupt_status_t sfDevVEML7700::interruptStatus ( void  )
inherited

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.

Returns
VEML7700_interrupt_status_t The current interrupt status of the sensor.
Note
Reading the interrupt status register clears the interrupts. So, it is important to check both interrupt flags in a single read.

◆ isConnected()

bool sfDevVEML7700::isConnected ( void  )
inherited

Checks if the VEML7700 sensor is connected and responding.

Returns
true if the sensor is detected and communication is successful, false otherwise.

◆ isInterruptEnabled()

bool sfDevVEML7700::isInterruptEnabled ( void  )
inherited

Checks if the interrupt feature is enabled on the VEML7700 device.

Returns
true if the interrupt is enabled, false otherwise.

◆ isShutdown()

bool sfDevVEML7700::isShutdown ( void  )
inherited

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.

Returns
true if the device is shut down, false otherwise.

◆ lowThreshold()

uint16_t sfDevVEML7700::lowThreshold ( void  )
inherited

Gets the current low threshold value of the VEML7700 sensor.

This function retrieves the low threshold that is currently configured for the sensor.

Returns
uint16_t The current low threshold value (16-bit unsigned integer): 0x0000 to 0xFFFF

◆ persistenceProtect()

VEML7700_persistence_protect_t sfDevVEML7700::persistenceProtect ( void  )
inherited

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.

Returns
VEML7700_persistence_protect_t The current persistence protection setting.

◆ persistenceProtectString()

const char * sfDevVEML7700::persistenceProtectString ( void  )
inherited

Returns a string representation of the current persistence protection setting.

This function provides a human-readable string that describes the current persistence protection mode.

Returns
const char* A string representing the persistence protection setting.

◆ powerOn()

sfTkError_t sfDevVEML7700::powerOn ( void  )
inlineinherited

Powers on the VEML7700 device by clearing the shutdown mode.

This function calls setShutdown(false) to enable the device's operation.

Returns
sfTkError_t Error code indicating the result of the operation.

◆ sensitivityMode()

VEML7700_sensitivity_mode_t sfDevVEML7700::sensitivityMode ( void  )
inherited

Gets the current sensitivity mode setting of the VEML7700 sensor.

This function retrieves the sensitivity mode that is currently configured for the sensor.

Returns
VEML7700_sensitivity_mode_t The current sensitivity mode setting.

◆ sensitivityModeString()

const char * sfDevVEML7700::sensitivityModeString ( void  )
inherited

Returns a string representation of the current sensitivity mode setting.

This function provides a human-readable string that describes the current sensitivity mode.

Returns
const char* A string representing the sensitivity mode setting.

◆ setHighThreshold()

sfTkError_t sfDevVEML7700::setHighThreshold ( uint16_t  threshold)
inherited

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.

Parameters
thresholdThe high threshold value to set (16-bit unsigned integer): 0x0000 to 0xFFFF
Returns
sfTkError_t Error code indicating success or failure of the operation.

◆ setIntegrationTime()

sfTkError_t sfDevVEML7700::setIntegrationTime ( VEML7700_integration_time_t  it)
inherited

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.

Parameters
itThe desired integration time, specified as a value of the VEML7700_integration_time_t enumeration.
Returns
sfTkError_t Returns an error code indicating success or failure of the operation.

◆ setLowThreshold()

sfTkError_t sfDevVEML7700::setLowThreshold ( uint16_t  threshold)
inherited

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.

Parameters
thresholdThe low threshold value to set (16-bit unsigned integer): 0x0000 to 0xFFFF
Returns
sfTkError_t Error code indicating success or failure of the operation.

◆ setPersistenceProtect()

sfTkError_t sfDevVEML7700::setPersistenceProtect ( VEML7700_persistence_protect_t  pp)
inherited

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.

Parameters
ppThe 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
Returns
sfTkError_t Returns an error code indicating the success or failure of the operation.

◆ setSensitivityMode()

sfTkError_t sfDevVEML7700::setSensitivityMode ( VEML7700_sensitivity_mode_t  sm)
inherited

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.

Parameters
smThe desired sensitivity mode, specified as a VEML7700_sensitivity_mode_t enum value.
Returns
sfTkError_t Returns an error code indicating success or failure of the operation.

◆ setShutdown()

sfTkError_t sfDevVEML7700::setShutdown ( bool  shutdown)
inherited

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.

Parameters
shutdownIf true, the device will enter shutdown mode; if false, it will operate normally.
Returns
sfTkError_t Error code indicating the result of the operation.

◆ shutdown()

sfTkError_t sfDevVEML7700::shutdown ( void  )
inlineinherited

Puts the VEML7700 device into shutdown mode.

This function calls setShutdown(true) to transition the device into a low-power state.

Returns
sfTkError_t Error code indicating the result of the shutdown operation.

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