コード例 #1
0
        /// <summary>Constructs a new instance.</summary>

        //public ButtonNETMF(Cpu.Pin intPort, Cpu.Pin buttonLED)

        /*
         * public ButtonNETMF(GHI.Processor.DeviceType deviceType, int socketNumber)
         * {
         *  this.currentMode = LedMode.Off;
         *
         *  Cpu.Pin _inputPort = Cpu.Pin.GPIO_Pin13;
         *  Cpu.Pin _outputPort = Cpu.Pin.GPIO_Pin14;
         *
         *  this.input = new InterruptPort(_inputPort, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
         *  this.led = new OutputPort(_outputPort, false);
         *
         *  switch (deviceType)
         *  {
         *      case GHI.Processor.DeviceType.G120E:
         *          {
         *              switch (socketNumber)
         *              {
         *                  case 12:
         *                      {
         *                          _inputPort = FEZSpiderII.Socket12.Pin3;
         *                          _outputPort = FEZSpiderII.Socket12.Pin4;
         *                      }
         *                      break;
         *
         *                  default:
         *                      {
         *                          throw new NotSupportedException("Socket not supported");
         *                          break;
         *                      }
         *
         *              }
         *          }
         *          break;
         *      default:
         *          {
         *              throw new NotSupportedException("Mainboard not supported");
         *              break;
         *          }
         *  }
         *
         *
         *
         *  /*
         *  if (deviceType == DeviceType.G120E)
         *  {
         *      _inputPort = FEZSpiderII.Socket12.Pin3;
         *      _outputPort = FEZSpiderII.Socket12.Pin4;
         *  }
         */

        //this.input = new InterruptPort(FEZSpiderII.Socket12.Pin3, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
        //this.input = new InterruptPort(_inputPort, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
        //this.led = new OutputPort(_outputPort, false);



        //this.input = new InterruptPort(FEZSpiderII.Socket12.Pin3, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
        //this.led = new OutputPort(FEZSpiderII.Socket12.Pin4, false);



        /*
         * switch (deviceType)
         * {
         *  case GHI.Processor.DeviceType.G120E:
         *  {
         *      switch (socketNumber)
         *      {
         *          case 12:
         *              {
         *                  this.input = new InterruptPort(_inputPort, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
         *                  this.led = new OutputPort(_outputPort, false);
         *              }
         *              break;
         *              default:
         *              {
         *                  throw new NotSupportedException("Socket not supported");
         *              }
         *      }
         *  }
         *  break;
         *  case GHI.Processor.DeviceType.EMX:
         *  {
         *      switch (socketNumber)
         *      {
         *          case 12:
         *              {
         *                  this.input = new InterruptPort(FEZSpider.Socket12.Pin3, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
         *                  this.led = new OutputPort(GHI.Pins.FEZSpider.Socket12.Pin4, false);
         *              }
         *              break;
         *          default:
         *              {
         *                  throw new NotSupportedException("Socket not supported");
         *              }
         *      }
         *  }
         *  break;
         *
         *
         *  default:
         *  {
         *      throw new NotSupportedException("Mainboard not supported");
         *  }
         * }
         */


        // this.input.OnInterrupt += input_OnInterrupt;
        // }



        public ButtonNETMF(Cpu.Pin intPort, Cpu.Pin buttonLED)
        {
            this.currentMode        = LedMode.Off;
            this.input              = new InterruptPort(intPort, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
            this.led                = new OutputPort(buttonLED, false);
            this.input.OnInterrupt += input_OnInterrupt;
        }
コード例 #2
0
        // Handles LED timer elapsed event by getting LED colour that was toggled on when LED timer was created, and turning that colour off.
        private static void OnLedTimerElapsed(Object source, System.Timers.ElapsedEventArgs e)
        {
            LedMode ledOff = (LedMode)((ScannerTimer)source).ledOff;
            IMotorolaBarcodeScanner scanner = scannerInfo.scanner;

            scanner.Actions.ToggleLed(ledOff);
        }
コード例 #3
0
ファイル: Button.cs プロジェクト: shaga/GadgeteerToTinyCLR
        /// <summary>Constructs a new instance.</summary>
        /// <param name="DigitalPin3">The mainboard pin that has digital pin.</param>
        /// <param name="DigitalPin4">The mainboard pin that has digital pin.</param>
        public Button(int DigitalPin3, int DigitalPin4)
        {
            //Socket socket = Socket.GetSocket(socketNumber, true, this, null);

            //socket.EnsureTypeIsSupported(new char[] { 'X', 'Y' }, this);

            this.currentMode = LedMode.Off;
            var controller = GpioController.GetDefault();

            this.led = controller.OpenPin(DigitalPin4);
            this.led.SetDriveMode(GpioPinDriveMode.Output);

            this.input = controller.OpenPin(DigitalPin3);//GTI.InterruptInputFactory.Create(socket, GT.Socket.Pin.Three, GTI.GlitchFilterMode.On, GTI.ResistorMode.PullUp, GTI.InterruptMode.RisingAndFallingEdge, this);
            if (input.IsDriveModeSupported(GpioPinDriveMode.InputPullUp))
            {
                input.SetDriveMode(GpioPinDriveMode.InputPullUp);
            }
            else
            {
                input.SetDriveMode(GpioPinDriveMode.Input);
            }

            //this.input.Interrupt += this.OnInterrupt;
            input.ValueChanged += Input_ValueChanged;;
        }
コード例 #4
0
 /// <summary>
 /// Resets the led back to color green
 /// </summary>
 /// <returns></returns>
 public async Task Reset()
 {
     if (Mode != LedMode.Green)
     {
         Mode = LedMode.Green;
         await UIWriteMethods.Led(Brick.Socket, Mode);
     }
 }
コード例 #5
0
        public void SetMode(LedMode mode)
        {
            if (!supportedModes.Contains(mode))
            {
                throw new NotSupportedException("Mode not supported by AudioLed");
            }

            controller.SetLedMode_PinConfigType1(mode);
        }
コード例 #6
0
        private static void OnLedTimerElapsed(Object source, System.Timers.ElapsedEventArgs e)
        {
            Console.WriteLine("flash toggle off");
            //uint scannerCradleId = ((ScannerTimer)source).scannerId;
            LedMode ledOff = (LedMode)((ScannerTimer)source).ledOff;
            //IMotorolaBarcodeScanner scanner = BarcodeScannerManager.Instance.GetScannerFromCradleId(scannerCradleId);
            IMotorolaBarcodeScanner scanner = scanners[((ScannerTimer)source).scannerId].scanner;

            scanner.Actions.ToggleLed(ledOff);
        }
コード例 #7
0
ファイル: Firmware.cs プロジェクト: Fabio3rs/cmalcor
        /// <summary>
        /// Flashes a new configuration into the mouse with the settings in the parameters.
        /// </summary>
        /// <param name="brightness">Between 0 and 10 (inclusive).</param>
        /// <exception cref="FirmwareException"></exception>
        public static void SetLED(LedMode mode, int brightness, byte red, byte green, byte blue)
        {
            int error;

            CmAlcor_SetLED(out error, (int)mode, brightness, red, green, blue);
            if (error != 0)
            {
                throw new FirmwareException(error);
            }
        }
コード例 #8
0
        private void UpdateAudioLedMode2(LedMode audioLedMode)
        {
            IT87Enter(RegisterPort);
            Select(RegisterPort, ValuePort, 7);
            byte b  = ReadByte(RegisterPort, ValuePort, 251);
            byte b2 = ReadByte(RegisterPort, ValuePort, 202);

            b2 = (byte)(b2 | 0x20);
            WriteByte(RegisterPort, ValuePort, 202, b2);
            byte b4 = InvkYcc.gb_inp((uint)(GpioAddress + 2));
            byte b3 = ReadByte(RegisterPort, ValuePort, 210);
            byte b5 = ReadByte(RegisterPort, ValuePort, 208);

            switch (audioLedMode)
            {
            case LedMode.Off:
                b3 = (byte)(b3 | 0x20);
                WriteByte(RegisterPort, ValuePort, 210, b3);
                b5 = (byte)(b5 & 0xDF);
                b4 = (byte)(b4 & 0xDF);
                b  = (byte)(b & 0x6F);
                break;

            case LedMode.Still:
                b3 = (byte)(b3 | 0x20);
                WriteByte(RegisterPort, ValuePort, 210, b3);
                b5 = (byte)(b5 | 0x20);
                b4 = (byte)(b4 & 0xDF);
                b  = (byte)(b & 0x6F);
                break;

            case LedMode.Breath:
                b3 = (byte)(b3 | 0x20);
                WriteByte(RegisterPort, ValuePort, 210, b3);
                b5 = (byte)(b5 | 0x20);
                b4 = (byte)(b4 & 0xDF);
                b  = (byte)(b | 0x90);
                break;

            case LedMode.Beat:
                b3 = (byte)(b3 | 0x20);
                WriteByte(RegisterPort, ValuePort, 210, b3);
                b5 = (byte)(b5 | 0x20);
                b4 = (byte)(b4 | 0x20);
                b  = (byte)(b & 0x6F);
                break;
            }

            WriteByte(RegisterPort, ValuePort, 208, b5);
            InvkYcc.gb_outp((uint)(GpioAddress + 2), b4);
            WriteByte(RegisterPort, ValuePort, 251, b);
            IT87Exit(RegisterPort, ValuePort);
        }
コード例 #9
0
        /// <summary>Constructs a new instance.</summary>
        /// <param name="socketNumber">The mainboard socket that has the module plugged into it.</param>
        public Button(int socketNumber)
        {
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

            socket.EnsureTypeIsSupported(new char[] { 'X', 'Y' }, this);

            this.currentMode = LedMode.Off;

            this.led              = GTI.DigitalOutputFactory.Create(socket, GT.Socket.Pin.Four, false, this);
            this.input            = GTI.InterruptInputFactory.Create(socket, GT.Socket.Pin.Three, GTI.GlitchFilterMode.On, GTI.ResistorMode.PullUp, GTI.InterruptMode.RisingAndFallingEdge, this);
            this.input.Interrupt += this.OnInterrupt;
        }
コード例 #10
0
ファイル: Webman.cs プロジェクト: StarmanX32/StarmanLib
        public void Led(LedColor color, LedMode mode)
        {
            WebRequest  cidpsid = WebRequest.Create("http://" + ip + "/led.ps3mapi?color=" + color + "&mode=" + mode);
            WebResponse rsp     = cidpsid.GetResponse();

            using (Stream dataStream = rsp.GetResponseStream())
            {
                StreamReader rd = new StreamReader(dataStream);
                rd.ReadToEnd();
            }
            rsp.Close();
        }
コード例 #11
0
        private void ResetState()
        {
            // Protocol and Serial
            _statePollMode        = false;
            _stateSerialDelay     = 0;
            _statePacketSkipRate  = 0;
            _statePacketFiltering = false;
            _stateLineModeTrack   = 0;
            _stateLineModeMean    = 0;
            _stateLineModeDiff    = 0;
            _stateOutputMask.Clear();
            _stateFrameStreaming = false;

            // Configuration
            _stateFrameBuffer              = false;
            _statePowerMode                = PowerMode.On;
            _stateSlaveCameraType          = CameraType.OV6620;
            _stateHighResolution           = false;
            _stateFrameDifferencingChannel = Channel.Green;
            _stateFrameDifferencingHighRes = false;
            _stateNoiseFilter              = 2;
            _statePixelDifference          = false;
            _stateTrackInverted            = false;
            _stateLed1        = LedMode.Auto;
            _stateLed2        = LedMode.Auto;
            _stateDownsampleX = 1;
            _stateDownsampleY = 1;

            _stateWindow        = GetVirtualWindow();
            _stateFullFrameSize = new Size(_stateWindow.Width, _stateWindow.Height);

            _stateHistogramBins     = HistogramBinCount.Bins28;
            _stateHistogramScale    = 0;
            _stateHistogramTracking = false;

            // Servo
            _stateServoPanFar   = 16;
            _stateServoPanNear  = 8;
            _stateServoPanStep  = 5;
            _stateServoTiltFar  = 16;
            _stateServoTiltNear = 8;
            _stateServoTiltStep = 5;
            for (int i = 0; i < _stateServoHigh.Length; i++)
            {
                _stateServoHigh[i] = false;
            }


            ResetRegistersState();

            ReloadState();
        }
コード例 #12
0
        /// <summary>
        /// Set Led mode
        /// </summary>
        /// <param name="socket">socket for executing command to brick</param>
        /// <param name="ledMode">Pattern of the led</param>
        public static async Task Led(ISocket socket, LedMode ledMode, bool requireReply = false)
        {
            Command cmd = null;

            using (CommandBuilder cb = new CommandBuilder(requireReply ? CommandType.DIRECT_COMMAND_REPLY : CommandType.DIRECT_COMMAND_NO_REPLY))
            {
                cb.OpCode(OP.opUI_WRITE);
                cb.Raw((byte)UI_WRITE_SUBCODE.LED);
                cb.PAR8((byte)ledMode);
                cmd = cb.ToCommand();
            }
            await socket.Execute(cmd);
        }
コード例 #13
0
        public void SetLedMode_PinConfigType1(LedMode pMode)
        {
            switch (pMode)
            {
            case LedMode.DarkOff:
                break;

            case LedMode.Off:
            case LedMode.Still:
            case LedMode.Breath:
                UpdateAudioLedMode(pMode);
                break;
            }
        }
コード例 #14
0
        public void ToggleLed(LedMode mode)
        {
            const string setCommandXml = @"<inArgs><scannerID>{0}</scannerID><cmdArgs><arg-int>{1}</arg-int></cmdArgs></inArgs>";
            var          inXml         = string.Format(setCommandXml, _scannerId, (int)mode);
            string       outXml;
            int          status;

            _scannerDriver.ExecCommand((int)ScannerCommand.SetAction, ref inXml, out outXml, out status);
            var s = (StatusCode)status;

            if (s != StatusCode.Success)
            {
                throw new ScannerException(s);
            }
        }
コード例 #15
0
        static void HandleModeButtonRelease(GPIOPin pin, Edge edge)
        {
            var newValue = Mode + 1;

            if (Enum.IsDefined(typeof(LedMode), newValue))
            {
                Mode = newValue;
            }
            else
            {
                Mode = LedMode.LTR;
            }
            Console.WriteLine($"Mode changed to {Mode}");
            pin.WaitForEdge(edge, HandleModeButtonRelease);
        }
コード例 #16
0
        /// <summary>
        /// Set the Lono's internal LED Color.
        /// </summary>
        /// <returns></returns>
        public RestRequest SetLed(int desiredColor, LedMode desiredMode)
        {
            var request = new RestRequest(Method.POST)
            {
                RequestFormat = DataFormat.Json
            };

            request.Resource = "api/{version}/devices/{deviceId}/state";
            request.AddParameter("version", _version, ParameterType.UrlSegment);
            request.AddParameter("deviceId", _deviceId, ParameterType.UrlSegment);
            request.AddBody(new SetLedOptions()
            {
                color = desiredColor, mode = desiredMode, brightness = 255, interval = 5, times = 15
            });

            return(request);
        }
コード例 #17
0
        private void B_leds_write_Click(object sender, EventArgs e)
        {
            //write LED_STYLE
            try
            {
                LedStyle led_style = (LedStyle)Enum.Parse(typeof(LedStyle), CMB_leds_style.SelectedItem.ToString());
                if (MainV2.comPort.setParam("LED_STYLE", (byte)led_style))
                {
                    Setup.flashMessage.FadeInOut("Writing LED_STYLE succeed", true);
                }
                else
                {
                    Setup.flashMessage.FadeInOut("Writing LED_STYLE failed", false);
                }
            }
            catch
            {
                Setup.flashMessage.FadeInOut("Writing LED_STYLE failed", false);
            }

            //write LED_MODE
            try
            {
                LedMode led_mode =
                    (CB_leds_legacy_1.Checked ? LedMode.Motor : 0) |
                    (CB_leds_legacy_2.Checked ? LedMode.GPS : 0) |
                    (CB_leds_legacy_3.Checked ? LedMode.Aux : 0) |
                    (CB_leds_legacy_4.Checked ? LedMode.Beeper : 0) |
                    (CB_leds_legacy_5.Checked ? LedMode.Voltage : 0) |
                    (CB_leds_legacy_6.Checked ? LedMode.Nav_blink_motor : 0) |
                    (CB_leds_legacy_7.Checked ? LedMode.Nav_blink_GPS : 0);
                if (MainV2.comPort.setParam("LED_MODE", (byte)led_mode))
                {
                    Setup.flashMessage.FadeInOut("Writing LED_MODE succeed", true);
                }
                else
                {
                    Setup.flashMessage.FadeInOut("Writing LED_MODE failed", false);
                }
            }
            catch
            {
                Setup.flashMessage.FadeInOut("Writing LED_MODE failed", false);
            }
        }
コード例 #18
0
        private void ChangeMode(LedMode mode)
        {
            switch (mode)
            {
            case LedMode.Blinking:
                _ledAction = BlinkAction;
                break;

            case LedMode.Single:
                break;

            case LedMode.Moving:
                break;

            default:
                break;
            }
        }
コード例 #19
0
ファイル: WifiLedBulb.cs プロジェクト: NeoSkye/FluxLEDSharp
        private LedMode DetermineMode(byte ww_level, byte pattern_code)
        {
            LedMode mode = LedMode.kUnknown;

            if (pattern_code == 0x61 || pattern_code == 0x62)
            {
                if (RGBWCapable)
                {
                    mode = LedMode.kColor;
                }
                else if (ww_level != 0)
                {
                    mode = LedMode.kWW;
                }
                else
                {
                    mode = LedMode.kColor;
                }
            }
            else if (pattern_code == 0x60)
            {
                mode = LedMode.kCustom;
            }
            else if (pattern_code == 0x41)
            {
                mode = LedMode.kColor;
            }
            else if (Enum.IsDefined(typeof(PresetPattern), pattern_code))
            {
                mode = LedMode.kPreset;
            }
            else if (Enum.IsDefined(typeof(BuiltInTimer), pattern_code))
            {
                if (pattern_code == (byte)BuiltInTimer.Sunrise)
                {
                    mode = LedMode.kSunrise;
                }
                if (pattern_code == (byte)BuiltInTimer.Sunset)
                {
                    mode = LedMode.kSunset;
                }
            }
            return(mode);
        }
コード例 #20
0
        // color_source 0x20 takes supplied color for breathe mode
        public byte[] set_channel(
            LedChannel channel,
            LedMode mode,
            byte brightness,
            byte r,
            byte g,
            byte b,
            byte speed = 255,
            byte altr  = 0,
            byte altg  = 0,
            byte altb  = 0
            )
        {
            byte color_source = 32;
            var  pkt          = new_ffpacket(255, 81, 44, 1, 0, (byte)channel, speed, color_source, (byte)mode, 255, brightness, r, g, b, altr, altg, altb);

            return(this.send_packet(pkt));
            //headless_send_packet(pkt);
        }
コード例 #21
0
        public void SetMode(LedMode mode)
        {
            var iDiv = ledFuncType == 4 ? 1 : -1;

            switch (mode)
            {
            case LedMode.Off:
                controller.SetLedMode_2(iDiv, 0, ledIdv4);
                break;

            case LedMode.Still:
                controller.SetLedMode_2(iDiv, 2, ledIdv4);
                break;

            case LedMode.Breath:
                controller.SetLedMode_2(iDiv, 3, ledIdv4);
                break;

            case LedMode.Beat:
                controller.SetLedMode_2(iDiv, 4, ledIdv4);
                break;

            case LedMode.ColorCycle:
                controller.SetLedMode_2(iDiv, 12, ledIdv4);
                break;

            case LedMode.Flash:
                controller.SetLedMode_2(iDiv, 6, ledIdv4);
                break;

            case LedMode.DoubleFlash:
                controller.SetLedMode_2(iDiv, 11, ledIdv4);
                break;

            case LedMode.Random:
                controller.SetLedMode_2(iDiv, 7, ledIdv4);
                break;

            default:
                throw new NotSupportedException("Mode not supported by MonocLed");
            }
        }
コード例 #22
0
        public void SetMode(LedMode mode)
        {
            switch (mode)
            {
            case LedMode.Off:
Off:
                InvkCled.piSetAzaliaLedMode(0);
                InvkCled.piSetBiosOnOff(0);
                break;

            case LedMode.Breath:
                InvkCled.piSetAzaliaLedMode(1);
                InvkCled.piSetBiosOnOff(1);
                break;

            case LedMode.ColorCycle:
                InvkCled.piSetAzaliaLedMode(2);
                InvkCled.piSetBiosOnOff(1);
                break;

            case LedMode.Still:
                InvkCled.piSetAzaliaLedMode(3);
                InvkCled.piSetBiosOnOff(1);
                break;

            case LedMode.Flash:
                InvkCled.piSetAzaliaLedMode(4);
                InvkCled.piSetBiosOnOff(1);
                break;

            case LedMode.DoubleFlash:
                InvkCled.piSetAzaliaLedMode(5);
                InvkCled.piSetBiosOnOff(1);
                break;

            default:
                goto Off;
            }
            InvkCled.piSetFunction();
        }
コード例 #23
0
ファイル: Firmware.cs プロジェクト: Fabio3rs/cmalcor
        /// <summary>
        /// Gets the LED configuration currently flashed on the mouse.
        /// Does no change to the ref parameters when no configuration is flashed on the device.
        /// </summary>
        /// <returns>Whether there's any LED configuration flashed on the device.</returns>
        /// <exception cref="FirmwareException"></exception>
        public static bool GetLED(ref LedMode mode, ref int brightness, ref byte red, ref byte green, ref byte blue)
        {
            int error, currMode, currBright, currRed, currGreen, currBlue;

            if (CmAlcor_GetLED(out error, out currMode, out currBright, out currRed, out currGreen, out currBlue) != 0)
            {
                mode       = (LedMode)currMode;
                brightness = currBright;
                red        = (byte)(currRed & 0xFF);
                green      = (byte)(currGreen & 0xFF);
                blue       = (byte)(currBlue & 0xFF);
                return(true);
            }
            else
            {
                if (error != 0)
                {
                    throw new FirmwareException(error);
                }
                return(false);
            }
        }
コード例 #24
0
        private void UpdateAudioLedMode(LedMode audioLedMode)
        {
            IT87Enter(RegisterPort);
            Select(RegisterPort, ValuePort, 7);
            byte b  = ReadByte(RegisterPort, ValuePort, 251);
            byte b2 = ReadByte(RegisterPort, ValuePort, 210);
            byte b3 = ReadByte(RegisterPort, ValuePort, 208);

            switch (audioLedMode)
            {
            case LedMode.Off:
                b2 = (byte)(b2 | 2);
                WriteByte(RegisterPort, ValuePort, 210, b2);
                b3 = (byte)(b3 & 0xFD);
                InvkSMBCtrl.Pch_D22_Ctrl(0);
                b = (byte)(b & 0x6F);
                break;

            case LedMode.Still:
                b2 = (byte)(b2 | 2);
                WriteByte(RegisterPort, ValuePort, 210, b2);
                b3 = (byte)(b3 & 0xFD);
                InvkSMBCtrl.Pch_D22_Ctrl(1);
                b = (byte)(b & 0x6F);
                break;

            case LedMode.Breath:
                b2 = (byte)(b2 | 2);
                WriteByte(RegisterPort, ValuePort, 210, b2);
                b3 = (byte)(b3 & 0xFD);
                InvkSMBCtrl.Pch_D22_Ctrl(1);
                b = (byte)(b | 0x90);
                break;
            }
            WriteByte(RegisterPort, ValuePort, 208, b3);
            WriteByte(RegisterPort, ValuePort, 251, b);
            IT87Exit(RegisterPort, ValuePort);
        }
コード例 #25
0
ファイル: RequestHelper.cs プロジェクト: jbct/LonoNet
        /// <summary>
        /// Set the Lono's internal LED Color.
        /// </summary>
        /// <returns></returns>
        public RestRequest SetLed(int desiredColor, LedMode desiredMode)
        {
            var request = new RestRequest(Method.POST) { RequestFormat = DataFormat.Json };
            request.Resource = "api/{version}/devices/{deviceId}/state";
            request.AddParameter("version", _version, ParameterType.UrlSegment);
            request.AddParameter("deviceId", _deviceId, ParameterType.UrlSegment);
            request.AddBody(new SetLedOptions() { color = desiredColor, mode = desiredMode, brightness = 255, interval = 5, times = 15 });

            return request;
        }
コード例 #26
0
 /// <summary>Change leds for your console.</summary>
 public int SetConsoleLed(LedColor color, LedMode mode)
 {
     return(setConsoleLed((int)color, (int)mode));
 }
コード例 #27
0
 public int ConsoleLED(LedColor Color, LedMode Mode)
 {
     return(setConsoleLed((int)Color, (int)Mode));
 }
コード例 #28
0
        public void LedCtrl_IT86xx_SetMode(int division, LedMode mode)
        {
            bool changeDiv1 = false, changeDiv2 = false;

            switch (division)
            {
            case 0:
                changeDiv1 = true;
                break;

            case 1:
                changeDiv2 = true;
                break;

            default:
                changeDiv1 = true;
                changeDiv2 = true;
                break;
            }

            IT87Enter(RegisterPort);
            Select(RegisterPort, ValuePort, 0);

            switch (mode)
            {
            case LedMode.Off:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 15);
                    WriteByte(RegisterPort, ValuePort, 177, 0);
                    WriteByte(RegisterPort, ValuePort, 178, 32);
                    WriteByte(RegisterPort, ValuePort, 179, 0);
                    WriteByte(RegisterPort, ValuePort, 180, 0);
                    WriteByte(RegisterPort, ValuePort, 181, 0);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 15);
                    WriteByte(RegisterPort, ValuePort, 193, 0);
                    WriteByte(RegisterPort, ValuePort, 194, 16);
                    WriteByte(RegisterPort, ValuePort, 195, 0);
                    WriteByte(RegisterPort, ValuePort, 196, 0);
                    WriteByte(RegisterPort, ValuePort, 197, 0);
                }
                break;

            case LedMode.Still:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 15);
                    WriteByte(RegisterPort, ValuePort, 177, 0);
                    WriteByte(RegisterPort, ValuePort, 178, 32);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 15);
                    WriteByte(RegisterPort, ValuePort, 193, 0);
                    WriteByte(RegisterPort, ValuePort, 194, 16);
                }
                break;

            case LedMode.Breath:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 143);
                    WriteByte(RegisterPort, ValuePort, 177, 0);
                    WriteByte(RegisterPort, ValuePort, 178, 32);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 143);
                    WriteByte(RegisterPort, ValuePort, 193, 0);
                    WriteByte(RegisterPort, ValuePort, 194, 16);
                }
                break;

            case LedMode.Flash:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 15);
                    WriteByte(RegisterPort, ValuePort, 177, 8);
                    WriteByte(RegisterPort, ValuePort, 178, 32);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 15);
                    WriteByte(RegisterPort, ValuePort, 193, 8);
                    WriteByte(RegisterPort, ValuePort, 194, 16);
                }
                break;

            case LedMode.DoubleFlash:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 15);
                    WriteByte(RegisterPort, ValuePort, 177, 12);
                    WriteByte(RegisterPort, ValuePort, 178, 32);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 15);
                    WriteByte(RegisterPort, ValuePort, 193, 12);
                    WriteByte(RegisterPort, ValuePort, 194, 16);
                }
                break;

            case LedMode.ColorCycle:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 127);
                    WriteByte(RegisterPort, ValuePort, 177, 0);
                    WriteByte(RegisterPort, ValuePort, 178, 160);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 127);
                    WriteByte(RegisterPort, ValuePort, 193, 0);
                    WriteByte(RegisterPort, ValuePort, 194, 144);
                }
                break;

            case LedMode.Random:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 15);
                    WriteByte(RegisterPort, ValuePort, 177, 64);
                    WriteByte(RegisterPort, ValuePort, 178, 32);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 15);
                    WriteByte(RegisterPort, ValuePort, 193, 64);
                    WriteByte(RegisterPort, ValuePort, 194, 16);
                }
                break;

            case LedMode.Beat:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 15);
                    WriteByte(RegisterPort, ValuePort, 177, 128);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 15);
                    WriteByte(RegisterPort, ValuePort, 193, 128);
                }
                break;
            }

            IT87Exit(RegisterPort, ValuePort);
        }
コード例 #29
0
        public void LedCtrl_IT86xx(int Divison, LedMode lMode, uint _iColor, uint uiLedID)
        {
            bool changeDiv1 = false, changeDiv2 = false;

            switch (Divison)
            {
            case 0:
                changeDiv1 = true;
                break;

            case 1:
                changeDiv2 = true;
                break;

            default:
                changeDiv1 = true;
                changeDiv2 = true;
                break;
            }

            IT87Enter(RegisterPort);
            Select(RegisterPort, ValuePort, 0);

            switch (lMode)
            {
            case LedMode.Off:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 15);
                    WriteByte(RegisterPort, ValuePort, 177, 0);
                    WriteByte(RegisterPort, ValuePort, 178, 32);
                    WriteByte(RegisterPort, ValuePort, 179, 0);
                    WriteByte(RegisterPort, ValuePort, 180, 0);
                    WriteByte(RegisterPort, ValuePort, 181, 0);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 15);
                    WriteByte(RegisterPort, ValuePort, 193, 0);
                    WriteByte(RegisterPort, ValuePort, 194, 16);
                    WriteByte(RegisterPort, ValuePort, 195, 0);
                    WriteByte(RegisterPort, ValuePort, 196, 0);
                    WriteByte(RegisterPort, ValuePort, 197, 0);
                }
                break;

            case LedMode.Still:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 15);
                    WriteByte(RegisterPort, ValuePort, 177, 0);
                    WriteByte(RegisterPort, ValuePort, 178, 32);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 15);
                    WriteByte(RegisterPort, ValuePort, 193, 0);
                    WriteByte(RegisterPort, ValuePort, 194, 16);
                }
                break;

            case LedMode.Breath:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 143);
                    WriteByte(RegisterPort, ValuePort, 177, 0);
                    WriteByte(RegisterPort, ValuePort, 178, 32);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 143);
                    WriteByte(RegisterPort, ValuePort, 193, 0);
                    WriteByte(RegisterPort, ValuePort, 194, 16);
                }
                break;

            case LedMode.Flash:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 15);
                    WriteByte(RegisterPort, ValuePort, 177, 8);
                    WriteByte(RegisterPort, ValuePort, 178, 32);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 15);
                    WriteByte(RegisterPort, ValuePort, 193, 8);
                    WriteByte(RegisterPort, ValuePort, 194, 16);
                }
                break;

            case LedMode.DoubleFlash:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 15);
                    WriteByte(RegisterPort, ValuePort, 177, 12);
                    WriteByte(RegisterPort, ValuePort, 178, 32);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 15);
                    WriteByte(RegisterPort, ValuePort, 193, 12);
                    WriteByte(RegisterPort, ValuePort, 194, 16);
                }
                break;

            case LedMode.ColorCycle:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 127);
                    WriteByte(RegisterPort, ValuePort, 177, 0);
                    WriteByte(RegisterPort, ValuePort, 178, 160);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 127);
                    WriteByte(RegisterPort, ValuePort, 193, 0);
                    WriteByte(RegisterPort, ValuePort, 194, 144);
                }
                break;

            case LedMode.Random:
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 176, 15);
                    WriteByte(RegisterPort, ValuePort, 177, 64);
                    WriteByte(RegisterPort, ValuePort, 178, 32);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 192, 15);
                    WriteByte(RegisterPort, ValuePort, 193, 64);
                    WriteByte(RegisterPort, ValuePort, 194, 16);
                }
                break;
            }

            if (lMode != LedMode.Auto)
            {
                byte value  = (byte)(_iColor >> 16);
                byte value2 = (byte)(_iColor >> 8);
                byte value3 = (byte)_iColor;
                if (changeDiv1)
                {
                    WriteByte(RegisterPort, ValuePort, 179, value);
                    WriteByte(RegisterPort, ValuePort, 180, value2);
                    WriteByte(RegisterPort, ValuePort, 181, value3);
                }
                if (changeDiv2)
                {
                    WriteByte(RegisterPort, ValuePort, 195, value);
                    WriteByte(RegisterPort, ValuePort, 196, value2);
                    WriteByte(RegisterPort, ValuePort, 197, value3);
                }
            }

            IT87Exit(RegisterPort, ValuePort);
        }
コード例 #30
0
 /// <summary></summary>
 public void SetLed1(LedMode mode)
 {
     _c.SendCommand("L0", (int)mode);
     _stateLed1 = mode;
 }
コード例 #31
0
 public void SetLed2(LedMode mode)
 {
     _c.SendCommand("L1", (int)mode);
     _stateLed2 = mode;
 }