Enum Class ColorPeriod
- All Implemented Interfaces:
Serializable
,Comparable<ColorPeriod>
,Constable
Enum representing the internal configuration of the Canandcolor's color IC.
Passed to
CanandcolorSettings.setColorIntegrationPeriod(ColorPeriod)
which may be then used with
Canandcolor.setSettings(CanandcolorSettings)
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 25 millisecondss to 400 milliseconds. 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 update less frequently, regardless of the device frame period.
The rate at which the color sensor produces new values once every integration period, so k400ms
will
produce a new color reading every 400 milliseconds, and k25ms
will produce a new reading every 25 milliseconds.
k25ms
.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic ColorPeriod
fromIndex
(int idx) Returns a corresponding color config from the index.int
getIndex()
Gets the corresponding index for the value in question.static ColorPeriod
Returns the enum constant of this class with the specified name.static ColorPeriod[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
k400ms
Sample the color sensor every 400 ms. -
k200ms
Sample the color sensor every 200 ms. -
k100ms
Sample the color sensor every 100 ms. -
k50ms
Sample the color sensor every 50 ms. -
k25ms
Sample the color sensor every 25 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. If the index value is invalid it will return the default.
-
getIndex
public int getIndex()Gets the corresponding index for the value in question.- Returns:
- the index value for the enum (used internally)
-