コード例 #1
0
ファイル: RevPiLeds.cs プロジェクト: lulzzz/RevolutionPi
        public RevPiLeds(PiControl control, PiConfiguration config)
        {
            _control = control;

            var info = config.GetVariable("RevPiLED");

            _ledAddress = info?.Address ?? 0x06;
        }
コード例 #2
0
        public RevPiLeds(PiControl control, PiConfiguration config)
        {
            _control = control ?? throw new ArgumentException("RevPiLeds cannot be used without PiControl");

            var info = config.GetVariable("RevPiLED");

            _ledAddress = info?.Address ?? 0x06;
            Trace.TraceInformation($"RevPiLeds: Using address 0x{_ledAddress:X2}");
        }
コード例 #3
0
        private static void ShowSystemState(PiConfiguration config, PiControl control)
        {
            var variableInfo = config.GetVariable("RevPiStatus");
            var data         = control.Read(variableInfo.Address, 1) ?? new byte[] { 0 };
            var status       = (int)data[0];

            Console.Write($"RevPiStatus=0x{status:X2} ");
            foreach (int value in Enum.GetValues(typeof(RevPiStatus)))
            {
                if ((status & value) != 0)
                {
                    Console.Write($" {(RevPiStatus)value}");
                }
            }
            Console.WriteLine();
        }