Enum Class Canandcolor.ColorPeriod
java.lang.Object
java.lang.Enum<Canandcolor.ColorPeriod>
com.reduxrobotics.sensors.canandcolor.Canandcolor.ColorPeriod
- All Implemented Interfaces:
Serializable
,Comparable<Canandcolor.ColorPeriod>
,Constable
- Enclosing class:
- Canandcolor
Enum representing the internal configuration of the Canandcolor's color IC.
Passed to
Canandcolor.Settings
which may be then used with
Canandcolor.setSettings(com.reduxrobotics.sensors.canandcolor.Canandcolor.Settings, double, int)
to configure the device.
The color sensor IC supports a single parameter that serves as both the integration and sampling period, which can be adjusted from 40 ms to 1280 ms. This period functions as a kind of "exposure time" -- longer periods mean colors at lower light can be read more accurately, but also mean they saturate faster in higher light conditions and have higher latency.
The default is 40 ms.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Canandcolor.ColorPeriod
fromIndex
(int idx) Returns a corresponding color config from the index.int
getIndex()
Gets the corresponding index for the value in question.static Canandcolor.ColorPeriod
Returns the enum constant of this class with the specified name.static Canandcolor.ColorPeriod[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
k40ms
Sample the color sensor every 40 ms. -
k80ms
Sample the color sensor every 80 ms. -
k160ms
Sample the color sensor every 160 ms. -
k320ms
Sample the color sensor every 320 ms. -
k640ms
Sample the color sensor every 640 ms. -
k1280ms
Sample the color sensor every 1280 ms.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
fromIndex
Returns a corresponding color config from the index.- Parameters:
idx
- the index to fetch.- Returns:
- a valid color config. Always guarenteed to return one.
-
getIndex
public int getIndex()Gets the corresponding index for the value in question.- Returns:
- the index value for the enum (used internally)
-