color3 2.0.0.0
Public function

Functions

void color3_cfg_setup (color3_cfg_t *cfg)
 Config Object Initialization function.
 
err_t color3_init (color3_t *ctx, color3_cfg_t *cfg)
 Initialization function.
 
err_t color3_generic_write (color3_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Generic write function.
 
err_t color3_generic_read (color3_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Generic read function.
 
void color3_normal_wr_byte (color3_t *ctx, uint8_t wr_addr, uint8_t wr_data)
 Generic read function.
 
void color3_special_wr_byte (color3_t *ctx, uint8_t wr_addr, uint8_t wr_data)
 Special write byte function.
 
uint8_t color3_read_byte (color3_t *ctx, uint8_t rd_addr)
 Read byte function.
 
void color3_normal_wr_data (color3_t *ctx, uint8_t wr_addr, uint16_t wr_data)
 Normal write data function.
 
void color3_special_wr_data (color3_t *ctx, uint8_t wr_addr, uint16_t wr_data)
 Special write function.
 
uint16_t color3_read_data (color3_t *ctx, uint8_t rd_addr)
 Read data function.
 
void color3_write_enable_reg (color3_t *ctx, uint8_t wr_data)
 Write Enable Register function.
 
uint8_t color3_read_enable_reg (color3_t *ctx)
 Read Enable Register function.
 
void color3_write_rgbc_timing_reg (color3_t *ctx, uint8_t wr_data)
 Write RGBC Timing Register function.
 
uint8_t color3_read_rgbc_timing_reg (color3_t *ctx)
 Read RGBC Timing Register function.
 
void color3_write_prox_timing_reg (color3_t *ctx)
 Write Proximity Timing Register function.
 
uint8_t color3_read_prox_timing_reg (color3_t *ctx)
 Read Proximity Timing Register function.
 
void color3_write_wait_time_reg (color3_t *ctx, uint8_t wr_data)
 Write Wait Time Register function.
 
uint8_t color3_read_wait_time_reg (color3_t *ctx)
 Read Wait Time Register function.
 
void color3_set_inter_trsh_lo (color3_t *ctx, uint16_t wr_data)
 RGBC interrupt threshold low value function.
 
void color3_set_inter_trsh_hi (color3_t *ctx, uint16_t wr_data)
 RGBC interrupt threshold high value function.
 
void color3_set_prox_inter_trsh_lo (color3_t *ctx, uint16_t wr_data)
 Proximity interrupt threshold low value function.
 
void color3_set_prox_inter_trsh_hi (color3_t *ctx, uint16_t wr_data)
 Proximity interrupt threshold high value function.
 
void color3_set_int_pers (color3_t *ctx, uint8_t int_pers)
 Set Interrupt persistence persistence function.
 
uint8_t color3_read_int_pers (color3_t *ctx)
 Read Interrupt persistence function.
 
void color3_set_prox_int_pers (color3_t *ctx, uint8_t int_pers)
 Set Proximity interrupt persistence function.
 
uint8_t color3_read_prox_int_pers (color3_t *ctx)
 Read Proximity interrupt persistence function.
 
void color3_set_long_wait (color3_t *ctx, uint8_t lon_wait)
 Set long wait function.
 
uint8_t color3_read_long_wait (color3_t *ctx)
 Read long wait function.
 
void color3_write_pulse_cnt (color3_t *ctx, uint8_t pulse_cnt)
 Write Proximity Pulse Count function.
 
uint8_t color3_read_pulse_cnt (color3_t *ctx)
 Read Proximity Pulse Count function.
 
void color3_write_rgbc_gain (color3_t *ctx, uint8_t gain)
 Write RGBC Gain Value function.
 
uint8_t color3_read_rgbc_gain (color3_t *ctx)
 Read RGBC Gain Value function.
 
void color3_set_diode_select (color3_t *ctx, uint8_t dio_sel)
 Set Diode Selection function.
 
uint8_t color3_get_diode_select (color3_t *ctx)
 Get Diode Selection function.
 
void color3_set_led_str (color3_t *ctx, uint8_t led_str)
 Set LED Strength function.
 
uint8_t color3_read_led_str (color3_t *ctx)
 Read LED Strength function.
 
uint8_t color3_read_dev_id (color3_t *ctx)
 Read device ID function.
 
uint8_t color3_read_dev_stat (color3_t *ctx)
 Read device status function.
 
uint16_t color3_read_clear_data (color3_t *ctx)
 Read clear data function.
 
uint16_t color3_read_red_data (color3_t *ctx)
 Read red data function.
 
uint16_t color3_read_green_data (color3_t *ctx)
 Read green data function.
 
uint16_t color3_read_blue_data (color3_t *ctx)
 Read blue data function.
 
uint16_t color3_read_prox_data (color3_t *ctx)
 ead proximity data function.
 
uint8_t color3_get_inter_state (color3_t *ctx)
 Get Interrupt state function.
 
void color3_set_default_settings (color3_t *ctx)
 Default settings function.
 
void color3_get_rgb_data (color3_t *ctx, uint16_t *red_data, uint16_t *green_data, uint16_t *blue_data)
 Get color data function.
 
float color3_get_color_ratio (color3_t *ctx, uint16_t color_data)
 Get color ratio function.
 
err_t color3_get_rgbc_data (color3_t *ctx, color3_channels_t *channels)
 Color 3 get rgbc data function.
 
uint8_t color3_get_color (color3_hsl_t *hsl)
 Color 3 get color function.
 
void color3_rgbc_to_hsl (color3_t *ctx, color3_channels_t *rgbc, color3_hsl_t *hsl)
 Color 3 rgbc to hsl function.
 

Detailed Description

Function Documentation

◆ color3_cfg_setup()

void color3_cfg_setup ( color3_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.

◆ color3_generic_read()

err_t color3_generic_read ( color3_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_outOutput data buf
lenNumber of the bytes to be read
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function reads data from the desired register.

◆ color3_generic_write()

err_t color3_generic_write ( color3_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_inData buf to be written.
lenNumber of the bytes in data buf.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function writes data to the desired register.

◆ color3_get_color()

uint8_t color3_get_color ( color3_hsl_t * hsl)

Color 3 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 color3_hsl_t object definition for detailed explanation.
Returns
Color name flag. See color flags macro definition for detailed explanation.
Note
None.

◆ color3_get_color_ratio()

float color3_get_color_ratio ( color3_t * ctx,
uint16_t color_data )

Get color ratio function.

Parameters
ctxClick object.
color_data16-bit data that represents colorr data.

This function reads data from the desired register.

◆ color3_get_diode_select()

uint8_t color3_get_diode_select ( color3_t * ctx)

Get Diode Selection function.

Parameters
ctxClick object.

Function is used to check diode selection.

◆ color3_get_inter_state()

uint8_t color3_get_inter_state ( color3_t * ctx)

Get Interrupt state function.

Parameters
ctxClick object.

Function is used to check if an interrupt has occured.

◆ color3_get_rgb_data()

void color3_get_rgb_data ( color3_t * ctx,
uint16_t * red_data,
uint16_t * green_data,
uint16_t * blue_data )

Get color data function.

Parameters
ctxClick object.
red_data16-bit data that represents red data.
green_data16-bit data that represents green data.
blue_data16-bit data that represents blue data.

Function is used to read red, green and blue data.

◆ color3_get_rgbc_data()

err_t color3_get_rgbc_data ( color3_t * ctx,
color3_channels_t * channels )

Color 3 get rgbc data function.

This function reads data from 4 channels (Red, Green, Blue, Clear).

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

◆ color3_init()

err_t color3_init ( color3_t * ctx,
color3_cfg_t * cfg )

Initialization function.

Parameters
color3Click 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.

◆ color3_normal_wr_byte()

void color3_normal_wr_byte ( color3_t * ctx,
uint8_t wr_addr,
uint8_t wr_data )

Generic read function.

Parameters
ctxNormal write byte function.
wrAddr8-bit register address.
wrData8-bit data to be written into register.

Function writes 2 bytes of data, with normal settings.

◆ color3_normal_wr_data()

void color3_normal_wr_data ( color3_t * ctx,
uint8_t wr_addr,
uint16_t wr_data )

Normal write data function.

Parameters
ctxClick object.
wr_addr8-bit register address.
wr_ata16-bit data to be written into registers.

Function writes 2 bytes of data, with normal settings.

◆ color3_read_blue_data()

uint16_t color3_read_blue_data ( color3_t * ctx)

Read blue data function.

Parameters
ctxClick object.

Function is used to read blue data.

◆ color3_read_byte()

uint8_t color3_read_byte ( color3_t * ctx,
uint8_t rd_addr )

Read byte function.

Parameters
ctxClick object.
rd_addr8-bit register address.

Function reads single byte of data from specified register.

◆ color3_read_clear_data()

uint16_t color3_read_clear_data ( color3_t * ctx)

Read clear data function.

Parameters
ctxClick object.

Function is used to read clear data.

◆ color3_read_data()

uint16_t color3_read_data ( color3_t * ctx,
uint8_t rd_addr )

Read data function.

Parameters
ctxClick object.
rd_addr8-bit register address.

Function reads 2 bytes of data from specified registers.

◆ color3_read_dev_id()

uint8_t color3_read_dev_id ( color3_t * ctx)

Read device ID function.

Parameters
ctxClick object.

Function is used to read the device's unique ID number.

◆ color3_read_dev_stat()

uint8_t color3_read_dev_stat ( color3_t * ctx)

Read device status function.

Parameters
ctxClick object.

Function is used to read the contents of device status register.

◆ color3_read_enable_reg()

uint8_t color3_read_enable_reg ( color3_t * ctx)

Read Enable Register function.

Parameters
ctxClick object.

Function is used to read from enable register.

◆ color3_read_green_data()

uint16_t color3_read_green_data ( color3_t * ctx)

Read green data function.

Parameters
ctxClick object.

Function is used to read green data.

◆ color3_read_int_pers()

uint8_t color3_read_int_pers ( color3_t * ctx)

Read Interrupt persistence function.

Parameters
ctxClick object.

Function is used to check RGBC interrupt persistence settings.

◆ color3_read_led_str()

uint8_t color3_read_led_str ( color3_t * ctx)

Read LED Strength function.

Parameters
ctxClick object.

Function is used to check LED drive strength.

◆ color3_read_long_wait()

uint8_t color3_read_long_wait ( color3_t * ctx)

Read long wait function.

Parameters
ctxClick object.

Function is used to check if the long wait is enabled or disabled.

◆ color3_read_prox_data()

uint16_t color3_read_prox_data ( color3_t * ctx)

ead proximity data function.

Parameters
ctxClick object.

Function is used to read proximity data.

◆ color3_read_prox_int_pers()

uint8_t color3_read_prox_int_pers ( color3_t * ctx)

Read Proximity interrupt persistence function.

Parameters
ctxClick object.

Function is used to check proximity interrupt persistence settings.

◆ color3_read_prox_timing_reg()

uint8_t color3_read_prox_timing_reg ( color3_t * ctx)

Read Proximity Timing Register function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

Function is used to read from proximity timing register.

◆ color3_read_pulse_cnt()

uint8_t color3_read_pulse_cnt ( color3_t * ctx)

Read Proximity Pulse Count function.

Parameters
ctxClick object.

Function is used to check set number of proximity pulses that will be transmitted.

◆ color3_read_red_data()

uint16_t color3_read_red_data ( color3_t * ctx)

Read red data function.

Parameters
ctxClick object.

Function is used to read red data.

◆ color3_read_rgbc_gain()

uint8_t color3_read_rgbc_gain ( color3_t * ctx)

Read RGBC Gain Value function.

Parameters
ctxClick object.

Function is used to check RGBC Gain Value.

◆ color3_read_rgbc_timing_reg()

uint8_t color3_read_rgbc_timing_reg ( color3_t * ctx)

Read RGBC Timing Register function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

Function is used to read from RGBC timing register..

◆ color3_read_wait_time_reg()

uint8_t color3_read_wait_time_reg ( color3_t * ctx)

Read Wait Time Register function.

Parameters
ctxClick object.

Function is used to read from wait time register.

◆ color3_rgbc_to_hsl()

void color3_rgbc_to_hsl ( color3_t * ctx,
color3_channels_t * rgbc,
color3_hsl_t * hsl )

Color 3 rgbc to hsl function.

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

Parameters
[in]ctx: Click context object. See color3_t object definition for detailed explanation.
[out]rgbc: RGBC (red, green, blue, clear) input value. See color3_channels_t object definition for detailed explanation.
[out]hsl: HSL (hue, saturation, lightness) input value. See color3_hsl_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ color3_set_default_settings()

void color3_set_default_settings ( color3_t * ctx)

Default settings function.

Parameters
ctxClick object.

Function is used to apply default settings.

◆ color3_set_diode_select()

void color3_set_diode_select ( color3_t * ctx,
uint8_t dio_sel )

Set Diode Selection function.

Parameters
ctxClick object.
dio_sel8-bit data that is written into control register.

Function is used to perform diode selection.

◆ color3_set_int_pers()

void color3_set_int_pers ( color3_t * ctx,
uint8_t int_pers )

Set Interrupt persistence persistence function.

Parameters
ctxClick object.
int_pers8-bit data to be written into wait time register.

Function is used to control the filtering interrupt capabilities of the device.

◆ color3_set_inter_trsh_hi()

void color3_set_inter_trsh_hi ( color3_t * ctx,
uint16_t wr_data )

RGBC interrupt threshold high value function.

Parameters
ctxClick object.
wr_data16-bit data to be written into RGBC interrupt threshold high value registers.

Function is used to set RGBC interrupt threshold high value.

◆ color3_set_inter_trsh_lo()

void color3_set_inter_trsh_lo ( color3_t * ctx,
uint16_t wr_data )

RGBC interrupt threshold low value function.

Parameters
ctxClick object.
wr_data16-bit data to be written into RGBC interrupt threshold low value registers.

Function is used to set RGBC interrupt threshold low value.

◆ color3_set_led_str()

void color3_set_led_str ( color3_t * ctx,
uint8_t led_str )

Set LED Strength function.

Parameters
ctxClick object.
led_str8-bit data that is written into control register.

Function is used to set LED drive strength.

◆ color3_set_long_wait()

void color3_set_long_wait ( color3_t * ctx,
uint8_t lon_wait )

Set long wait function.

Parameters
ctxClick object.
lon_wait8-bit data that is written into configuration register.

Function is used to enable or disable long wait by writing into configuration register.

◆ color3_set_prox_int_pers()

void color3_set_prox_int_pers ( color3_t * ctx,
uint8_t int_pers )

Set Proximity interrupt persistence function.

Parameters
ctxClick object.
int_pers8-bit data that represents proximity interrupt persistence.

Function is used to control the filtering interrupt capabilities of the device.

◆ color3_set_prox_inter_trsh_hi()

void color3_set_prox_inter_trsh_hi ( color3_t * ctx,
uint16_t wr_data )

Proximity interrupt threshold high value function.

Parameters
ctxClick object.
wr_data16-bit data to be written into proximity interrupt threshold high value registers.

Function is used to set proximity interrupt threshold high value.

◆ color3_set_prox_inter_trsh_lo()

void color3_set_prox_inter_trsh_lo ( color3_t * ctx,
uint16_t wr_data )

Proximity interrupt threshold low value function.

Parameters
ctxClick object.
wr_data16-bit data to be written into proximity interrupt threshold low value registers.

Function is used to set proximity interrupt threshold low value.

◆ color3_special_wr_byte()

void color3_special_wr_byte ( color3_t * ctx,
uint8_t wr_addr,
uint8_t wr_data )

Special write byte function.

Parameters
ctxClick object.
wrAddr8-bit register address.
wrData8-bit data to be written into register.

Function writes 2 bytes of data, with special settings.

◆ color3_special_wr_data()

void color3_special_wr_data ( color3_t * ctx,
uint8_t wr_addr,
uint16_t wr_data )

Special write function.

Parameters
ctxClick object.
wr_addr8-bit register address.
wr_data16-bit data to be written into registers.

Function writes 2 bytes of data, with special settings.

◆ color3_write_enable_reg()

void color3_write_enable_reg ( color3_t * ctx,
uint8_t wr_data )

Write Enable Register function.

Parameters
ctxClick object.
wr_data8-bit data to be written into enable register.

Function is used to write into enable register.

◆ color3_write_prox_timing_reg()

void color3_write_prox_timing_reg ( color3_t * ctx)

Write Proximity Timing Register function.

Parameters
ctxClick object.
wr_data8-bit data to be written into proximity timing register.

Function is used to write into proximity timing register.

◆ color3_write_pulse_cnt()

void color3_write_pulse_cnt ( color3_t * ctx,
uint8_t pulse_cnt )

Write Proximity Pulse Count function.

Parameters
ctxClick object.
pulse_cnt8-bit data that is written into proximity pulse count register.

Function sets the number of proximity pulses that will be transmitted.

◆ color3_write_rgbc_gain()

void color3_write_rgbc_gain ( color3_t * ctx,
uint8_t gain )

Write RGBC Gain Value function.

Parameters
ctxClick object.
gain8-bit data that is written into control register.

Function is used to set RGBC Gain Value.

◆ color3_write_rgbc_timing_reg()

void color3_write_rgbc_timing_reg ( color3_t * ctx,
uint8_t wr_data )

Write RGBC Timing Register function.

Parameters
ctxClick object.
wr_data8-bit data to be written into RGBC timing register.

Function is used to write into RGBC timing register.

◆ color3_write_wait_time_reg()

void color3_write_wait_time_reg ( color3_t * ctx,
uint8_t wr_data )

Write Wait Time Register function.

Parameters
ctxClick object.
wr_data8-bit data to be written into wait time register.

Function is used to write into wait time register.