public void LedStateErrorsWhenOutOfRangeIndexIsUsed()
        {
            var state = new LedState();
            var outOfRangeIndex = state.Length + 1;

            state[outOfRangeIndex] = true;
        }
        public void LedStateIndexerSetsCorrectBit()
        {
            var state = new LedState();
            Assert.AreEqual(0, state.LedRawBits);

            state[0] = true;
            state[7] = true;

            Assert.AreEqual(0x81, state.LedRawBits);
        }
 public FullColorLiveFrame()
 {
     Colors = new List<RgbColor>();
     Leds = new LedState();
 }
Example #4
0
        private LedState ProcessLedStateArray()
        {
            var ledState = new LedState();
            AssertParameterSeparator();

            var arryStartToken = GetNextToken();
            AssertValid(arryStartToken, "expected: [\n\tNote: this can also be a array constant",
                        x => x.Type == TokenType.StartArray);

            Token nextToken;
            do
            {
                nextToken = GetNextToken();
                AssertValid(nextToken, "expected: numeric value, comma (,) or ]",
                            (x => x.Type == TokenType.Keyword || x.Type == TokenType.EndArray || x.Type == TokenType.EndParameterValue));

                if (nextToken.Type == TokenType.Keyword)
                {
                    int value = 0;
                    if (int.TryParse(nextToken.RawValue, out value))
                    {
                        ledState[value] = true;
                    }
                }
            } while (nextToken.Type != TokenType.EndArray);

            return ledState;
        }
 public SetFrameInstruction()
 {
     Leds = new LedState();
     Color = new RgbColor();
 }
Example #6
0
 public LiveFrame()
 {
     Leds = new LedState();
     Color = new RgbColor();
 }