|
Files | |
file | hitechnic-colour-v1.h |
HiTechnic Color Sensor driver. | |
Defines | |
#define | HTCS_I2C_ADDR 0x02 |
#define | HTCS_CMD_REG 0x41 |
#define | HTCS_OFFSET 0x42 |
#define | HTCS_COLNUM_REG 0x00 |
#define | HTCS_RED_REG 0x01 |
#define | HTCS_GREEN_REG 0x02 |
#define | HTCS_BLUE_REG 0x03 |
#define | HTCS_RED_RAW_REG 0x04 |
#define | HTCS_GREEN_RAW_REG 0x05 |
#define | HTCS_BLUE_RAW_REG 0x06 |
#define | HTSC_COL_INDEX_REG 0x07 |
#define | HTSC_RED_NORM_REG 0x08 |
#define | HTSC_GREEN_NORM_REG 0x09 |
#define | HTSC_BLUE_NORM_REG 0x0A |
#define | HTCS_CAL_WHITE 0x43 |
Functions | |
int | HTCSreadColor (tSensors link) |
bool | HTCSreadRGB (tSensors link, int &red, int &green, int &blue) |
bool | HTCSreadNormRGB (tSensors link, int &red, int &green, int &blue) |
bool | HTCSreadRawRGB (tSensors link, int &red, int &green, int &blue) |
bool | HTCScalWhite (tSensors link) |
int | HTCSreadColor (tMUXSensor muxsensor) |
bool | HTCSreadRGB (tMUXSensor muxsensor, int &red, int &green, int &blue) |
bool | HTCSreadHSV (tSensors link, float &hue, float &saturation, float &value) |
bool | HTCSreadHSV (tMUXSensor muxsensor, float &hue, float &saturation, float &value) |
int | HTCSreadColorIndex (tSensors link) |
Variables | |
tConfigParams | HTCS_config = {HTSMUX_CHAN_I2C, 4, 0x02, 0x42} |
tByteArray | HTCS_I2CRequest |
tByteArray | HTCS_I2CReply |
HiTechnic Color Sensor V1
#define HTCS_BLUE_RAW_REG 0x06 |
Raw blue reading (2 bytes)
Definition at line 62 of file hitechnic-colour-v1.h.
#define HTCS_BLUE_REG 0x03 |
Blue reading
Definition at line 59 of file hitechnic-colour-v1.h.
#define HTCS_CAL_WHITE 0x43 |
Command to calibrate white
Definition at line 68 of file hitechnic-colour-v1.h.
#define HTCS_CMD_REG 0x41 |
Command register
Definition at line 54 of file hitechnic-colour-v1.h.
#define HTCS_COLNUM_REG 0x00 |
Color number
Definition at line 56 of file hitechnic-colour-v1.h.
#define HTCS_GREEN_RAW_REG 0x05 |
Raw green reading (2 bytes)
Definition at line 61 of file hitechnic-colour-v1.h.
#define HTCS_GREEN_REG 0x02 |
Green reading
Definition at line 58 of file hitechnic-colour-v1.h.
#define HTCS_I2C_ADDR 0x02 |
HTCS I2C device address
Definition at line 53 of file hitechnic-colour-v1.h.
#define HTCS_OFFSET 0x42 |
Offset for data registers
Definition at line 55 of file hitechnic-colour-v1.h.
#define HTCS_RED_RAW_REG 0x04 |
Raw red reading (2 bytes)
Definition at line 60 of file hitechnic-colour-v1.h.
#define HTCS_RED_REG 0x01 |
Red reading
Definition at line 57 of file hitechnic-colour-v1.h.
#define HTSC_BLUE_NORM_REG 0x0A |
Normalised blue reading
Definition at line 66 of file hitechnic-colour-v1.h.
#define HTSC_COL_INDEX_REG 0x07 |
Color index number
Definition at line 63 of file hitechnic-colour-v1.h.
#define HTSC_GREEN_NORM_REG 0x09 |
Normalised green reading
Definition at line 65 of file hitechnic-colour-v1.h.
#define HTSC_RED_NORM_REG 0x08 |
Normalised red reading
Definition at line 64 of file hitechnic-colour-v1.h.
bool HTCScalWhite | ( | tSensors | link ) |
Calibrate the sensor for white.
link | the HTCS port number |
Definition at line 298 of file hitechnic-colour-v1.h.
int HTCSreadColor | ( | tSensors | link ) |
Return the color number currently detected.
link | the HTCS port number |
Definition at line 91 of file hitechnic-colour-v1.h.
int HTCSreadColor | ( | tMUXSensor | muxsensor ) |
Return the color number currently detected.
muxsensor | the SMUX sensor port number |
Definition at line 111 of file hitechnic-colour-v1.h.
int HTCSreadColorIndex | ( | tSensors | link ) |
Return the color index number currently detected. This is a single 6 bit number color index. Bits 5 and 4 encode the red signal level, bits 3 and 2 encode the green signal level and bits 1 and 0 encode the blue signal levels.
link | the HTCS port number |
Definition at line 280 of file hitechnic-colour-v1.h.
bool HTCSreadHSV | ( | tSensors | link, |
float & | hue, | ||
float & | saturation, | ||
float & | value | ||
) |
Get the detection levels for the hue, saturation, value components.
link | the HTCS port number |
hue | the hue output value (from 0 to 365, or -1 if n/a) |
saturation | the saruration output value (from 0 to 100, or -1 if n/a) |
value | the value output value (from 0 to 100) |
Definition at line 188 of file hitechnic-colour-v1.h.
bool HTCSreadHSV | ( | tMUXSensor | muxsensor, |
float & | hue, | ||
float & | saturation, | ||
float & | value | ||
) |
Get the detection levels for the hue, saturation, value components.
muxsensor | the SMUX sensor port number |
hue | the hue output value (from 0 to 365, or -1 if n/a) |
saturation | the saruration output value (from 0 to 100, or -1 if n/a) |
value | the value output value (from 0 to 100) |
Definition at line 207 of file hitechnic-colour-v1.h.
bool HTCSreadNormRGB | ( | tSensors | link, |
int & | red, | ||
int & | green, | ||
int & | blue | ||
) |
Get the normalised RGB readings. The normalization sets the highest value of the three Red, Green and Blue reading to 255 and adjusts the other two proportionately.
link | the HTCS port number |
red | the red value |
green | the green value |
blue | the blue value |
Definition at line 229 of file hitechnic-colour-v1.h.
bool HTCSreadRawRGB | ( | tSensors | link, |
int & | red, | ||
int & | green, | ||
int & | blue | ||
) |
Get the raw RGB readings, these are 10bit values.
link | the HTCS port number |
red | the red value |
green | the green value |
blue | the blue value |
Definition at line 255 of file hitechnic-colour-v1.h.
bool HTCSreadRGB | ( | tMUXSensor | muxsensor, |
int & | red, | ||
int & | green, | ||
int & | blue | ||
) |
Get the detection levels for the three color components.
muxsensor | the SMUX sensor port number |
red | the red value |
green | the green value |
blue | the blue value |
Definition at line 161 of file hitechnic-colour-v1.h.
bool HTCSreadRGB | ( | tSensors | link, |
int & | red, | ||
int & | green, | ||
int & | blue | ||
) |
Get the detection levels for the three color components.
link | the HTCS port number |
red | the red value |
green | the green value |
blue | the blue value |
Definition at line 134 of file hitechnic-colour-v1.h.
tConfigParams HTCS_config = {HTSMUX_CHAN_I2C, 4, 0x02, 0x42} |
Array to hold SMUX config data for sensor
Definition at line 80 of file hitechnic-colour-v1.h.
Array to hold I2C reply data
Definition at line 84 of file hitechnic-colour-v1.h.
Array to hold I2C command data
Definition at line 83 of file hitechnic-colour-v1.h.