Package com.diozero.ws281xj.spi
Enum WS281xSpi.Protocol
- java.lang.Object
-
- java.lang.Enum<WS281xSpi.Protocol>
-
- com.diozero.ws281xj.spi.WS281xSpi.Protocol
-
- All Implemented Interfaces:
Serializable
,Comparable<WS281xSpi.Protocol>
- Enclosing class:
- WS281xSpi
public static enum WS281xSpi.Protocol extends Enum<WS281xSpi.Protocol>
-
-
Enum Constant Summary
Enum Constants Enum Constant Description PROTOCOL_400KHZ
400kHz bit encodings: '0': --________ '1': -----_____ Timing requirements are derived from this document: http://www.adafruit.com/datasheets/WS2811.pdf The period is 2.5us, and we use a 10-bit packet for this encoding: '0': 1100000000 mark: 0.5us, space: 2us '1': 1111100000 mark: 1.25us, space: 1.25usPROTOCOL_800KHZ
800kHz bit encodings: '0': ----________ '1': --------____ The period is 1.25us, giving a basic frequency of 800kHz.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getFrequency()
static WS281xSpi.Protocol
valueOf(String name)
Returns the enum constant of this type with the specified name.static WS281xSpi.Protocol[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
PROTOCOL_800KHZ
public static final WS281xSpi.Protocol PROTOCOL_800KHZ
800kHz bit encodings: '0': ----________ '1': --------____ The period is 1.25us, giving a basic frequency of 800kHz. Getting the mark-space ratio right is trickier, though. There are a number of different timings, and the correct (documented) values depend on the controller chip. The _real_ timing restrictions are much simpler though, and someone has published a lovely analysis here: http://cpldcpu.wordpress.com/2014/01/14/light_ws2812-library-v2-0-part-i-understanding-the-ws2812/ In summary: - The period should be at least 1.25us. - The '0' high time can be anywhere from 0.0625us to 0.5us. - The '1' high time should be longer than 0.625us. These constraints are easy to meet by splitting each bit into three and packing them into SPI packets. '0': 100 mark: 0.42us, space: 0.83us '1': 110 mark: 0.83us, space: 0.42us
-
PROTOCOL_400KHZ
public static final WS281xSpi.Protocol PROTOCOL_400KHZ
400kHz bit encodings: '0': --________ '1': -----_____ Timing requirements are derived from this document: http://www.adafruit.com/datasheets/WS2811.pdf The period is 2.5us, and we use a 10-bit packet for this encoding: '0': 1100000000 mark: 0.5us, space: 2us '1': 1111100000 mark: 1.25us, space: 1.25us
-
-
Method Detail
-
values
public static WS281xSpi.Protocol[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (WS281xSpi.Protocol c : WS281xSpi.Protocol.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static WS281xSpi.Protocol valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
getFrequency
public int getFrequency()
-
-