color7  2.0.0.0
Functions
Public function

Functions

void color7_cfg_setup (color7_cfg_t *cfg)
 Config Object Initialization function. More...
 
COLOR7_RETVAL color7_init (color7_t *ctx, color7_cfg_t *cfg)
 Initialization function. More...
 
void color7_default_cfg (color7_t *ctx)
 Click Default Configuration function. More...
 
void color7_generic_write (color7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function. More...
 
void color7_generic_read (color7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function. More...
 
float color7_read_color_ratio (color7_t *ctx, uint8_t color)
 Functions for read color ratio. More...
 
float color7_get_color_value (color7_t *ctx)
 Functions for read color value. More...
 
uint8_t color7_get_color (color7_t *ctx)
 Functions for detect colors. More...
 
uint8_t color7_get_interrupt_state (color7_t *ctx)
 Get interrut pin state. More...
 

Detailed Description

Function Documentation

◆ color7_cfg_setup()

void color7_cfg_setup ( color7_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.

◆ color7_default_cfg()

void color7_default_cfg ( color7_t ctx)

Click Default Configuration function.

Parameters
ctxClick object.

This function executes default configuration for Color7 click.

Note
The default click set contains:
  • Register enable ** COLOR7_ENABLE_RGBC_INTERRUPT ** COLOR7_ENABLE_WAIT ** COLOR7_ENABLE_RGBC ** COLOR7_POWER_ON
  • Register ctrl ** COLOR7_CTRL_GAIN_x16
  • RGBC time ** COLOR7_RGBC_TIME_700ms

◆ color7_generic_read()

void color7_generic_read ( color7_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

This function reads data from the desired register.

◆ color7_generic_write()

void color7_generic_write ( color7_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.

This function writes data to the desired register.

◆ color7_get_color()

uint8_t color7_get_color ( color7_t ctx)

Functions for detect colors.

Return values
Colorflag
Note
   Detect color
      PINK color   - from 0.920  to 0.974
      PURPLE color - from 0.6201 to 0.919
      BLUE color   - from 0.521  to 0.620
      CYAN color   - from 0.430  to 0.520
      GREEN color  - from 0.300  to 0.429
      YELLOW color - from 0.019  to 0.200
      RED color    - from 0.0005 to 0.018

◆ color7_get_color_value()

float color7_get_color_value ( color7_t ctx)

Functions for read color value.

Parameters
ctxClick object.
Return values
Colorvalue in HSL
Note
This functions reas 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.

◆ color7_get_interrupt_state()

uint8_t color7_get_interrupt_state ( color7_t ctx)

Get interrut pin state.

Return values
INTpin state

◆ color7_init()

COLOR7_RETVAL color7_init ( color7_t ctx,
color7_cfg_t cfg 
)

Initialization function.

Parameters
color7Click object.
cfgClick configuration structure.

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

◆ color7_read_color_ratio()

float color7_read_color_ratio ( color7_t ctx,
uint8_t  color 
)

Functions for read color ratio.

Parameters
ctxClick object.
colorColor register which be read
Return values
colorratio data

Use this function when reading one color ratio