2.7 I2C Color Sensor VEML3328 Driver
2.7.1 Introduction
The MPLAB® Code Configurator Melody I2C Color Sensor VEML3328 Library allows quick and easy configuration and code generation to enable microcontrollers to interface with the off-chip VEML3328 Color Sensor using the I2C protocol.
2.7.2 How to Host Multiple Clients on a Single I2C Bus
- Launch MCC and select MCC Melody
- Load at least two I2C-dependent modules (in the case illustrated by Figure 2-11), without assigning any I2C instance in the I2C Host Dependency selector.
- Assign an I2C instance to only one of the loaded I2C-dependent modules (refer to Figure 2-12).
- If there are more than one I2C instance on the device, keep the I2C Host Dependency selector on the second I2C-dependent module (I2C Color Sensor VEML3328) on “None”.
- Check the notifications on the second I2C-dependent module for instructions on how to assign the same I2C instance in the generated C-code. Ignore this warning when generating the code.
- Generate the code.
- Modify the generated C-code by assigning the generated I2C driver APIs.
2.7.3 I2C Color Sensor VEML3328 Driver Documentation
2.7.3.1 Module Documentation
2.7.3.1.1 VEML3328
This file contains API declarations for the I2C Color Sensor VEML3328 driver.
Module description
This file contains API declarations for the I2C Color Sensor VEML3328 driver.
Data structures
struct VEML3328_INITIAL_CONFIG
An instance of VEML3328_DEVICE_INIT_t for the VEML3328 Color Sensor driver.
struct VEML3328_DEVICE_CONTEXT
Structure containing the VEML3328 Color Sensor driver context used in the API routines.
struct VEML3328_DEVICE_INIT
Structure containing the VEML3328 Color Sensor Command register settings for the driver initialization.
Definitions
#define VEML3328_CLIENT_ADDRESS (0x10U)
Enumerations
enum VEML3328_STATUS { VEML3328_NO_ERROR = 0U, VEML3328_ERROR = 1U, VEML3328_INVALID_PARAMETER = 104U, VEML3328_NULL_ERROR = 105U, VEML3328_COM_ERROR = 106U }
Enumeration of the VEML3328 Color Sensor driver status codes.
enum VEML3328_SD { POWER_ON, SHUTDOWN }
Enumeration of the VEML3328 Color Sensor Power options.
enum VEML3328_SD_ALS { ALL_CHANNELS, POWER_ON_G_C_IR }
Enumeration of the VEML3328 Color Sensor Power-on Channel options.
enum VEML3328_DG { DG_X1 = 0U, DG_X2 = 1U, DG_X4 = 2U }
Enumeration of the VEML3328 Color Sensor Differential Gain values.
enum VEML3328_GAIN { GAIN_X_HALF = 3U, GAIN_X1 = 0U, GAIN_X2 = 1, GAIN_X4 = 2U }
Enumeration of the VEML3328 Color Sensor Gain values.
enum VEML3328_SENS { HIGH_SENSITVITY, LOW_SENSITVITY }
Enumeration of the VEML3328 Color Sensor Sensitivity values.
enum VEML3328_IT { MS_50 = 0U, MS_100 = 1U, MS_200 = 2U, MS_400 = 3U }
Enumeration of the VEML3328 Color Sensor Integration Time values.
enum VEML3328_AF { AUTO, ACTIVE_FORCE }
Enumeration of the VEML3328 Color Sensor Measurement mode options.
Functions
VEML3328_STATUS_t VEML3328_Initialize (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, VEML3328_DEVICE_INIT_t deviceInit)
Initializes the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_Shutdown (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Shuts down the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_PowerOn (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Powers up the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_AutoModeSet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Sets the Measurement mode to Auto (Continuous).
VEML3328_STATUS_t VEML3328_ActiveForceModeSet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Sets the Measurement mode to Active Force (Single).
VEML3328_STATUS_t VEML3328_SingleMeasurementTrigger (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Triggers single cycle measurement on the VEML3328 sensor.
VEML3328_STATUS_t VEML3328_ClearChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Clear channel data of the VEML3328 sensor.
VEML3328_STATUS_t VEML3328_RedChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Red channel data of the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_GreenChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Green channel data of the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_BlueChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Blue channel data of the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_IrChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Infrared (IR) channel data of the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_DeviceIdGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the device ID of the VEML3328 Color Sensor.
Definition Documentation
VEML3328_CLIENT_ADDRESS
#define VEML3328_CLIENT_ADDRESS (0x10U)
VEML3328 Color Sensor Client address for I2C operations.
Function Documentation
VEML3328_ActiveForceModeSet()
VEML3328_STATUS_t VEML3328_ActiveForceModeSet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Sets the Measurement mode to Active Force (Single).
Initialize the VEML3328 Color Sensor. |
|
VEML3328 status code. |
VEML3328_AutoModeSet()
VEML3328_STATUS_t VEML3328_AutoModeSet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Sets the Measurement mode to Auto (Continuous).
Initialize the VEML3328 Color Sensor. |
|
VEML3328 status code. |
VEML3328_BlueChannelDataGet()
VEML3328_STATUS_t VEML3328_BlueChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t * readBuffer)
Reads the Blue channel data of the VEML3328 Color Sensor.
Initialize the VEML3328 Color Sensor. If the driver uses the Active Force (Single) Measurement mode, execute the VEML3328_SingleMeasurementTrigger routine. |
|
VEML3328 status code. |
VEML3328_ClearChannelDataGet()
VEML3328_STATUS_t VEML3328_ClearChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t * readBuffer)
Reads the Clear channel data of the VEML3328 sensor.
Initialize the VEML3328 Color Sensor. If the driver uses the Active Force (Single) Measurement mode, execute the VEML3328_SingleMeasurementTrigger routine. |
|
VEML3328 status code. |
VEML3328_DeviceIdGet()
VEML3328_STATUS_t VEML3328_DeviceIdGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t * readBuffer)
Reads the device ID of the VEML3328 Color Sensor.
Initialize the I2C Host driver. |
|
VEML3328 status code. |
VEML3328_GreenChannelDataGet()
VEML3328_STATUS_t VEML3328_GreenChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t * readBuffer)
Reads the Green channel data of the VEML3328 Color Sensor.
Initialize the VEML3328 Color Sensor. If the driver uses the Active Force (Single) Measurement mode, execute the VEML3328_SingleMeasurementTrigger routine. |
|
VEML3328 status code. |
VEML3328_Initialize()
VEML3328_STATUS_t VEML3328_Initialize (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, VEML3328_DEVICE_INIT_t deviceInit)
Initializes the VEML3328 Color Sensor.
Global API Declarations
Initialize the I2C Host driver. |
|
VEML3328 status code. |
VEML3328_IrChannelDataGet()
VEML3328_STATUS_t VEML3328_IrChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t * readBuffer)
Reads the Infrared (IR) channel data of the VEML3328 Color Sensor.
Initialize the VEML3328 Color Sensor. If the driver uses the Active Force (Single) Measurement mode, execute the VEML3328_SingleMeasurementTrigger routine. |
|
VEML3328 status code. |
VEML3328_PowerOn()
VEML3328_STATUS_t VEML3328_PowerOn (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Powers up the VEML3328 Color Sensor.
|
VEML3328 status code. |
VEML3328_RedChannelDataGet()
VEML3328_STATUS_t VEML3328_RedChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t * readBuffer)
Reads the Red channel data of the VEML3328 Color Sensor.
Initialize the VEML3328 Color Sensor. If the driver uses the Active Force (Single) Measurement mode, execute the VEML3328_SingleMeasurementTrigger routine. |
|
VEML3328 status code. |
VEML3328_Shutdown()
VEML3328_STATUS_t VEML3328_Shutdown (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Shuts down the VEML3328 Color Sensor.
|
VEML3328 status code. |
VEML3328_SingleMeasurementTrigger()
VEML3328_STATUS_t VEML3328_SingleMeasurementTrigger (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Triggers single cycle measurement on the VEML3328 sensor.
Initialize the VEML3328 Color Sensor with Active Force (Single) Measurement mode. |
|
VEML3328 status code. |
Enumeration Type Documentation
VEML3328_AF
enum VEML3328_AF
Enumeration of the VEML3328 Color Sensor Measurement mode options.
AUTO |
Sets the sensor Measurement mode to Auto. |
ACTIVE_FORCE |
Sets the sensor Measurement mode to Active Force. |
VEML3328_DG
enum VEML3328_DG
Enumeration of the VEML3328 Color Sensor Differential Gain values.
DG_X1 |
Sets the sensor Differential Gain to x1. |
DG_X2 |
Sets the sensor Differential Gain to x2. |
DG_X4 |
Sets the sensor Differential Gain to x4. |
VEML3328_GAIN
enum VEML3328_GAIN
Enumeration of the VEML3328 Color Sensor Gain values.
GAIN_X_HALF |
Sets the sensor Gain to x0.5. |
GAIN_X1 |
Sets the sensor Gain to x1. |
GAIN_X2 |
Sets the sensor Gain to x2. |
GAIN_X4 |
Sets the sensor Gain to x4. |
VEML3328_IT
enum VEML3328_IT
Enumeration of the VEML3328 Color Sensor Integration Time values.
MS_50 |
Sets the sensor Integration Time to 50 ms. |
MS_100 |
Sets the sensor Integration Time to 100 ms. |
MS_200 |
Sets the sensor Integration Time to 200 ms. |
MS_400 |
Sets the sensor Integration Time to 400 ms. |
VEML3328_SD
enum VEML3328_SD
Enumeration of the VEML3328 Color Sensor Power options.
POWER_ON |
Sets the sensor Power to Power-on. |
SHUTDOWN |
Sets the sensor Power to Shutdown x1. |
VEML3328_SD_ALS
enum VEML3328_SD_ALS
Enumeration of the VEML3328 Color Sensor Power-on Channel options.
ALL_CHANNELS |
Sets the sensor Power-on for all channels. |
POWER_ON_G_C_IR |
Sets the sensor Power-on for Green, Clear and IR channels only. |
VEML3328_SENS
enum VEML3328_SENS
Enumeration of the VEML3328 Color Sensor Sensitivity values.
HIGH_SENSITVITY |
Sets the sensor Sensitivity to High. |
LOW_SENSITVITY |
Sets the sensor Sensitivity to Low (1/3). |
VEML3328_STATUS
enum VEML3328_STATUS
Enumeration of the VEML3328 Color Sensor driver status codes.
VEML3328_NO_ERROR |
VEML3328_ERROR |
VEML3328_INVALID_PARAMETER |
VEML3328_NULL_ERROR |
VEML3328_COM_ERROR |
2.7.3.1.2 VEML3328_I2C
This file contains constants and API declarations for the VEML3328 Color Sensor interface.
Module description
This file contains constants and API declarations for the VEML3328 Color Sensor interface.
To ensure that the C driver runs properly, do not modify the I2C API prototypes. Refer to veml3328_i2c.c to configure the I2C interface implementation.
Data structures
struct VEML3328_I2C_Host
Structure that creates an instance of the I2C Host driver interface for the VEML3328 Color Sensor.
Functions
uint8_t VEML3328_WordSend (uint16_t writeData)
Sends a 16-bit word to the VEML3328 Color Sensor Command register.
uint8_t VEML3328_WordReceive (uint8_t command, uint16_t *readData)
Sends an 8-bit command code and receives a 16-bit word from the VEML3328 Color Sensor Data registers.
Function Documentation
VEML3328_WordReceive()
uint8_t VEML3328_WordReceive (uint8_t command, uint16_t * readData)
Sends an 8-bit command code and receives a 16-bit word from the VEML3328 Color Sensor Data registers.
Initialize the I2C Host and the VEML3328 Color Sensor. |
|
VEML3328 Color Sensor I2C status code. |
VEML3328_WordSend()
uint8_t VEML3328_WordSend (uint16_t writeData)
Sends a 16-bit word to the VEML3328 Color Sensor Command register.
Initialize the I2C Host and the VEML3328 Color Sensor. |
|
VEML3328 Color Sensor I2C status code. |
2.7.3.2 Class Documentation
2.7.3.2.1 VEML3328_DEVICE_CONTEXT Struct Reference
Structure containing the VEML3328 Color Sensor driver context used in the API routines.
Detailed Description
Structure containing the VEML3328 Color Sensor driver context used in the API routines.
#include <veml3328_types.h>
Public Attributes
uint8_t sd0Val
uint8_t sd1Val
uint8_t powerOn
uint8_t diffGain
uint8_t gain
uint8_t sensivity
uint8_t integrationTime
uint8_t measurementMode
uint8_t trigger
uint16_t commandCodeConfig
Member Data Documentation
commandCodeConfig
uint16_t VEML3328_DEVICE_CONTEXT::commandCodeConfig
diffGain
uint8_t VEML3328_DEVICE_CONTEXT::diffGain
gain
uint8_t VEML3328_DEVICE_CONTEXT::gain
integrationTime
uint8_t VEML3328_DEVICE_CONTEXT::integrationTime
measurementMode
uint8_t VEML3328_DEVICE_CONTEXT::measurementMode
powerOn
uint8_t VEML3328_DEVICE_CONTEXT::powerOn
sd0Val
uint8_t VEML3328_DEVICE_CONTEXT::sd0Val
sd1Val
uint8_t VEML3328_DEVICE_CONTEXT::sd1Val
sensivity
uint8_t VEML3328_DEVICE_CONTEXT::sensivity
trigger
uint8_t VEML3328_DEVICE_CONTEXT::trigger
2.7.3.2.2 VEML3328_DEVICE_INIT Struct Reference
Structure containing the VEML3328 Color Sensor Command register settings for the driver initialization.
Detailed Description
Structure containing the VEML3328 Color Sensor Command register settings for the driver initialization.
#include <veml3328_types.h>
Public Attributes
uint8_t sd0Val
uint8_t sd1Val
uint8_t powerOn
uint8_t diffGain
uint8_t gain
uint8_t sensivity
uint8_t integrationTime
uint8_t measurementMode
Member Data Documentation
diffGain
uint8_t VEML3328_DEVICE_INIT::diffGain
gain
uint8_t VEML3328_DEVICE_INIT::gain
integrationTime
uint8_t VEML3328_DEVICE_INIT::integrationTime
measurementMode
uint8_t VEML3328_DEVICE_INIT::measurementMode
powerOn
uint8_t VEML3328_DEVICE_INIT::powerOn
sd0Val
uint8_t VEML3328_DEVICE_INIT::sd0Val
sd1Val
uint8_t VEML3328_DEVICE_INIT::sd1Val
sensivity
uint8_t VEML3328_DEVICE_INIT::sensivity
2.7.3.2.3 VEML3328_I2C_Host Struct Reference
Structure that creates an instance of the I2C Host driver interface for the VEML3328 Color Sensor.
Detailed Description
Structure that creates an instance of the I2C Host driver interface for the VEML3328 Color Sensor.
The documentation for this struct was generated from the following file:
source/src/
2.7.3.2.4 VEML3328_INITIAL_CONFIG Struct Reference
An instance of VEML3328_DEVICE_INIT_t for the VEML3328 Color Sensor driver.
Detailed Description
An instance of VEML3328_DEVICE_INIT_t for the VEML3328 Color Sensor driver.
Include Headers
#include <veml3328.h>
The documentation for this struct was generated from the following file:
source/
2.7.3.3 File Documentation
2.7.3.3.1 source/src/veml3328.c File Reference
Contains API definitions for the I2C Color Sensor VEML3328 driver.
#include "../veml3328.h" #include "../veml3328_config.h" #include "../veml3328_i2c.h"
Functions
VEML3328_STATUS_t VEML3328_Initialize (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, VEML3328_DEVICE_INIT_t deviceInit)
Initializes the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_Shutdown (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Shuts down the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_PowerOn (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Powers up the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_AutoModeSet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Sets the Measurement mode to Auto (Continuous).
VEML3328_STATUS_t VEML3328_ActiveForceModeSet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Sets the Measurement mode to Active Force (Single).
VEML3328_STATUS_t VEML3328_SingleMeasurementTrigger (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Triggers single cycle measurement on the VEML3328 sensor.
VEML3328_STATUS_t VEML3328_ClearChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Clear channel data of the VEML3328 sensor.
VEML3328_STATUS_t VEML3328_RedChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Red channel data of the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_GreenChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Green channel data of the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_BlueChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Blue channel data of the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_IrChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Infrared (IR) channel data of the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_DeviceIdGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the device ID of the VEML3328 Color Sensor.
Variables
Detailed Description
Contains API definitions for the I2C Color Sensor VEML3328 driver.
I2C Color Sensor VEML3328 generated driver source file.
Variable Documentation
VEML3328_INITIAL_CONFIG
const VEML3328_DEVICE_INIT_t VEML3328_INITIAL_CONFIG
Initial value:
= { .sd0Val = POWER_ON, .sd1Val = POWER_ON, .powerOn = ALL_CHANNELS, .diffGain = DG_X1, .gain = GAIN_X1, .sensivity = HIGH_SENSITVITY, .integrationTime = MS_50, .measurementMode = AUTO, }
Include HeadersGlobal API Definitions
2.7.3.3.2 source/src/veml3328_i2c.c File Reference
This file contains API definitions for the I2C Color Sensor VEML3328 interface. Users can modify this file to support other I2C drivers.
#include "../../i2c_host/twi0.h" #include "../veml3328_i2c.h" #include "../veml3328_config.h"
Functions
uint8_t VEML3328_WordSend (uint16_t writeData)
Sends a 16-bit word to the VEML3328 Color Sensor Command register.
uint8_t VEML3328_WordReceive (uint8_t command, uint16_t *readData)
Sends an 8-bit command code and receives a 16-bit word from the VEML3328 Color Sensor Data registers.
Macros
I2C Operation Parameters
Parameters for the I2C read and write operations.
#define ADDRESS_LENGTH (1U)
#define READ_WORD_SIZE (2U)
#define SEND_WORD_SIZE (3U)
Variables
const i2c_host_interface_t VEML3328_I2C_Host
Detailed Description
This file contains API definitions for the I2C Color Sensor VEML3328 interface. Users can modify this file to support other I2C drivers.
I2C Color Sensor VEML3328 generated driver I2C interface source file.
Macro Definition Documentation
ADDRESS_LENGTH
#define ADDRESS_LENGTH (1U)
READ_WORD_SIZE
#define READ_WORD_SIZE (2U)
SEND_WORD_SIZE
#define SEND_WORD_SIZE (3U)
Variable Documentation
VEML3328_I2C_Host
const i2c_host_interface_t VEML3328_I2C_Host
Initial value:
= { .Write = TWI0_Write, .WriteRead = TWI0_WriteRead, .IsBusy = TWI0_IsBusy, .Tasks = TWI0_Tasks, }
2.7.3.3.3 source/veml3328.h File Reference
#include <stdint.h> #include "veml3328_i2c.h" #include "veml3328_types.h"
Functions
VEML3328_STATUS_t VEML3328_Initialize (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, VEML3328_DEVICE_INIT_t deviceInit)
Initializes the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_Shutdown (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Shuts down the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_PowerOn (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Powers up the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_AutoModeSet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Sets the Measurement mode to Auto (Continuous).
VEML3328_STATUS_t VEML3328_ActiveForceModeSet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Sets the Measurement mode to Active Force (Single).
VEML3328_STATUS_t VEML3328_SingleMeasurementTrigger (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr)
Triggers single cycle measurement on the VEML3328 sensor.
VEML3328_STATUS_t VEML3328_ClearChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Clear channel data of the VEML3328 sensor.
VEML3328_STATUS_t VEML3328_RedChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Red channel data of the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_GreenChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Green channel data of the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_BlueChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Blue channel data of the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_IrChannelDataGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the Infrared (IR) channel data of the VEML3328 Color Sensor.
VEML3328_STATUS_t VEML3328_DeviceIdGet (VEML3328_DEVICE_CONTEXT_PTR deviceContextPtr, uint16_t *readBuffer)
Reads the device ID of the VEML3328 Color Sensor.
Variables
Detailed Description
I2C Color Sensor VEML3328 generated driver header file.
Variable Documentation
VEML3328_INITIAL_CONFIG
const VEML3328_DEVICE_INIT_t VEML3328_INITIAL_CONFIG
Include HeadersGlobal API Definitions
2.7.3.3.4 source/veml3328_config.h File Reference
This file contains device-specific constants for the I2C Color Sensor VEML3328 driver.
Macros
#define VEML3328_CLIENT_ADDRESS (0x10U)
Command Register Macros
Bit position and bit masks for the VEML3328 Color Sensor Command register settings.
#define VEML3328_SD1_POSITION (15U)
#define VEML3328_SD1_MASK (0x8000UL)
#define VEML3328_SD0_POSITION (0U)
#define VEML3328_SD0_MASK (0x01U)
#define VEML3328_SD_ALS_POSITION (14U)
#define VEML3328_DG_POSITION (13U)
#define VEML3328_GAIN_POSITION (11U)
#define VEML3328_SENS_POSITION (6U)
#define VEML3328_IT_POSITION (5U)
#define VEML3328_AF_POSITION (3U)
#define VEML3328_AF_MASK (0x08U)
#define VEML3328_TRIG_POSITION (2U)
Command Code Macros
VEML3328 Color Sensor Command codes for I2C read and write operations.
#define CMD_WRITE_REGISTER (0x00U)
#define CMD_READ_CLEAR_CHANNEL (0x04U)
#define CMD_READ_RED_CHANNEL (0x05U)
#define CMD_READ_GREEN_CHANNEL (0x06U)
#define CMD_READ_BLUE_CHANNEL (0x07U)
#define CMD_READ_IR_CHANNEL (0x08U)
#define CMD_READ_DEVICE_ID (0x0CU)
Detailed Description
This file contains device-specific constants for the I2C Color Sensor VEML3328 driver.
I2C Color Sensor VEML3328 generated driver configuration header file.
Macro Definition Documentation
CMD_READ_BLUE_CHANNEL
#define CMD_READ_BLUE_CHANNEL (0x07U)
CMD_READ_CLEAR_CHANNEL
#define CMD_READ_CLEAR_CHANNEL (0x04U)
CMD_READ_DEVICE_ID
#define CMD_READ_DEVICE_ID (0x0CU)
CMD_READ_GREEN_CHANNEL
#define CMD_READ_GREEN_CHANNEL (0x06U)
CMD_READ_IR_CHANNEL
#define CMD_READ_IR_CHANNEL (0x08U)
CMD_READ_RED_CHANNEL
#define CMD_READ_RED_CHANNEL (0x05U)
CMD_WRITE_REGISTER
#define CMD_WRITE_REGISTER (0x00U)
VEML3328_AF_MASK
#define VEML3328_AF_MASK (0x08U)
Measurement mode bit mask.
VEML3328_AF_POSITION
#define VEML3328_AF_POSITION (3U)
Measurement mode bit position.
VEML3328_DG_POSITION
#define VEML3328_DG_POSITION (13U)
Differential Gain bit position.
VEML3328_GAIN_POSITION
#define VEML3328_GAIN_POSITION (11U)
Gain bit position.
VEML3328_IT_POSITION
#define VEML3328_IT_POSITION (5U)
Integration Time bit position.
VEML3328_SD0_MASK
#define VEML3328_SD0_MASK (0x01U)
Shutdown bit 0 mask.
VEML3328_SD0_POSITION
#define VEML3328_SD0_POSITION (0U)
Shutdown bit 0 position.
VEML3328_SD1_MASK
#define VEML3328_SD1_MASK (0x8000UL)
Shutdown bit 1 mask.
VEML3328_SD1_POSITION
#define VEML3328_SD1_POSITION (15U)
Shutdown bit 1 position.
VEML3328_SD_ALS_POSITION
#define VEML3328_SD_ALS_POSITION (14U)
Channels Power-on bit position.
VEML3328_SENS_POSITION
#define VEML3328_SENS_POSITION (6U)
Sensitivity bit position.
VEML3328_TRIG_POSITION
#define VEML3328_TRIG_POSITION (2U)
Single Measurement Trigger bit position.
2.7.3.3.5 source/veml3328_i2c.h File Reference
#include <stdint.h> #include <stddef.h>
Functions
uint8_t VEML3328_WordSend (uint16_t writeData)
Sends a 16-bit word to the VEML3328 Color Sensor Command register.
uint8_t VEML3328_WordReceive (uint8_t command, uint16_t *readData)
Sends an 8-bit command code and receives a 16-bit word from the VEML3328 Color Sensor Data registers.
Macros
VEML3328 Color Sensor I2C Status Codes
I2C interface status codes.
#define VEML3328_I2C_NO_ERROR (0U)
#define VEML3328_I2C_ERROR (1U)
Detailed Description
I2C Color Sensor VEML3328 generated driver I2C interface header file.
Macro Definition Documentation
VEML3328_I2C_ERROR
#define VEML3328_I2C_ERROR (1U)
VEML3328_I2C_NO_ERROR
#define VEML3328_I2C_NO_ERROR (0U)
2.7.3.3.6 source/veml3328_types.h File Reference
This file contains type definitions for the I2C Color Sensor VEML3328 driver.
Data structures
struct VEML3328_DEVICE_CONTEXT
Structure containing the VEML3328 Color Sensor driver context used in the API routines.
struct VEML3328_DEVICE_INIT
Structure containing the VEML3328 Color Sensor Command register settings for the driver initialization.
Typedefs
typedef enum VEML3328_STATUS VEML3328_STATUS_t
typedef enum VEML3328_SD VEML3328_SD_t
typedef enum VEML3328_SD_ALS VEML3328_SD_ALS_t
typedef enum VEML3328_DG VEML3328_DG_t
typedef enum VEML3328_GAIN VEML3328_GAIN_t
typedef enum VEML3328_SENS VEML3328_SENS_t
typedef enum VEML3328_IT VEML3328_IT_t
typedef enum VEML3328_AF VEML3328_AF_t
typedef struct VEML3328_DEVICE_CONTEXT VEML3328_DEVICE_CONTEXT_t
typedef struct VEML3328_DEVICE_CONTEXT * VEML3328_DEVICE_CONTEXT_PTR
typedef struct VEML3328_DEVICE_INIT VEML3328_DEVICE_INIT_t
Enumerations
enum VEML3328_STATUS { VEML3328_NO_ERROR = 0U, VEML3328_ERROR = 1U, VEML3328_INVALID_PARAMETER = 104U, VEML3328_NULL_ERROR = 105U, VEML3328_COM_ERROR = 106U }
Enumeration of the VEML3328 Color Sensor driver status codes.
enum VEML3328_SD { POWER_ON, SHUTDOWN }
Enumeration of the VEML3328 Color Sensor Power options.
enum VEML3328_SD_ALS { ALL_CHANNELS, POWER_ON_G_C_IR }
Enumeration of the VEML3328 Color Sensor Power-on Channel options.
enum VEML3328_DG { DG_X1 = 0U, DG_X2 = 1U, DG_X4 = 2U }
Enumeration of the VEML3328 Color Sensor Differential Gain values.
enum VEML3328_GAIN { GAIN_X_HALF = 3U, GAIN_X1 = 0U, GAIN_X2 = 1, GAIN_X4 = 2U }
Enumeration of the VEML3328 Color Sensor Gain values.
enum VEML3328_SENS { HIGH_SENSITVITY, LOW_SENSITVITY }
Enumeration of the VEML3328 Color Sensor Sensitivity values.
enum VEML3328_IT { MS_50 = 0U, MS_100 = 1U, MS_200 = 2U, MS_400 = 3U }
Enumeration of the VEML3328 Color Sensor Integration Time values.
enum VEML3328_AF { AUTO, ACTIVE_FORCE }
Enumeration of the VEML3328 Color Sensor Measurement mode options.
Detailed Description
This file contains type definitions for the I2C Color Sensor VEML3328 driver.
I2C Color Sensor VEML3328 generated driver data types header file.
Typedef Documentation
VEML3328_AF_t
typedef enum VEML3328_AF VEML3328_AF_t
VEML3328_DEVICE_CONTEXT_PTR
typedef struct VEML3328_DEVICE_CONTEXT * VEML3328_DEVICE_CONTEXT_PTR
VEML3328_DEVICE_CONTEXT_t
typedef struct VEML3328_DEVICE_CONTEXT VEML3328_DEVICE_CONTEXT_t
VEML3328_DEVICE_INIT_t
typedef struct VEML3328_DEVICE_INIT VEML3328_DEVICE_INIT_t
VEML3328_DG_t
typedef enum VEML3328_DG VEML3328_DG_t
VEML3328_GAIN_t
typedef enum VEML3328_GAIN VEML3328_GAIN_t
VEML3328_IT_t
typedef enum VEML3328_IT VEML3328_IT_t
VEML3328_SD_ALS_t
typedef enum VEML3328_SD_ALS VEML3328_SD_ALS_t
VEML3328_SD_t
typedef enum VEML3328_SD VEML3328_SD_t
VEML3328_SENS_t
typedef enum VEML3328_SENS VEML3328_SENS_t
VEML3328_STATUS_t
typedef enum VEML3328_STATUS VEML3328_STATUS_t