Dezibot 4
Loading...
Searching...
No Matches
ColorDetection.h
Go to the documentation of this file.
1
12
#ifndef ColorDetection_h
13
#define ColorDetection_h
14
#include <stdint.h>
15
#include <Wire.h>
16
#include <Arduino.h>
17
//Definitions for I2c
18
#define I2C_MASTER_SCL_IO 2
19
#define I2C_MASTER_SDA_IO 1
21
//Chipadress of the VEML6040
22
#define VEML_ADDR 0x10
24
//CMDCodes for communicate with the VEML6040
25
#define CMD_CONFIG 0x00
26
#define REG_RED 0x08
27
#define REG_GREEN 0x09
28
#define REG_BLUE 0x0A
29
#define REG_WHITE 0x0B
30
31
32
enum
duration
{
33
MS40
,
34
MS80
,
35
MS160
,
36
MS320
,
37
MS640
,
38
MS1280
39
};
40
41
enum
vemlMode
{
42
AUTO
,
43
MANUAL
44
};
45
46
struct
VEML_CONFIG
{
47
vemlMode
mode
;
48
bool
enabled
;
49
duration
exposureTime
;
50
};
51
52
53
enum
color
{
54
VEML_RED
,
55
VEML_GREEN
,
56
VEML_BLUE
,
57
VEML_WHITE
58
};
59
class
ColorDetection
{
60
public
:
61
void
begin
(
void
);
62
void
configure
(
VEML_CONFIG
config);
63
uint16_t
getColorValue
(
color
color
);
64
protected
:
65
uint16_t
readDoubleRegister
(uint8_t regAddr);
66
void
writeDoubleRegister
(uint8_t regAddr, uint16_t data);
67
};
68
#endif
//ColorDetection_h
color
color
Definition
ColorDetection.h:53
VEML_GREEN
@ VEML_GREEN
Definition
ColorDetection.h:55
VEML_RED
@ VEML_RED
Definition
ColorDetection.h:54
VEML_BLUE
@ VEML_BLUE
Definition
ColorDetection.h:56
VEML_WHITE
@ VEML_WHITE
Definition
ColorDetection.h:57
duration
duration
Definition
ColorDetection.h:32
MS320
@ MS320
Definition
ColorDetection.h:36
MS160
@ MS160
Definition
ColorDetection.h:35
MS1280
@ MS1280
Definition
ColorDetection.h:38
MS40
@ MS40
Definition
ColorDetection.h:33
MS80
@ MS80
Definition
ColorDetection.h:34
MS640
@ MS640
Definition
ColorDetection.h:37
vemlMode
vemlMode
Definition
ColorDetection.h:41
MANUAL
@ MANUAL
Definition
ColorDetection.h:43
AUTO
@ AUTO
Definition
ColorDetection.h:42
ColorDetection
Definition
ColorDetection.h:59
ColorDetection::getColorValue
uint16_t getColorValue(color color)
Definition
ColorDetection.cpp:35
ColorDetection::begin
void begin(void)
Definition
ColorDetection.cpp:3
ColorDetection::readDoubleRegister
uint16_t readDoubleRegister(uint8_t regAddr)
Definition
ColorDetection.cpp:57
ColorDetection::configure
void configure(VEML_CONFIG config)
Definition
ColorDetection.cpp:6
ColorDetection::writeDoubleRegister
void writeDoubleRegister(uint8_t regAddr, uint16_t data)
Definition
ColorDetection.cpp:74
VEML_CONFIG
Definition
ColorDetection.h:46
VEML_CONFIG::exposureTime
duration exposureTime
Definition
ColorDetection.h:49
VEML_CONFIG::mode
vemlMode mode
Definition
ColorDetection.h:47
VEML_CONFIG::enabled
bool enabled
Definition
ColorDetection.h:48
src
colorDetection
ColorDetection.h
Generated by
1.11.0