color2 2.0.0.0
Public function

Functions

void color2_cfg_setup (color2_cfg_t *cfg)
 Config Object Initialization function.
 
err_t color2_init (color2_t *ctx, color2_cfg_t *cfg)
 Initialization function.
 
err_t color2_default_cfg (color2_t *ctx)
 Click Default Configuration function.
 
err_t color2_generic_write (color2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Color 2 I2C writing function.
 
err_t color2_generic_read (color2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Color 2 I2C reading function.
 
err_t color2_write_reg (color2_t *ctx, uint8_t reg, uint8_t data_in)
 Generic write data function.
 
err_t color2_read_reg (color2_t *ctx, uint8_t reg, uint8_t *data_out)
 Generic read data function.
 
uint8_t color2_get_int_pin (color2_t *ctx)
 Get int pin function.
 
err_t color2_reset (color2_t *ctx)
 Reset default register value function.
 
err_t color2_init_advanced (color2_t *ctx, uint8_t config1, uint8_t config2, uint8_t config3)
 Init advanced function.
 
err_t color2_set_upper_threshold (color2_t *ctx, uint16_t upper_threshold)
 Function set upper threshold register.
 
err_t color2_set_lower_hreshold (color2_t *ctx, uint16_t lower_threshold)
 Function set lower threshold register.
 
err_t color2_read_upper_threshold (color2_t *ctx, uint16_t *upper_threshold)
 Function read upper threshold register.
 
err_t color2_read_lower_threshold (color2_t *ctx, uint16_t *lower_threshold)
 Function read lower threshold register.
 
err_t color2_read_rgb (color2_t *ctx, color2_rgb_t *rgb)
 Function read rgb data.
 
err_t color2_read_status (color2_t *ctx, uint8_t *status)
 Function read status registe value.
 
void color2_rgb_to_hsl (color2_t *ctx, color2_rgb_t *rgb, color2_hsl_t *hsl)
 Functions for read color value.
 
uint8_t color2_get_color (color2_hsl_t *hsl)
 Functions for detect colors.
 

Detailed Description

Function Documentation

◆ color2_cfg_setup()

void color2_cfg_setup ( color2_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ color2_default_cfg()

err_t color2_default_cfg ( color2_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function executes default configuration for Color2 click.

◆ color2_generic_read()

err_t color2_generic_read ( color2_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Color 2 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 color2_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.

◆ color2_generic_write()

err_t color2_generic_write ( color2_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Color 2 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 color2_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.

◆ color2_get_color()

uint8_t color2_get_color ( color2_hsl_t * hsl)

Functions for detect colors.

Parameters
ctxClick object.
hsl: HSL (hue, saturation, lightness) input value. See color2_hsl_t object definition for detailed explanation.
Returns
Color name flag. See color flags macro definition for detailed explanation.

This function returns the color name flag from the input HSL color.

◆ color2_get_int_pin()

uint8_t color2_get_int_pin ( color2_t * ctx)

Get int pin function.

Parameters
ctxClick object.
Returns
Pin logic state.

Function read INT pin logic state

◆ color2_init()

err_t color2_init ( color2_t * ctx,
color2_cfg_t * cfg )

Initialization function.

Parameters
color2Click object.
cfgClick configuration structure.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function initializes all necessary pins and peripherals used for this click.

◆ color2_init_advanced()

err_t color2_init_advanced ( color2_t * ctx,
uint8_t config1,
uint8_t config2,
uint8_t config3 )

Init advanced function.

Parameters
ctxClick object.
config1Register address config1
config2Register address config2
config3Register address config3
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Function read byte of data from register address of ISL29125

◆ color2_read_lower_threshold()

err_t color2_read_lower_threshold ( color2_t * ctx,
uint16_t * lower_threshold )

Function read lower threshold register.

Parameters
ctxClick object.
lower_thresholdLower Threshold 16-bit data
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Function read lower threshold register from ISL29125

◆ color2_read_reg()

err_t color2_read_reg ( color2_t * ctx,
uint8_t reg,
uint8_t * data_out )

Generic read data function.

Parameters
ctxClick object.
regRegister address
data_outData from addressed register in ISL29125
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Function read byte of data from register address of ISL29125

◆ color2_read_rgb()

err_t color2_read_rgb ( color2_t * ctx,
color2_rgb_t * rgb )

Function read rgb data.

Parameters
ctxClick object.
rgbRGB data See color2_rgb_t definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Function read red, green, and blue data from ISL29125

◆ color2_read_status()

err_t color2_read_status ( color2_t * ctx,
uint8_t * status )

Function read status registe value.

Parameters
ctxClick object.
status16-bit status data
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Function read status registe value from ISL29125

◆ color2_read_upper_threshold()

err_t color2_read_upper_threshold ( color2_t * ctx,
uint16_t * upper_threshold )

Function read upper threshold register.

Parameters
ctxClick object.
upper_thresholdUpper Threshold 16-bit data
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Function read upper threshold register from ISL29125

◆ color2_reset()

err_t color2_reset ( color2_t * ctx)

Reset default register value function.

Parameters
ctxClick object.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Reset default register value function ISL29125

◆ color2_rgb_to_hsl()

void color2_rgb_to_hsl ( color2_t * ctx,
color2_rgb_t * rgb,
color2_hsl_t * hsl )

Functions for read color value.

Parameters
ctxClick object.
rgb: RGB (red, green, blue) input value. See color2_rgb_t object definition for detailed explanation.
hsl: HSL (hue, saturation, lightness) input value. See color2_hsl_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function converts RGB (red, green, blue) to HSL (hue, saturation, lightness) color value.

◆ color2_set_lower_hreshold()

err_t color2_set_lower_hreshold ( color2_t * ctx,
uint16_t lower_threshold )

Function set lower threshold register.

Parameters
ctxClick object.
lower_thresholdLower threshold
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Function set lower threshold register of ISL29125

◆ color2_set_upper_threshold()

err_t color2_set_upper_threshold ( color2_t * ctx,
uint16_t upper_threshold )

Function set upper threshold register.

Parameters
ctxClick object.
upper_thresholdUpper threshold
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Function set upper threshold register of ISL29125

◆ color2_write_reg()

err_t color2_write_reg ( color2_t * ctx,
uint8_t reg,
uint8_t data_in )

Generic write data function.

Parameters
ctxClick object.
regRegister address
data_inCommand to write
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Function write byte of data to ISL29125