libPlayingWithFusion 2022.01.12
Playing With Fusion driver library for FRC roboRIO
|
#include <TMD37003.h>
Public Member Functions | |
TMD37003 (I2C::Port i2cPort) | |
void | ConfigureColorSense (double alsIntegrationTime, int alsGain) |
void | ConfigureProximitySense (double proximitySampleTime, double proximityPulseLength, int numProximityPulses, int proximityGain, int proximityLedCurrent) |
void | SetGain (double r, double g, double b, double c, double gamma) |
Color | GetColor () |
double | GetHue () |
double | GetSaturation () |
double | GetRed () |
double | GetGreen () |
double | GetBlue () |
double | GetAmbientLightLevel () |
double | GetProximity () |
TMD37003::TMD37003 | ( | I2C::Port | i2cPort | ) |
Create Instance of TMD3700 color sensor driver.
i2cPort | Internal/MXP I2C port on the roboRIO |
void TMD37003::ConfigureColorSense | ( | double | alsIntegrationTime, |
int | alsGain | ||
) |
Configure TMD3700 Color (Ambient Light Sensing) parameters.
alsIntegrationTime | Color sensing sample time in milliseconds. Value may range from 2.8 to 721ms. Longer sample times act to filtered the sampled color. |
alsGain | Color sensor gain as a value between 1 and 64. |
void TMD37003::ConfigureProximitySense | ( | double | proximitySampleTime, |
double | proximityPulseLength, | ||
int | numProximityPulses, | ||
int | proximityGain, | ||
int | proximityLedCurrent | ||
) |
Configure TMD3700 Proximity sense parameters.
proximitySampleTime | Proximity sensing sample time in milliseconds. Value may range from 0.088 to 22.528 ms. |
proximityPulseLength | Lengh of each IR LED pulse during proximity measurement in milliseconds. Value must fall between 0.004 and 0.032 ms. |
numProximityPulses | Number of proximity IR LED pulses which occur during each sample period |
proximityGain | Proximity sensor gain as a value between 1 and 8. |
proximityLedCurrent | Proximity IR LED current in milliamps. Value must fall between 6 and 192 mA |
double TMD37003::GetAmbientLightLevel | ( | ) |
Get clear (Ambient) channel value.
double TMD37003::GetBlue | ( | ) |
Get blue channel value.
Color TMD37003::GetColor | ( | ) |
Get gamma corrected RGB values from sensor
double TMD37003::GetGreen | ( | ) |
Get green channel value.
double TMD37003::GetHue | ( | ) |
Get the measured color (hue).
double TMD37003::GetProximity | ( | ) |
Get proximity value.
double TMD37003::GetRed | ( | ) |
Get red channel value.
double TMD37003::GetSaturation | ( | ) |
Get measured color saturation.
void TMD37003::SetGain | ( | double | r, |
double | g, | ||
double | b, | ||
double | c, | ||
double | gamma | ||
) |
Specifiy gains and gamma value to convert raw RGB samples to normalized RGB values to aproximate sRGB space.
The default gains are calibrated for the built in white LED. If another lighting source is used this function may be required to specify the white point.
Channels are calculated using:
{Normilized value} = ({Raw value} * gain) ^ (1/gamma)
r | Red channel gain |
g | Green channel gain |
b | Blue channel gain |
c | Clear (ambient) channel gain |
gamma | Gamma vaulke used to convert raw (linear) samples to something that responds like a human eye |