color17 2.1.0.0
Color 17 Click Driver

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

Topics

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

Functions

void color17_cfg_setup (color17_cfg_t *cfg)
 Color 17 configuration object setup function.
 
err_t color17_init (color17_t *ctx, color17_cfg_t *cfg)
 Color 17 initialization function.
 
err_t color17_default_cfg (color17_t *ctx)
 Color 17 default configuration function.
 
err_t color17_generic_write (color17_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Color 17 I2C writing function.
 
err_t color17_generic_read (color17_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Color 17 I2C reading function.
 
err_t color17_write_reg (color17_t *ctx, uint8_t reg, uint16_t data_in)
 Color 17write register function.
 
err_t color17_read_reg (color17_t *ctx, uint8_t reg, uint16_t *data_out)
 Color 17 read register function.
 
err_t color17_get_device_id (color17_t *ctx, uint16_t *device_id)
 Color 17 gets device ID function.
 
err_t color17_set_config (color17_t *ctx, color17_config_t config)
 Color 17 set the configuration function.
 
err_t color17_get_status_flag (color17_t *ctx, color17_status_flag_t *status_flag)
 Color 17 gets the status flag function.
 
err_t color17_get_ch_measurement (color17_t *ctx, uint8_t ch, uint32_t *adc_codes)
 Color 17 gets the channel measurements data function.
 
err_t color17_get_measurement (color17_t *ctx, uint32_t *adc_codes)
 Color 17 gets light and color measurement data function.
 
err_t color17_get_cct (color17_t *ctx, float *cct, float *light_intensity)
 Color 17 gets correlated color temperature data function.
 
uint8_t color17_get_int_pin (color17_t *ctx)
 Color 17 gets interrupt function.
 

Detailed Description

API for configuring and manipulating Color 17 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

◆ color17_cfg_setup()

void color17_cfg_setup ( color17_cfg_t * cfg)

Color 17 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ color17_default_cfg()

err_t color17_default_cfg ( color17_t * ctx)

Color 17 default configuration function.

This function executes a default configuration of Color 17 click board.

Parameters
[in]ctx: Click context object. See color17_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.

◆ color17_generic_read()

err_t color17_generic_read ( color17_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Color 17 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 color17_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.

◆ color17_generic_write()

err_t color17_generic_write ( color17_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Color 17 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 color17_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.

◆ color17_get_cct()

err_t color17_get_cct ( color17_t * ctx,
float * cct,
float * light_intensity )

Color 17 gets correlated color temperature data function.

This function reads the measurements values of the all channels and calculate the correlated color temperature (CCT) and lux of the OPT4048DTSR, High-speed high-precision tristimulus XYZ color sensor on the Color 17 click board™.

Parameters
[in]ctx: Click context object. See color17_t object definition for detailed explanation.
[out]cct: Correlated color temperature.
[out]light_intensity: Light intensity (Lux).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color17_get_ch_measurement()

err_t color17_get_ch_measurement ( color17_t * ctx,
uint8_t ch,
uint32_t * adc_codes )

Color 17 gets the channel measurements data function.

This function reads the measurements values of the selected channel of the OPT4048DTSR, High-speed high-precision tristimulus XYZ color sensor on the Color 17 click board™.

Parameters
[in]ctx: Click context object. See color17_t object definition for detailed explanation.
[out]adc_codes: 28-bit ADC codes.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color17_get_device_id()

err_t color17_get_device_id ( color17_t * ctx,
uint16_t * device_id )

Color 17 gets device ID function.

This function reads a device ID of the OPT4048DTSR, High-speed high-precision tristimulus XYZ color sensor on the Color 17 click board™.

Parameters
[in]ctx: Click context object. See color17_t object definition for detailed explanation.
[out]device_id: Device ID.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color17_get_int_pin()

uint8_t color17_get_int_pin ( color17_t * ctx)

Color 17 gets interrupt function.

This function gets states of the Interrupt ( INT ) pin of the OPT4048DTSR, High-speed high-precision tristimulus XYZ color sensor on the Color 17 click board™.

Parameters
[in]ctx: Click context object. See color17_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ color17_get_measurement()

err_t color17_get_measurement ( color17_t * ctx,
uint32_t * adc_codes )

Color 17 gets light and color measurement data function.

This function reads the measurements values of the all channels by reading the device measures light on 4 independent channels of the OPT4048DTSR, High-speed high-precision tristimulus XYZ color sensor on the Color 17 click board™.

Parameters
[in]ctx: Click context object. See color17_t object definition for detailed explanation.
[out]adc_codes: 28-bit ADC codes.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color17_get_status_flag()

err_t color17_get_status_flag ( color17_t * ctx,
color17_status_flag_t * status_flag )

Color 17 gets the status flag function.

This function reads the status flag of the OPT4048DTSR, High-speed high-precision tristimulus XYZ color sensor on the Color 17 click board™.

Parameters
[in]ctx: Click context object. See color17_t object definition for detailed explanation.
[out]status_flag: Sensor status flag object. See color17_status_flag_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color17_init()

err_t color17_init ( color17_t * ctx,
color17_cfg_t * cfg )

Color 17 initialization function.

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

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

◆ color17_read_reg()

err_t color17_read_reg ( color17_t * ctx,
uint8_t reg,
uint16_t * data_out )

Color 17 read register function.

This function reads a datafrom the selected register of the OPT4048DTSR, High-speed high-precision tristimulus XYZ color sensor on the Color 17 click board™.

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

◆ color17_set_config()

err_t color17_set_config ( color17_t * ctx,
color17_config_t config )

Color 17 set the configuration function.

This function executes a configuration of the of the OPT4048DTSR, High-speed high-precision tristimulus XYZ color sensor on the Color 17 click board™.

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

◆ color17_write_reg()

err_t color17_write_reg ( color17_t * ctx,
uint8_t reg,
uint16_t data_in )

Color 17write register function.

This function writes 16-bit data to the selected register of the OPT4048DTSR, High-speed high-precision tristimulus XYZ color sensor on the Color 17 click board™.

Parameters
[in]ctx: Click context object. See color17_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: 16-bit data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.