Go to the documentation of this file.
38 #include "mikrosdk_version.h"
41 #if mikroSDK_GET_VERSION < 20800ul
42 #include "rcu_delays.h"
48 #include "drv_digital_out.h"
49 #include "drv_digital_in.h"
50 #include "drv_i2c_master.h"
62 #define COLOR8_MAP_MIKROBUS( cfg, mikrobus ) \
63 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
64 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
65 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT );
72 #define COLOR8_RETVAL uint8_t
74 #define COLOR8_OK 0x00
75 #define COLOR8_INIT_ERROR 0xFF
82 #define COLOR8_REG_SYSTEM_CONTROL 0x40
83 #define COLOR8_REG_MODE_CONTROL_1 0x41
84 #define COLOR8_REG_MODE_CONTROL_2 0x42
85 #define COLOR8_REG_RED_DATA 0x50
86 #define COLOR8_REG_RED_DATA_LSB 0x50
87 #define COLOR8_REG_RED_DATA_MSB 0x51
88 #define COLOR8_REG_GREEN_DATA 0x52
89 #define COLOR8_REG_GREEN_DATA_LSB 0x52
90 #define COLOR8_REG_GREEN_DATA_MSB 0x53
91 #define COLOR8_REG_BLUE_DATA 0x54
92 #define COLOR8_REG_BLUE_DATA_LSB 0x54
93 #define COLOR8_REG_BLUE_DATA_MSB 0x55
94 #define COLOR8_REG_IR_DATA 0x58
95 #define COLOR8_REG_IR_DATA_LSB 0x58
96 #define COLOR8_REG_IR_DATA_MSB 0x59
97 #define COLOR8_REG_GREEN_DATA_2 0x5A
98 #define COLOR8_REG_GREEN_DATA_2_LSB 0x5A
99 #define COLOR8_REG_GREEN_DATA_2_MSB 0x5B
100 #define COLOR8_REG_INTERRUPT 0x60
101 #define COLOR8_REG_PERSISTENCE 0x61
102 #define COLOR8_REG_THRESHOLD_HIGH_LSB 0x62
103 #define COLOR8_REG_THRESHOLD_HIGH_MSB 0x63
104 #define COLOR8_REG_THRESHOLD_LOW_LSB 0x64
105 #define COLOR8_REG_THRESHOLD_LOW_MSB 0x65
106 #define COLOR8_REG_MANUFACTURER_ID 0x92
113 #define COLOR8_SS_SW_RESET_IS_NOT_DONE 0x00
114 #define COLOR8_SS_SW_RESET_IS_DONE 0x80
115 #define COLOR8_SS_INT_PIN_IS_NOT_ACTIVE 0x00
116 #define COLOR8_SS_INT_PIN_IS_ACTIVE 0x40
123 #define COLOR8_MC1_IR_DATA_GAIN_X1 0x20
124 #define COLOR8_MC1_IR_DATA_GAIN_X32 0x60
125 #define COLOR8_MC1_RGB_DATA_GAIN_X1 0x08
126 #define COLOR8_MC1_RGB_DATA_GAIN_X32 0x18
127 #define COLOR8_MC1_MEASURE_MODE_120ms 0x02
128 #define COLOR8_MC1_MEASURE_MODE_240ms 0x03
129 #define COLOR8_MC1_MEASURE_MODE_35ms 0x05
136 #define COLOR8_MC2_MEASUREMENT_IS_ACTIVE 0x10
137 #define COLOR8_MC2_MEASUREMENT_IS_INACTIVE 0x00
144 #define COLOR8_INT_INTERRUPT_SIGNAL_IS_ACTIVE 0x80
145 #define COLOR8_INT_RED_CHANNEL 0x00
146 #define COLOR8_INT_GREEN_CHANNEL 0x02
147 #define COLOR8_INT_BLUE_CHANNEL 0x04
148 #define COLOR8_INT_PIN_DISABLE 0x00
149 #define COLOR8_INT_PIN_ENABLE 0x01
156 #define COLOR8_PERSISTENCE_INT_SETTINGS_0 0x00
157 #define COLOR8_PERSISTENCE_INT_SETTINGS_1 0x01
158 #define COLOR8_PERSISTENCE_INT_SETTINGS_2 0x02
159 #define COLOR8_PERSISTENCE_INT_SETTINGS_3 0x03
166 #define COLOR8_DEF_MANUFACTURER_ID 0xE0
167 #define COLOR8_DEF_PART_ID 0x0D
168 #define COLOR8_DEF_SLAVE_ADDRESS_0 0x38
169 #define COLOR8_DEF_SLAVE_ADDRESS_1 0x39
176 #define ORANGE_COLOR_FLAG 1
177 #define RED_COLOR_FLAG 2
178 #define PINK_COLOR_FLAG 3
179 #define PURPLE_COLOR_FLAG 4
180 #define BLUE_COLOR_FLAG 5
181 #define CYAN_COLOR_FLAG 6
182 #define GREEN_COLOR_FLAG 7
183 #define YELLOW_COLOR_FLAG 8
184 #define NON_COLOR_FLAG 0
uint8_t color8_get_interrupt(color8_t *ctx)
Functions get interrupt.
void color8_cfg_setup(color8_cfg_t *cfg)
Config Object Initialization function.
uint8_t color8_get_color(color8_t *ctx, float color_value)
Functions for detect colors.
Click configuration structure definition.
Definition: color8.h:217
uint32_t i2c_speed
Definition: color8.h:229
COLOR8_RETVAL color8_init(color8_t *ctx, color8_cfg_t *cfg)
Initialization function.
void color8_write_byte(color8_t *ctx, uint8_t reg, uint8_t w_data)
Functions for write one byte in register.
float color8_get_color_value(color8_t *ctx)
Functions for read color value.
digital_in_t int_pin
Definition: color8.h:201
Click ctx object definition.
Definition: color8.h:198
pin_name_t sda
Definition: color8.h:221
uint8_t slave_address
Definition: color8.h:209
#define COLOR8_RETVAL
Definition: color8.h:72
pin_name_t int_pin
Definition: color8.h:225
uint8_t color8_read_byte(color8_t *ctx, uint8_t reg)
Functions for read one byte data from register.
void color8_generic_write(color8_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
pin_name_t scl
Definition: color8.h:220
i2c_master_t i2c
Definition: color8.h:205
void color8_generic_read(color8_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
uint16_t color8_read_data(color8_t *ctx, uint8_t reg_data)
Functions for read data from register.
uint8_t i2c_address
Definition: color8.h:230