color15 2.0.0.0
Color 15 Click Driver

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

Topics

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

Functions

void color15_cfg_setup (color15_cfg_t *cfg)
 Color 15 configuration object setup function.
 
err_t color15_init (color15_t *ctx, color15_cfg_t *cfg)
 Color 15 initialization function.
 
err_t color15_default_cfg (color15_t *ctx)
 Color 15 default configuration function.
 
err_t color15_generic_write (color15_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Color 15 I2C writing function.
 
err_t color15_generic_read (color15_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Color 15 I2C reading function.
 
err_t color15_write_register (color15_t *ctx, uint8_t reg, uint8_t data_in)
 Color 15 write register function.
 
err_t color15_read_register (color15_t *ctx, uint8_t reg, uint8_t *data_out)
 Color 15 read register function.
 
err_t color15_check_communication (color15_t *ctx)
 Color 15 check communication function.
 
uint8_t color15_get_int_pin (color15_t *ctx)
 Color 15 get int pin function.
 
err_t color15_clear_interrupt (color15_t *ctx)
 Color 15 clear interrupt function.
 
err_t color15_set_wait_time (color15_t *ctx, uint16_t wait_time)
 Color 15 set wait time function.
 
err_t color15_set_cls_time (color15_t *ctx, uint8_t clsconv, uint8_t int_time)
 Color 15 set cls time function.
 
err_t color15_get_data (color15_t *ctx, color15_channels_t *channels)
 Color 15 get data function.
 
uint8_t color15_get_color (color15_hsl_t *hsl)
 Color 15 get color function.
 
void color15_rgbw_to_hsl (color15_t *ctx, color15_channels_t *rgbw, color15_hsl_t *hsl)
 Color 15 rgbw to hsl function.
 

Detailed Description

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

◆ color15_cfg_setup()

void color15_cfg_setup ( color15_cfg_t * cfg)

Color 15 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ color15_check_communication()

err_t color15_check_communication ( color15_t * ctx)

Color 15 check communication function.

This function checks the communication by reading and verifying the product ID.

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

◆ color15_clear_interrupt()

err_t color15_clear_interrupt ( color15_t * ctx)

Color 15 clear interrupt function.

This function clears all interrupt flags from INT_FLAG register.

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

◆ color15_default_cfg()

err_t color15_default_cfg ( color15_t * ctx)

Color 15 default configuration function.

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

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

◆ color15_generic_read()

err_t color15_generic_read ( color15_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Color 15 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 color15_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.

◆ color15_generic_write()

err_t color15_generic_write ( color15_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Color 15 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 color15_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.

◆ color15_get_color()

uint8_t color15_get_color ( color15_hsl_t * hsl)

Color 15 get color function.

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

Parameters
[out]hsl: HSL (hue, saturation, lightness) input value. See color15_hsl_t object definition for detailed explanation.
Returns
Color name flag. See color flags macro definition for detailed explanation.
Note
None.

◆ color15_get_data()

err_t color15_get_data ( color15_t * ctx,
color15_channels_t * channels )

Color 15 get data function.

This function reads data from 5 channels (Red, Green, Blue, White, IR).

Parameters
[in]ctx: Click context object. See color15_t object definition for detailed explanation.
[out]channels: Channels output (Red, Green, Blue, White, IR). See color15_channels_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color15_get_int_pin()

uint8_t color15_get_int_pin ( color15_t * ctx)

Color 15 get int pin function.

This function returns the INT pin logic state.

Parameters
[in]ctx: Click context object. See color15_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ color15_init()

err_t color15_init ( color15_t * ctx,
color15_cfg_t * cfg )

Color 15 initialization function.

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

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

◆ color15_read_register()

err_t color15_read_register ( color15_t * ctx,
uint8_t reg,
uint8_t * data_out )

Color 15 read register function.

This function reads data from the selected register by using I2C serial interface.

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

◆ color15_rgbw_to_hsl()

void color15_rgbw_to_hsl ( color15_t * ctx,
color15_channels_t * rgbw,
color15_hsl_t * hsl )

Color 15 rgbw to hsl function.

This function converts RGBW (red, green, blue, white) to HSL (hue, saturation, lightness) color value.

Parameters
[in]ctx: Click context object. See color15_t object definition for detailed explanation.
[out]rgbw: RGBW (red, green, blue, white) input value. See color15_channels_t object definition for detailed explanation.
[out]hsl: HSL (hue, saturation, lightness) input value. See color15_hsl_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ color15_set_cls_time()

err_t color15_set_cls_time ( color15_t * ctx,
uint8_t clsconv,
uint8_t int_time )

Color 15 set cls time function.

This function sets the cls time and output data resolution in ctx->resolution.

Parameters
[in]ctx: Click context object. See color15_t object definition for detailed explanation.
[in]clsconv: CLSCONV bits settings [0x00-0x0F].
[in]int_time: INT_TIME bits settings [0x00-0x03].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
CLS TIME = CLSCONV * INT_TIME * 2.0667 ms.

◆ color15_set_wait_time()

err_t color15_set_wait_time ( color15_t * ctx,
uint16_t wait_time )

Color 15 set wait time function.

This function sets the wait time.

Parameters
[in]ctx: Click context object. See color15_t object definition for detailed explanation.
[in]wait_time: Wait time in milliseconds [10-2560].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Wait time feature needs to be enabled in the SYSM_CTRL register.

◆ color15_write_register()

err_t color15_write_register ( color15_t * ctx,
uint8_t reg,
uint8_t data_in )

Color 15 write register function.

This function writes a desired data to the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See color15_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.