color12 2.1.0.0
color12.h File Reference

This file contains API for Color 12 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  color12_t
 Color 12 Click context object. More...
 
struct  color12_cfg_t
 Color 12 Click configuration object. More...
 
struct  color12_config_t
 Color 12 Click sensor configuration object. More...
 

Macros

#define COLOR12_REG_SYSTEM_CONTROL   0x40
 Color 12 description register.
 
#define COLOR12_REG_MODE_CONTROL1   0x41
 
#define COLOR12_REG_MODE_CONTROL2   0x42
 
#define COLOR12_REG_MODE_CONTROL3   0x43
 
#define COLOR12_REG_RED_DATA_L   0x50
 
#define COLOR12_REG_RED_DATA_H   0x51
 
#define COLOR12_REG_GREEN_DATA_L   0x52
 
#define COLOR12_REG_GREEN_DATA_H   0x53
 
#define COLOR12_REG_BLUE_DATA_L   0x54
 
#define COLOR12_REG_BLUE_DATA_H   0x55
 
#define COLOR12_REG_IR_DATA_L   0x56
 
#define COLOR12_REG_IR_DATA_H   0x57
 
#define COLOR12_REG_FLICKER_DATA_L   0x58
 
#define COLOR12_REG_FLICKER_DATA_H   0x59
 
#define COLOR12_REG_FLICKER_COUNTER   0x5A
 
#define COLOR12_REG_FIFO_LEVEL   0x5B
 
#define COLOR12_REG_FIFO_DATA_L   0x5C
 
#define COLOR12_REG_FIFO_DATA_H   0x5D
 
#define COLOR12_REG_MANUFACTURER_ID   0x92
 
#define COLOR12_SET_SW_RESET   0x80
 Color 12 software reset data.
 
#define COLOR12_RGB_GAIN_X1   0x00
 Color 12 gain setting for RGB/IR sensor.
 
#define COLOR12_RGB_GAIN_X2   0x01
 
#define COLOR12_RGB_GAIN_X4   0x02
 
#define COLOR12_RGB_GAIN_X8   0x03
 
#define COLOR12_RGB_GAIN_X16   0x04
 
#define COLOR12_RGB_GAIN_X32   0x05
 
#define COLOR12_MEAS_MODE_55MS   0x01
 Color 12 measurement mode for RGB/IR data.
 
#define COLOR12_MEAS_MODE_100MS   0x02
 
#define COLOR12_FLC_GAIN_X1   0x00
 Color 12 gain setting for flicker sensor.
 
#define COLOR12_FLC_GAIN_X2   0x01
 
#define COLOR12_FLC_GAIN_X4   0x02
 
#define COLOR12_FLC_GAIN_X8   0x03
 
#define COLOR12_FLC_GAIN_X16   0x04
 
#define COLOR12_FLC_GAIN_X32   0x05
 
#define COLOR12_FLC_MODE_1KHZ   0x00
 Color 12 measurement mode for flicker data.
 
#define COLOR12_FLC_MODE_2KHZ   0x01
 
#define COLOR12_INT_SEL_DISABLE   0x00
 Color 12 interrupt selector data.
 
#define COLOR12_INT_SEL_RDY_RGB_IR   0x01
 
#define COLOR12_INT_SEL_RDY_FLICKER   0x02
 
#define COLOR12_INT_SEL_RDY_FIFO   0x03
 
#define COLOR12_RGB_EN_DISABLE   0x00
 Color 12 RGB/IR measurement mode.
 
#define COLOR12_RGB_EN_ENABLE   0x01
 
#define COLOR12_FLC_EN_DISABLE   0x00
 Color 12 flicker measurement mode.
 
#define COLOR12_FLC_EN_ENABLE   0x01
 
#define COLOR12_MANUFACTURER_ID   0xE0
 Color 12 manufacturer ID data.
 
#define COLOR12_DEVICE_ADDRESS   0x38
 Color 12 device address setting.
 
#define COLOR12_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  color12_return_value_t { COLOR12_OK = 0 , COLOR12_ERROR = -1 }
 Color 12 Click return value data. More...
 
enum  color12_color_sel_t { COLOR12_DATA_RED = 0 , COLOR12_DATA_GREEN , COLOR12_DATA_BLUE , COLOR12_DATA_IR }
 Color 12 Click color selection value data. More...
 

Functions

void color12_cfg_setup (color12_cfg_t *cfg)
 Color 12 configuration object setup function.
 
err_t color12_init (color12_t *ctx, color12_cfg_t *cfg)
 Color 12 initialization function.
 
err_t color12_default_cfg (color12_t *ctx)
 Color 12 default configuration function.
 
err_t color12_generic_write (color12_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Color 12 I2C writing function.
 
err_t color12_generic_read (color12_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Color 12 I2C reading function.
 
err_t color12_sw_reset (color12_t *ctx)
 Color 12 software reset function.
 
err_t color12_set_config (color12_t *ctx, color12_config_t config)
 Color 12 sets the configuration function.
 
err_t color12_get_config (color12_t *ctx, color12_config_t *config)
 Color 12 gets the configuration function.
 
err_t color12_get_color_data (color12_t *ctx, color12_color_sel_t color_sel, uint16_t *color_data)
 Color 12 gets the color measurement result function.
 
err_t color12_get_device_id (color12_t *ctx, uint8_t *device_id)
 Color 12 gets the device ID function.
 
uint8_t color12_get_int_pin (color12_t *ctx)
 Color 12 gets the interrupt function.
 

Detailed Description

This file contains API for Color 12 Click Driver.

Enumeration Type Documentation

◆ color12_color_sel_t

Color 12 Click color selection value data.

Predefined enum values for driver color selection values.

Enumerator
COLOR12_DATA_RED 
COLOR12_DATA_GREEN 
COLOR12_DATA_BLUE 
COLOR12_DATA_IR 

◆ color12_return_value_t

Color 12 Click return value data.

Predefined enum values for driver return values.

Enumerator
COLOR12_OK 
COLOR12_ERROR