color4 2.1.0.0
Color 4 Click Driver

API for configuring and manipulating Color 4 Click driver. More...

Topics

 Color 4 Registers List
 List of registers of Color 4 Click driver.
 
 Color 4 Registers Settings
 Settings for registers of Color 4 Click driver.
 
 Color 4 MikroBUS Map
 MikroBUS pin mapping of Color 4 Click driver.
 

Functions

void color4_cfg_setup (color4_cfg_t *cfg)
 Color 4 configuration object setup function.
 
err_t color4_init (color4_t *ctx, color4_cfg_t *cfg)
 Color 4 initialization function.
 
err_t color4_default_cfg (color4_t *ctx)
 Color 4 default configuration function.
 
err_t color4_generic_write (color4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Color 4 I2C writing function.
 
err_t color4_generic_read (color4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Color 4 I2C reading function.
 
err_t color4_set_config (color4_t *ctx, color4_config_t config)
 Color 4 set configuration function.
 
err_t color4_get_config (color4_t *ctx, color4_config_t *config)
 Color 4 get configuration function.
 
err_t color4_get_color_data (color4_t *ctx, color4_ch_color_t ch_color, uint16_t *color_data)
 Color 4 get color data function.
 
err_t color4_get_ambient_light (color4_t *ctx, float *ambient_light)
 Color 4 get ambient light level function.
 
err_t color4_get_cct (color4_t *ctx, float *cct)
 Color 4 get CCT data function.
 

Detailed Description

API for configuring and manipulating Color 4 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ color4_cfg_setup()

void color4_cfg_setup ( color4_cfg_t * cfg)

Color 4 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See color4_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ color4_default_cfg()

err_t color4_default_cfg ( color4_t * ctx)

Color 4 default configuration function.

This function executes a default configuration: Integration time 320ms, no trigger, auto mode and enable color sensor of Color 4 click board™.

Parameters
[in]ctx: Click context object. See color4_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ color4_generic_read()

err_t color4_generic_read ( color4_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Color 4 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See color4_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color4_generic_write()

err_t color4_generic_write ( color4_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Color 4 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See color4_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color4_get_ambient_light()

err_t color4_get_ambient_light ( color4_t * ctx,
float * ambient_light )

Color 4 get ambient light level function.

This function reads the ambient light data and calculate of the VEML6040 RGBW Color Sensor with I2C Interface on the Color 4 click board™.

Parameters
[in]ctx: Click context object. See color4_t object definition for detailed explanation.
[out]ambient_light: Ambient light level in Lux.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
For results for calculating lux see “Designing the VEML6040 in application” application note (https://www.vishay.com/docs/84331/designingveml6040.pdf).

◆ color4_get_cct()

err_t color4_get_cct ( color4_t * ctx,
float * cct )

Color 4 get CCT data function.

This function reads the RGB color data and calculate the correlated color temperature (empirical approach) of the VEML6040 RGBW Color Sensor with I2C Interface on the Color 4 click board™.

Parameters
[in]ctx: Click context object. See color4_t object definition for detailed explanation.
[out]cct: Correlated color temperature.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
For results for calculating lux see, “Designing the VEML6040 in application” application note (https://www.vishay.com/docs/84331/designingveml6040.pdf).

◆ color4_get_color_data()

err_t color4_get_color_data ( color4_t * ctx,
color4_ch_color_t ch_color,
uint16_t * color_data )

Color 4 get color data function.

This function reads color data of the desired channel from which the data will be converted of the VEML6040 RGBW Color Sensor with I2C Interface on the Color 4 click board™.

Parameters
[in]ctx: Click context object. See color4_t object definition for detailed explanation.
[in]ch_color: Channel from which the data will be converted.
[out]color_data: Color data reads from the channel.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color4_get_config()

err_t color4_get_config ( color4_t * ctx,
color4_config_t * config )

Color 4 get configuration function.

This function reads the configuration data of the VEML6040 RGBW Color Sensor with I2C Interface on the Color 4 click board™.

Parameters
[in]ctx: Click context object. See color4_t object definition for detailed explanation.
[out]config: Sensor configuration object.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color4_init()

err_t color4_init ( color4_t * ctx,
color4_cfg_t * cfg )

Color 4 initialization function.

This function initializes all necessary pins and peripherals used for this click board™.

Parameters
[out]ctx: Click context object. See color4_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See color4_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color4_set_config()

err_t color4_set_config ( color4_t * ctx,
color4_config_t config )

Color 4 set configuration function.

This function executes a configuration of the VEML6040 RGBW Color Sensor with I2C Interface on the Color 4 click board™.

Parameters
[in]ctx: Click context object. See color4_t object definition for detailed explanation.
[in]config: Sensor configuration object.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.