Drv::Veml6031Manager
The VEML6031 Manager component interfaces with the VEML6031 sensor to provide visible light measurements.
Usage Examples
The VEML6031 Manager component is designed to be called periodically or on demand to collect and return sensor data. It operates as a passive component that responds to manager calls.
Typical Usage
The component is instantiated and initialized during system startup.
A manager calls the input port: visibleLightGet.
On each call, the component:
Checks if the device is initialized and ready.
Configures sensor attributes (Gain, Integration Time, etc.) based on parameters.
Fetches fresh sensor samples.
Writes telemetry data.
Returns the light value in lux.
Class Diagram
classDiagram
namespace Drv {
class Veml6031ManagerComponentBase {
<<Auto-generated>>
}
class Veml6031Manager {
- m_dev: const struct device*
- m_tca: const struct device*
- m_mux: const struct device*
- m_load_switch_state: Fw::On
- m_load_switch_on_timeout: Fw::Time
+ Veml6031Manager(const char* compName)
+ ~Veml6031Manager()
+ configure(const struct device* tca, const struct device* mux, const struct device* dev)
- visibleLightGet_handler(FwIndexType portNum, Fw::Success& condition): F32
- loadSwitchStateChanged_handler(FwIndexType portNum, const Fw::On& state): Fw::Success
}
}
Veml6031ManagerComponentBase <|-- Veml6031Manager : inherits
Port Descriptions
Name
Type
Description
visibleLightGet
sync input
Reads the illuminance in visible spectrum, in lux.
loadSwitchStateChanged
sync input
Initializes and deinitializes the VEML6031 device on load switch state change.
Sequence Diagrams
visibleLightGet
sequenceDiagram
participant Manager
participant Veml6031Manager
participant Zephyr Sensor API
participant VEML6031 Sensor
Manager-->>Veml6031Manager: Call visibleLightGet
Veml6031Manager->>Veml6031Manager: Check/Init Device
Veml6031Manager->>Zephyr Sensor API: Configure Attributes (Gain, IT, etc.)
Veml6031Manager->>Zephyr Sensor API: Fetch sensor sample (SENSOR_CHAN_LIGHT)
Zephyr Sensor API->>VEML6031 Sensor: Read registers
VEML6031 Sensor->>Zephyr Sensor API: Return data
Zephyr Sensor API->>Veml6031Manager: Return sample
Veml6031Manager->>Zephyr Sensor API: Get channel value
Zephyr Sensor API->>Veml6031Manager: Return value
Veml6031Manager->>Veml6031Manager: Write Telemetry (VisibleLight)
Veml6031Manager-->>Manager: Return lux value
Parameters
Name
Description
GAIN
Gain settings for VEML6031 sensor
INTEGRATION_TIME
Integration time settings (IT)
EFFECTIVE_PHOTODIODE_SIZE
Effective photodiode size (DIV4)
Commands
Name
Description
GetVisibleLight
Command to get the visible light measurement in lux
Events
Name
Description
DeviceNotReady
VEML6031 device not ready
DeviceInitFailed
VEML6031 initialization failed
DeviceNil
VEML6031 device is nil
DeviceStateNil
VEML6031 device state is nil
TcaUnhealthy
VEML6031 TCA device is unhealthy
MuxUnhealthy
VEML6031 MUX device is unhealthy
SensorSampleFetchFailed
VEML6031 sensor fetch failed
SensorChannelGetFailed
VEML6031 sensor channel get failed
InvalidGainParam
VEML6031 invalid gain parameter
InvalidIntegrationTimeParam
VEML6031 invalid integration time parameter
InvalidDiv4Param
VEML6031 invalid effective photodiode size parameter
SensorAttrSetFailed
VEML6031 sensor attribute set failed
VisibleLight
VEML6031 visible light measured in lux
Telemetry
Name
Description
VisibleLight
Illuminance in the visible spectrum, in lux
Requirements
Name
Description
Validation
VisibleLightGet Port
The component shall provide access to visible light sensor data and return in lux
Verify output matches expected values from sensor datasheet
LoadSwitchStateChanged Port
The component shall manage device initialization based on load switch state
Verify device initializes when switch is ON and deinitializes when OFF
Change Log
Date
Description
2025-12-04
Initial VEML6031 Manager component SDD