color15 2.0.0.0
color15.h File Reference

This file contains API for Color 15 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  color15_t
 Color 15 Click context object. More...
 
struct  color15_cfg_t
 Color 15 Click configuration object. More...
 
struct  color15_channels_t
 Color 15 RGBWIR channels data object. More...
 
struct  color15_hsl_t
 Color 15 HSL color data object. More...
 

Macros

#define COLOR15_REG_SYSM_CTRL   0x00
 Color 15 register map.
 
#define COLOR15_REG_INT_CTRL   0x01
 
#define COLOR15_REG_INT_FLAG   0x02
 
#define COLOR15_REG_WAIT_TIME   0x03
 
#define COLOR15_REG_CLS_GAIN   0x04
 
#define COLOR15_REG_CLS_TIME   0x05
 
#define COLOR15_REG_PERSISTENCE   0x0B
 
#define COLOR15_REG_CLS_THRES_LL   0x0C
 
#define COLOR15_REG_CLS_THRES_LH   0x0D
 
#define COLOR15_REG_CLS_THRES_HL   0x0E
 
#define COLOR15_REG_CLS_THRES_HH   0x0F
 
#define COLOR15_REG_INT_SOURCE   0x16
 
#define COLOR15_REG_ERROR_FLAG   0x17
 
#define COLOR15_REG_RCH_DATA_L   0x1C
 
#define COLOR15_REG_RCH_DATA_H   0x1D
 
#define COLOR15_REG_GCH_DATA_L   0x1E
 
#define COLOR15_REG_GCH_DATA_H   0x1F
 
#define COLOR15_REG_BCH_DATA_L   0x20
 
#define COLOR15_REG_BCH_DATA_H   0x21
 
#define COLOR15_REG_WCH_DATA_L   0x22
 
#define COLOR15_REG_WCH_DATA_H   0x23
 
#define COLOR15_REG_IRCH_DATA_L   0x24
 
#define COLOR15_REG_IRCH_DATA_H   0x25
 
#define COLOR15_REG_PROD_ID_L   0xBC
 
#define COLOR15_REG_PROD_ID_H   0xBD
 
#define COLOR15_SYSM_CTRL_SWRST   0x80
 Color 15 SYSM_CTRL register settings.
 
#define COLOR15_SYSM_CTRL_EN_WAIT   0x40
 
#define COLOR15_SYSM_CTRL_EN_IR   0x02
 
#define COLOR15_SYSM_CTRL_EN_CLS   0x01
 
#define COLOR15_INT_CTRL_CLS_SYNC   0x10
 Color 15 INT_CTRL register settings.
 
#define COLOR15_INT_CTRL_EN_CINT   0x01
 
#define COLOR15_INT_FLAG_POR   0x80
 Color 15 INT_FLAG register settings.
 
#define COLOR15_INT_FLAG_DATA_FLAG   0x40
 
#define COLOR15_INT_FLAG_CLS   0x01
 
#define COLOR15_INT_FLAG_CLEAR_ALL   0x00
 
#define COLOR15_WAIT_TIME_MS_MAX   2560
 Color 15 WAIT_TIME register settings.
 
#define COLOR15_WAIT_TIME_MS_DEFAULT   100
 
#define COLOR15_WAIT_TIME_MS_MIN   10
 
#define COLOR15_WAIT_TIME_MS_LSB   10
 
#define COLOR15_WAIT_TIME_RES   0xFF
 
#define COLOR15_CLSCONV_1   0x00
 Color 15 CLS_TIME register settings.
 
#define COLOR15_CLSCONV_2   0x01
 
#define COLOR15_CLSCONV_3   0x02
 
#define COLOR15_CLSCONV_4   0x03
 
#define COLOR15_CLSCONV_5   0x04
 
#define COLOR15_CLSCONV_6   0x05
 
#define COLOR15_CLSCONV_7   0x06
 
#define COLOR15_CLSCONV_8   0x07
 
#define COLOR15_CLSCONV_9   0x08
 
#define COLOR15_CLSCONV_10   0x09
 
#define COLOR15_CLSCONV_11   0x0A
 
#define COLOR15_CLSCONV_12   0x0B
 
#define COLOR15_CLSCONV_13   0x0C
 
#define COLOR15_CLSCONV_14   0x0D
 
#define COLOR15_CLSCONV_15   0x0E
 
#define COLOR15_INT_TIME_1   0x00
 
#define COLOR15_INT_TIME_4   0x01
 
#define COLOR15_INT_TIME_16   0x02
 
#define COLOR15_INT_TIME_64   0x03
 
#define COLOR15_MAX_COUNT_LSB   1024
 
#define COLOR15_MAX_COUNT_RES   0xFFFF
 
#define COLOR15_CLS_GAIN_DIOD_SELT_X1   0x00
 Color 15 CLS_GAIN register settings.
 
#define COLOR15_CLS_GAIN_DIOD_SELT_X2   0x80
 
#define COLOR15_CLS_GAIN_PGA_CLS_X1   0x01
 
#define COLOR15_CLS_GAIN_PGA_CLS_X4   0x02
 
#define COLOR15_CLS_GAIN_PGA_CLS_X8   0x04
 
#define COLOR15_CLS_GAIN_PGA_CLS_X32   0x08
 
#define COLOR15_CLS_GAIN_PGA_CLS_X96   0x10
 
#define COLOR15_PRS_CLS_INDEPENDENT   0x00
 Color 15 PERSISTANCE register settings.
 
#define COLOR15_PRS_CLS_1_CLS   0x01
 
#define COLOR15_PRS_CLS_2_CLS   0x02
 
#define COLOR15_PRS_CLS_3_CLS   0x03
 
#define COLOR15_PRS_CLS_4_CLS   0x04
 
#define COLOR15_PRS_CLS_5_CLS   0x05
 
#define COLOR15_PRS_CLS_6_CLS   0x06
 
#define COLOR15_PRS_CLS_7_CLS   0x07
 
#define COLOR15_PRS_CLS_8_CLS   0x08
 
#define COLOR15_PRS_CLS_9_CLS   0x09
 
#define COLOR15_PRS_CLS_10_CLS   0x0A
 
#define COLOR15_PRS_CLS_11_CLS   0x0B
 
#define COLOR15_PRS_CLS_12_CLS   0x0C
 
#define COLOR15_PRS_CLS_13_CLS   0x0D
 
#define COLOR15_PRS_CLS_14_CLS   0x0E
 
#define COLOR15_PRS_CLS_15_CLS   0x0F
 
#define COLOR15_INT_SRC_RCH_DATA   0x01
 Color 15 INT_SOURCE register settings.
 
#define COLOR15_INT_SRC_GCH_DATA   0x02
 
#define COLOR15_INT_SRC_BCH_DATA   0x04
 
#define COLOR15_INT_SRC_WCH_DATA   0x08
 
#define COLOR15_INT_SRC_IRCH_DATA   0x10
 
#define COLOR15_UNKNOWN_COLOR   0
 Color 15 color flags.
 
#define COLOR15_RED_COLOR   1
 
#define COLOR15_YELLOW_COLOR   2
 
#define COLOR15_GREEN_COLOR   3
 
#define COLOR15_CYAN_COLOR   4
 
#define COLOR15_BLUE_COLOR   5
 
#define COLOR15_MAGENTA_COLOR   6
 
#define COLOR15_WHITE_COLOR   7
 
#define COLOR15_BLACK_COLOR   8
 
#define COLOR15_WHITE_COLOR_LIGHTNESS   97
 Color 15 color from HSL thresholds.
 
#define COLOR15_BLACK_COLOR_LIGHTNESS   3
 
#define COLOR15_YELLOW_COLOR_HUE_ANGLE   30
 
#define COLOR15_GREEN_COLOR_HUE_ANGLE   90
 
#define COLOR15_CYAN_COLOR_HUE_ANGLE   150
 
#define COLOR15_BLUE_COLOR_HUE_ANGLE   210
 
#define COLOR15_MAGENTA_COLOR_HUE_ANGLE   270
 
#define COLOR15_RED_COLOR_HUE_ANGLE   330
 
#define COLOR15_HSL_HUE_RESOLUTION   360
 Color 15 RGB to HSL calculation values.
 
#define COLOR15_HSL_SATURATION_RESOLUTION   100
 
#define COLOR15_HSL_LIGHTNESS_RESOLUTION   100
 
#define COLOR15_PRODUCT_ID_LSB   0x12
 Color 15 product ID values.
 
#define COLOR15_PRODUCT_ID_MSB   0x07
 
#define COLOR15_DEVICE_ADDRESS   0x38
 Color 15 device address setting.
 
#define COLOR15_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  color15_return_value_t { COLOR15_OK = 0 , COLOR15_ERROR = -1 }
 Color 15 Click return value data. More...
 

Functions

void color15_cfg_setup (color15_cfg_t *cfg)
 Color 15 configuration object setup function.
 
err_t color15_init (color15_t *ctx, color15_cfg_t *cfg)
 Color 15 initialization function.
 
err_t color15_default_cfg (color15_t *ctx)
 Color 15 default configuration function.
 
err_t color15_generic_write (color15_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Color 15 I2C writing function.
 
err_t color15_generic_read (color15_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Color 15 I2C reading function.
 
err_t color15_write_register (color15_t *ctx, uint8_t reg, uint8_t data_in)
 Color 15 write register function.
 
err_t color15_read_register (color15_t *ctx, uint8_t reg, uint8_t *data_out)
 Color 15 read register function.
 
err_t color15_check_communication (color15_t *ctx)
 Color 15 check communication function.
 
uint8_t color15_get_int_pin (color15_t *ctx)
 Color 15 get int pin function.
 
err_t color15_clear_interrupt (color15_t *ctx)
 Color 15 clear interrupt function.
 
err_t color15_set_wait_time (color15_t *ctx, uint16_t wait_time)
 Color 15 set wait time function.
 
err_t color15_set_cls_time (color15_t *ctx, uint8_t clsconv, uint8_t int_time)
 Color 15 set cls time function.
 
err_t color15_get_data (color15_t *ctx, color15_channels_t *channels)
 Color 15 get data function.
 
uint8_t color15_get_color (color15_hsl_t *hsl)
 Color 15 get color function.
 
void color15_rgbw_to_hsl (color15_t *ctx, color15_channels_t *rgbw, color15_hsl_t *hsl)
 Color 15 rgbw to hsl function.
 

Detailed Description

This file contains API for Color 15 Click Driver.

Enumeration Type Documentation

◆ color15_return_value_t

Color 15 Click return value data.

Predefined enum values for driver return values.

Enumerator
COLOR15_OK 
COLOR15_ERROR