Package com.playingwithfusion
Class TMD37003
- java.lang.Object
- 
- com.playingwithfusion.TMD37003
 
- 
- All Implemented Interfaces:
- edu.wpi.first.util.sendable.Sendable,- java.lang.AutoCloseable
 
 public class TMD37003 extends java.lang.Object implements edu.wpi.first.util.sendable.Sendable, java.lang.AutoCloseable
- 
- 
Constructor SummaryConstructors Constructor Description TMD37003(edu.wpi.first.wpilibj.I2C.Port i2cPort)Create Instance of TMD3700 color sensor driver.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidconfigureColorSense(double alsIntegrationTime, int alsGain)Configure TMD3700 Color (Ambient Light Sensing) parameters.voidconfigureProximitySense(double proximitySampleTime, double proximityPulseLength, int numProximityPulses, int proximityGain, int proximityLedCurrent)Configure TMD3700 Proximity sense parameters.doublegetAmbientLightLevel()Get clear (Ambient) channel value.doublegetBlue()Get blue channel value.doublegetGreen()Get green channel value.doublegetHue()Get the measured color (hue).doublegetProximity()Get proximity value.doublegetRed()Get red channel value.doublegetSaturation()Get measured color saturation.voidinitSendable(edu.wpi.first.util.sendable.SendableBuilder builder)voidsetGain(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.
 
- 
- 
- 
Method Detail- 
closepublic void close() - Specified by:
- closein interface- java.lang.AutoCloseable
 
 - 
initSendablepublic void initSendable(edu.wpi.first.util.sendable.SendableBuilder builder) - Specified by:
- initSendablein interface- edu.wpi.first.util.sendable.Sendable
 
 - 
configureColorSensepublic void configureColorSense(double alsIntegrationTime, int alsGain)Configure TMD3700 Color (Ambient Light Sensing) parameters.- 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.
 
 - 
configureProximitySensepublic void configureProximitySense(double proximitySampleTime, double proximityPulseLength, int numProximityPulses, int proximityGain, int proximityLedCurrent)Configure TMD3700 Proximity sense parameters.- 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
 
 - 
setGainpublic void 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) - Parameters:
- r- Red channel gain
- g- Green channel gain
- b- Blue channel gain
- c- Clear (ambient) channel gain
- gamma- Gamma vaule used to convert raw (linear) samples to something that responds like a human eye
 
 - 
getHuepublic double getHue() Get the measured color (hue).- Returns:
- Measured hue in degrees
 
 - 
getSaturationpublic double getSaturation() Get measured color saturation.- Returns:
- Measured saturation as ratio between 0 and 1
 
 - 
getRedpublic double getRed() Get red channel value.- Returns:
- Normalized red channel value as ratio between 0 and 1..
 
 - 
getGreenpublic double getGreen() Get green channel value.- Returns:
- Normalized green channel value as ratio between 0 and 1..
 
 - 
getBluepublic double getBlue() Get blue channel value.- Returns:
- Normalized blue channel value as ratio between 0 and 1..
 
 - 
getAmbientLightLevelpublic double getAmbientLightLevel() Get clear (Ambient) channel value.- Returns:
- Normalized clear channel value as ratio between 0 and 1.
 
 - 
getProximitypublic double getProximity() Get proximity value.- Returns:
- Normalized proximity value as ratio between 0 and 1.
 
 
- 
 
-