コード例 #1
0
        public bool IsOn(Enums.Led led)
        {
            switch (led)
            {
            case Enums.Led.Heartbeat:
                return(_heartbeat.State);

            default:
                throw new ArgumentOutOfRangeException(nameof(led), led, null);
            }
        }
コード例 #2
0
        public void Toggle(Enums.Led led)
        {
            switch (led)
            {
            case Enums.Led.Heartbeat:
                _heartbeat.State = !_heartbeat.State;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(led), led, null);
            }
        }
コード例 #3
0
        public void On(Enums.Led led)
        {
            switch (led)
            {
            case Enums.Led.Heartbeat:
                _heartbeat = true;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(led), led, null);
            }

            Log.Information($"Led On: {led}");
        }
コード例 #4
0
        public bool IsOn(Enums.Led led)
        {
            const string logInfo = "Led {0} State: {1}";

            switch (led)
            {
            case Enums.Led.Heartbeat:
                Log.Information(string.Format(logInfo, led, _heartbeat));
                return(_heartbeat);

            default:
                throw new ArgumentOutOfRangeException(nameof(led), led, null);
            }
        }
コード例 #5
0
        public void Toggle(Enums.Led led)
        {
            const string logInfo = "Led {0} Toggle, State: {1}";

            switch (led)
            {
            case Enums.Led.Heartbeat:
                _heartbeat = !_heartbeat;

                Log.Information(string.Format(logInfo, led, _heartbeat));
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(led), led, null);
            }
        }
コード例 #6
0
        public Led(Enums.Led led)
        {
            _gpioPin = Pi.Gpio[(int)led];

            Initialize();
        }