color2  2.0.0.0
Data Structures | Macros | Functions
color2.h File Reference

This file contains API for Color 2 Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  color2_t
 Click ctx object definition. More...
 
struct  color2_cfg_t
 Click configuration structure definition. More...
 

Macros

#define COLOR2_MAP_MIKROBUS(cfg, mikrobus)
 
#define COLOR2_RETVAL   uint8_t
 
#define COLOR2_OK   0x00
 
#define COLOR2_INIT_ERROR   0xFF
 
#define COLOR2_I2C_ADDR   0x44
 
#define COLOR2_DEVICE_ID   0x00
 
#define COLOR2_CONFIG_1   0x01
 
#define COLOR2_CONFIG_2   0x02
 
#define COLOR2_CONFIG_3   0x03
 
#define COLOR2_THRESHOLD_LL   0x04
 
#define COLOR2_THRESHOLD_LH   0x05
 
#define COLOR2_THRESHOLD_HL   0x06
 
#define COLOR2_THRESHOLD_HH   0x07
 
#define COLOR2_STATUS   0x08
 
#define COLOR2_GREEN_L   0x09
 
#define COLOR2_GREEN_H   0x0A
 
#define COLOR2_RED_L   0x0B
 
#define COLOR2_RED_H   0x0C
 
#define COLOR2_BLUE_L   0x0D
 
#define COLOR2_BLUE_H   0x0E
 
#define COLOR2_CFG_DEFAULT   0x00
 
#define COLOR2_CFG1_MODE_POWERDOWN   0x00
 
#define COLOR2_CFG1_MODE_G   0x01
 
#define COLOR2_CFG1_MODE_R   0x02
 
#define COLOR2_CFG1_MODE_B   0x03
 
#define COLOR2_CFG1_MODE_STANDBY   0x04
 
#define COLOR2_CFG1_MODE_RGB   0x05
 
#define COLOR2_CFG1_MODE_RG   0x06
 
#define COLOR2_CFG1_MODE_GB   0x07
 
#define COLOR2_CFG1_375LUX   0x00
 
#define COLOR2_CFG1_10KLUX   0x08
 
#define COLOR2_CFG1_16BIT   0x00
 
#define COLOR2_CFG1_12BIT   0x10
 
#define COLOR2_CFG1_ADC_SYNC_NORMAL   0x00
 
#define COLOR2_CFG1_ADC_SYNC_TO_INT   0x20
 
#define COLOR2_CFG2_IR_OFFSET_OFF   0x00
 
#define COLOR2_CFG2_IR_OFFSET_ON   0x80
 
#define COLOR2_CFG2_IR_ADJUST_LOW   0x00
 
#define COLOR2_CFG2_IR_ADJUST_MID   0x20
 
#define COLOR2_CFG2_IR_ADJUST_HIGH   0x3F
 
#define COLOR2_CFG3_NO_INT   0x00
 
#define COLOR2_CFG3_G_INT   0x01
 
#define COLOR2_CFG3_R_INT   0x02
 
#define COLOR2_CFG3_B_INT   0x03
 
#define COLOR2_CFG3_INT_PRST1   0x00
 
#define COLOR2_CFG3_INT_PRST2   0x04
 
#define COLOR2_CFG3_INT_PRST4   0x08
 
#define COLOR2_CFG3_INT_PRST8   0x0C
 
#define COLOR2_CFG3_RGB_CONV_TO_INT_DISABLE   0x00
 
#define COLOR2_CFG3_RGB_CONV_TO_INT_ENABLE   0x10
 
#define COLOR2_FLAG_INT   0x01
 
#define COLOR2_FLAG_CONV_DONE   0x02
 
#define COLOR2_FLAG_BROWNOUT   0x04
 
#define COLOR2_FLAG_CONV_G   0x10
 
#define COLOR2_FLAG_CONV_R   0x20
 
#define COLOR2_FLAG_CONV_B   0x30
 

Functions

void color2_cfg_setup (color2_cfg_t *cfg)
 Config Object Initialization function. More...
 
COLOR2_RETVAL color2_init (color2_t *ctx, color2_cfg_t *cfg)
 Initialization function. More...
 
void color2_default_cfg (color2_t *ctx)
 Click Default Configuration function. More...
 
void color2_write_data (color2_t *ctx, uint8_t address, uint8_t write_command)
 Generic write data function. More...
 
uint8_t color2_read_data (color2_t *ctx, uint8_t address)
 Generic read data function. More...
 
uint8_t color2_reset (color2_t *ctx)
 Reset default register value function. More...
 
uint8_t color2_init_advanced (color2_t *ctx, uint8_t config1, uint8_t config2, uint8_t config3)
 Generic read data function. More...
 
void color2_set_upper_threshold (color2_t *ctx, uint16_t upper_threshold)
 Function set upper threshold register. More...
 
void color2_set_lower_hreshold (color2_t *ctx, uint16_t lower_threshold)
 Function set lower threshold register. More...
 
uint16_t color2_read_upper_threshold (color2_t *ctx)
 Function read upper threshold register. More...
 
uint16_t color2_read_lower_threshold (color2_t *ctx)
 Function read lower threshold register. More...
 
float color2_read_red (color2_t *ctx)
 Function read red color data. More...
 
float color2_read_green (color2_t *ctx)
 Function read green color data. More...
 
float color2_read_blue (color2_t *ctx)
 Function read blue color data. More...
 
uint8_t color2_read_status (color2_t *ctx)
 Function read status registe value. More...
 
float color2_get_color_value (color2_t *ctx)
 Functions for read color value. More...
 
uint8_t color2_get_color (float color_value)
 Functions for detect colors. More...
 

Detailed Description

This file contains API for Color 2 Click driver.