color 2.0.0.0
Public function

Functions

void color_cfg_setup (color_cfg_t *cfg)
 Config Object Initialization function.
 
COLOR_RETVAL color_init (color_t *ctx, color_cfg_t *cfg)
 Initialization function.
 
void color_default_cfg (color_t *ctx)
 Click Default Configuration function.
 
void color_generic_write (color_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void color_generic_read (color_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void color_write_byte (color_t *ctx, uint8_t reg, uint8_t data_to_write)
 Write one byte to register.
 
uint16_t color_read_data (color_t *ctx, uint8_t reg)
 Read 16-bit data from register.
 
float color_read_color_ratio (color_t *ctx, uint8_t color)
 Read color ratio from register.
 
float color_get_color_value (color_t *ctx)
 Functions for read color value.
 
uint8_t color_get_color (float color_value)
 Detect color.
 
uint8_t color_get_interrupt (color_t *ctx)
 Get interrupt pin state.
 
void color_set_led (color_t *ctx, uint8_t red, uint8_t green, uint8_t blue)
 Functions for set Led lights.
 

Detailed Description

Function Documentation

◆ color_cfg_setup()

void color_cfg_setup ( color_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ color_default_cfg()

void color_default_cfg ( color_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for Color click.

◆ color_generic_read()

void color_generic_read ( color_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

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

@description This function reads data from the desired register.

◆ color_generic_write()

void color_generic_write ( color_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function writes data to the desired register.

◆ color_get_color()

uint8_t color_get_color ( float color_value)

Detect color.

Parameters
color_valueColor value in HSL.
Returns
Color flag.

@description This function determines which color is read by click sensor after color_get_color_value() function has been invoked previously.

Note
Detect color
   ORANGE color - from 0.992  to 0.999
   RED color    - from 0.9750 to 0.9919
   PINK color   - from 0.920  to 0.9749
   PURPLE color - from 0.6201 to 0.919
   BLUE color   - from 0.521  to 0.6200
   CYAN color   - from 0.4700 to 0.520
   GREEN color  - from 0.210  to 0.469
   YELLOW color - from 0.0650 to 0.209

◆ color_get_color_value()

float color_get_color_value ( color_t * ctx)

Functions for read color value.

Parameters
ctxClick object.
Returns
Color value in HSL.

@description This function reads 3 color filters and clear filters and converts the resulting color from RGBC to HSL. The color range is between 0.0650 and 1.0000.

◆ color_get_interrupt()

uint8_t color_get_interrupt ( color_t * ctx)

Get interrupt pin state.

Parameters
ctxClick object.
Returns
int pin state.

@description This function reads interrupt pin state.

◆ color_init()

COLOR_RETVAL color_init ( color_t * ctx,
color_cfg_t * cfg )

Initialization function.

Parameters
colorClick object.
cfgClick configuration structure.

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

◆ color_read_color_ratio()

float color_read_color_ratio ( color_t * ctx,
uint8_t color )

Read color ratio from register.

Parameters
ctxClick object.
colorColor to get ratio for.
Returns
Color ratio.

@description This function reads desired color ratio from register.

◆ color_read_data()

uint16_t color_read_data ( color_t * ctx,
uint8_t reg )

Read 16-bit data from register.

Parameters
ctxClick object.
regRegister in which the data will be written.
Returns
Two byte data which is read from the register

@description This function reads 2 bytes from register.

◆ color_set_led()

void color_set_led ( color_t * ctx,
uint8_t red,
uint8_t green,
uint8_t blue )

Functions for set Led lights.

Parameters
ctxClick object.
redEnable/disable red LED.
greenEnable/disable green LED.
blueEnable/disable blue LED.

@description This function enables and disables LEDs.

◆ color_write_byte()

void color_write_byte ( color_t * ctx,
uint8_t reg,
uint8_t data_to_write )

Write one byte to register.

Parameters
ctxClick object.
regRegister in which the data will be written.
data_to_writeData which be written to the register.

@description This function writes one byte to register.