/// <summary> /// Initialisiert die gewünschte LED und verknüpft sie mit einem digitalOut-Objekt. /// </summary> /// <param name="digitalOut"></param> /// <param name="led"></param> public Led(DigitalOut digitalOut, Leds led) { this.digitalOut = digitalOut; this.led = led; this.oldState = false; this.digitalOut.DigitalOutputChanged += new EventHandler(DigitalOutputChanged); }
public void LedOff(Leds leds) { Leds myLeds = ledStatus & ~leds; SetLed(myLeds); ledStatus = myLeds; }
public void LedOn(Leds leds) { Leds myLeds = ledStatus | leds; SetLed(myLeds); ledStatus = myLeds; }
/// <summary> /// Initialisiert die gewünschte LED und verknüpft sie mit einem digitalOut-Objekt. /// </summary> /// <param name="digitalOut"></param> /// <param name="led"></param> public Led(Leds led, DigitalOut aDigitalOut) { this.led = led; this.digitalOut = aDigitalOut; this.digitalOut.DigitalOutChanged += new EventHandler(digitalOutChanged); this.oldState = false; }
public void GetLeds(HttpContext context) { Leds leds = _ledHandler.GetLeds(context.Request.ParsedQuery); string json = JsonSerializer.SerializeJson(leds); context.Response.Payload.Write(json); context.Response.Status = HttpStatus.OK; }
/// <summary> /// Initialisiert die gewünschte LED und verknüpft sie mit einem digitalOut-Objekt. /// </summary> /// <param name="digitalOut"></param> /// <param name="led"></param> public Led(Leds led, DigitalOut digitalOut) { if (digitalOut == null) throw new ArgumentNullException("digitalOut"); LedEnum = led; _digitalOut = digitalOut; }
public void LedOff(Leds leds) { primaryDisplay.LedOff(leds); foreach (IDisplay d in auxilaryDisplays) { d.LedOff(leds); } }
/// <summary> /// Construct an LedDriver /// </summary> /// <param name="numLeds">The number of LEDs to construct</param> /// <param name="HasGlobalBrightnessControl">Whether the controller can globally adjust the LED brightness.</param> /// <param name="HasIndividualBrightnessControl">Whether the controller has individual LED brightness control</param> public LedDriver(int numLeds, bool HasGlobalBrightnessControl, bool HasIndividualBrightnessControl) { this.HasGlobalBrightnessControl = HasGlobalBrightnessControl; this.HasIndividualBrightnessControl = HasIndividualBrightnessControl; for (var i = 0; i < numLeds; i++) { var led = new Led(this, i, HasIndividualBrightnessControl); Leds.Add(led); } }
/// <summary> /// Initialisiert die gewünschte LED und verknüpft sie mit einem digitalOut-Objekt. /// </summary> /// <param name="digitalOut"></param> /// <param name="led"></param> public Led(Leds led, DigitalOut digitalOut) { if (digitalOut == null) { throw new ArgumentNullException("digitalOut"); } LedEnum = led; _digitalOut = digitalOut; }
/// <summary> /// Clear the display immediately, resetting all LEDs' values. /// </summary> /// <returns>An awaitable task</returns> public async Task Clear() { var oldAutoFlush = AutoFlush; AutoFlush = false; Leds.ForEach(led => led.SetRgb(0, 0, 0)); await FlushAsync().ConfigureAwait(false); AutoFlush = oldAutoFlush; }
/// <summary> /// Construct a new chain of APA102-based smart LEDs. /// </summary> /// <param name="spi">The SPI port to use</param> /// <param name="numLeds">The number of APA102 smart LEDs in this chain</param> /// <param name="frequency">The frequency to use</param> public Apa102(Spi spi, int numLeds, double frequency = 6) { this.spi = spi; spi.Enabled = true; this.freq = frequency; for (var i = 0; i < numLeds; i++) { Leds.Add(new Led(this)); } }
private void SetLed(Leds led) { if (ledStatus == led) { return; } System.Threading.Thread.Sleep(250); byte[] ledMessage = { 0xBA, 0x03, 0x98, 0x00, 0x00 }; ledMessage[3] = (byte)led; ledMessage[4] = (byte)(ledMessage[0] ^ ledMessage[1] ^ ledMessage[2] ^ ledMessage[3]); HY_Write(ledMessage, 0, 5); System.Threading.Thread.Sleep(250); }
private void ZeilenSpaltenAblgeich(int rows, int cols) { if (rows * cols != Leds.Count) { Leds.Clear(); for (int i = 0; i < rows * cols; i++) { Leds.Add(new LedVm() { LedBrush = Brushes.Black }); } } }
/// <summary> /// Returns a dto representation of the instance. /// </summary> /// <returns>The converted dto.</returns> public LedImageDto ToDto() { return(new LedImageDto() { Leds = Leds.Select( x => new RgbColorDto() { R = x.R, G = x.G, B = x.B, }).ToArray(), TransitionTime = TransitionTime }); }
internal ArtemisDevice(IRGBDevice rgbDevice, DeviceProvider deviceProvider, DeviceEntity deviceEntity) { Identifier = rgbDevice.GetDeviceIdentifier(); DeviceEntity = deviceEntity; RgbDevice = rgbDevice; DeviceProvider = deviceProvider; InputIdentifiers = new List <ArtemisDeviceInputIdentifier>(); foreach (DeviceInputIdentifierEntity identifierEntity in DeviceEntity.InputIdentifiers) { InputIdentifiers.Add(new ArtemisDeviceInputIdentifier(identifierEntity.InputProvider, identifierEntity.Identifier)); } Leds = rgbDevice.Select(l => new ArtemisLed(l, this)).ToList().AsReadOnly(); LedIds = new ReadOnlyDictionary <LedId, ArtemisLed>(Leds.ToDictionary(l => l.RgbLed.Id, l => l)); ApplyKeyboardLayout(); }
private void SetLed(Leds value, bool buttonValue) { uint newPortValue = 0; byte[] varIOexpander = new byte[2]; varIOexpander = ReadIoExpander(); uint actualPortValue = Convert.ToUInt32(varIOexpander[0]); if (buttonValue == false) { newPortValue = actualPortValue | Convert.ToByte(value); } else { newPortValue = actualPortValue & (byte)(~Convert.ToByte(value)); } WriteCommand(CommandByte.OutputPort1, Convert.ToByte(newPortValue)); }
private void LEDsblinken() { //Alle LEDs blinken 8 mal for (int i = 0; i < 8; i++) { //alle LEDs einschalten for (int j = 0; j < 4; j++) { // whichLED = "Led" + j; Leds whichLED = (Leds)j; consoleView1.RobotConsole[whichLED].LedEnabled = true; } //pause //alle LEDs abschalten for (int j = 0; j < 4; j++) { // whichLED = "Led" + j; Leds whichLED = (Leds)j; consoleView1.RobotConsole[whichLED].LedEnabled = false; } } //Funny knightrider LED stuff /* * for (int j = 0; j < 2; j++) * { * consoleView1.RobotConsole[Leds.Led1].LedEnabled = true; * consoleView1.RobotConsole[Leds.Led1].LedEnabled = false; * consoleView1.RobotConsole[Leds.Led2].LedEnabled = true; * consoleView1.RobotConsole[Leds.Led2].LedEnabled = false; * consoleView1.RobotConsole[Leds.Led3].LedEnabled = true; * consoleView1.RobotConsole[Leds.Led3].LedEnabled = false; * consoleView1.RobotConsole[Leds.Led4].LedEnabled = true; * consoleView1.RobotConsole[Leds.Led4].LedEnabled = false; * } */ }
public static void Init() { if (_ti1_50 != null) { return; } _ti1_50 = new Ti(new LaunchingState()); Leds.Init(); Keyboard.Init(); #region Узнаем что с течеком при включении или перезапуске программы GlobalState = new FullTiState(); GlobalState.CurrentS1 = true; for (int i = 0; i < 11; i++) { DeviceStatusObserver(ref _newinfo); } _newinfo.temperature = TemperatureSensor.State(); Cathodes.AnalyzerInit(); #endregion System.Threading.Timer timer111Ms = new System.Threading.Timer(new TimerCallback(DevicesStateTreatment), null, 0, 111); }
private void LoadLayout() { DeviceLayout?deviceLayout = DeviceLayout.Load(FilePath, typeof(LayoutCustomDeviceData), typeof(LayoutCustomLedData)); if (deviceLayout != null) { RgbLayout = deviceLayout; IsValid = true; } else { RgbLayout = new DeviceLayout(); IsValid = false; } if (IsValid) { Leds.AddRange(RgbLayout.Leds.Select(l => new ArtemisLedLayout(this, l))); } LayoutCustomDeviceData = (LayoutCustomDeviceData?)RgbLayout.CustomData ?? new LayoutCustomDeviceData(); ApplyCustomDeviceData(); }
private void SetLed(Leds led) { if ( (((led & Leds.Customer) == Leds.Customer) && (GetKeyState((int)PosKey.CapsLock) == 0)) || (((led & Leds.Customer) != Leds.Customer) && (GetKeyState((int)PosKey.CapsLock) == 1)) ) { PressKeyboardButton(PosKey.CapsLock); } if ( (((led & Leds.Online) == Leds.Online) && (GetKeyState((int)PosKey.ScrollLock) == 0)) || (((led & Leds.Online) != Leds.Online) && (GetKeyState((int)PosKey.ScrollLock) == 1)) ) { PressKeyboardButton(PosKey.ScrollLock); } if ( (((led & Leds.Sale) == Leds.Sale) && (GetKeyState((int)PosKey.NumLock) == 0)) || (((led & Leds.Sale) != Leds.Sale) && (GetKeyState((int)PosKey.NumLock) == 1)) ) { PressKeyboardButton(PosKey.NumLock); } }
internal void SetLed(Leds led) { if ( (((led & Leds.Customer) == Leds.Customer) && (Convert.ToInt32(lblCustomerLed.Tag) == 0)) || (((led & Leds.Customer) != Leds.Customer) && (Convert.ToInt32(lblCustomerLed.Tag) == 1)) ) { ChangeMod(lblCustomerLed); } if ( (((led & Leds.Online) == Leds.Online) && (Convert.ToInt32(lblOnlineLed.Tag) == 0)) || (((led & Leds.Online) != Leds.Online) && (Convert.ToInt32(lblOnlineLed.Tag) == 1)) ) { ChangeMod(lblOnlineLed); } if ( (((led & Leds.Sale) == Leds.Sale) && (Convert.ToInt32(lblSaleLed.Tag) == 0)) || (((led & Leds.Sale) != Leds.Sale) && (Convert.ToInt32(lblSaleLed.Tag) == 1)) ) { ChangeMod(lblSaleLed); } }
internal ArtemisDevice(IRGBDevice rgbDevice, DeviceProvider deviceProvider) { Identifier = rgbDevice.GetDeviceIdentifier(); DeviceEntity = new DeviceEntity(); RgbDevice = rgbDevice; DeviceProvider = deviceProvider; Rotation = 0; Scale = 1; ZIndex = 1; RedScale = 1; GreenScale = 1; BlueScale = 1; IsEnabled = true; InputIdentifiers = new List <ArtemisDeviceInputIdentifier>(); Leds = rgbDevice.Select(l => new ArtemisLed(l, this)).ToList().AsReadOnly(); LedIds = new ReadOnlyDictionary <LedId, ArtemisLed>(Leds.ToDictionary(l => l.RgbLed.Id, l => l)); ApplyKeyboardLayout(); ApplyToEntity(); CalculateRenderProperties(); }
private void SetLed(Leds led, bool state) { indicators[(int)led] = state; }
public MainWindow() { InitializeComponent(); //UpdateRaspberryPiCode(); DataContext = new Leds(); }
/// <summary> /// Zugriff auf die LED per Indexer /// </summary> /// <param name="led"></param> /// <returns></returns> public Led this[Leds led] { get { return(this.leds[(int)led]); } }
abstract public bool IsLedOn(Leds leds);
abstract public void LedOff(Leds leds);
private void BlinkLed(Leds led) { new Thread(() => { SetLed(led, false); Thread.Sleep(10); SetLed(led, true); }).Start(); }
private bool GetLed(Leds led) { return indicators[(int)led]; }
/// <summary> /// Initialisiert die LedEventArgs-Klasse /// </summary> /// <param name="led">die betroffene LED</param> /// <param name="ledEnabled">der Zustand dieser LED</param> public LedEventArgs(Leds led, bool ledEnabled) { Led = led; LedEnabled = ledEnabled; }
public bool IsLedOn(Leds leds) { return(cashierDisplay.IsLedOn(leds)); }
public Program() { phy = new CC2420(CC2420PinConfig.DefaultiMXS(), false); leds = new Leds(); }
public bool IsLedOn(Leds leds) { return((ledStatus & leds) == leds); }
private string SetLeds(Leds leds) { return TransmitBufferAndAwaitResponse(Commands.SetLeds, new byte[] { (byte)leds }, 0, 1); }
abstract public void LedOn(Leds leds);
/// <summary> /// Overload of SetLed that accepts enumerators /// </summary> /// <param name="device"></param> /// <param name="page"></param> /// <param name="index"></param> /// <param name="value"></param> public void SetLed(IntPtr device, int page, Leds index, LedState value) { SetLed(device, page, (int)index, (int)value); }
/// <summary> /// Initialisiert die gewünschte LED und verknüpft sie mit einem digitalOut-Objekt. /// </summary> /// <param name="digitalOut"></param> /// <param name="led"></param> public Led(DigitalOut digitalOut, Leds led) { this.digitalOut = digitalOut; this.led = led; this.digitalOut.DigitalOutChanged += new EventHandler(digitalOut_DigitalOutChanged); }
/// <summary> /// Zugriff auf die Led's per Indexer /// </summary> /// <param name="led"></param> /// <returns></returns> public Led this[Leds led] { get { return this.leds[(int)led]; } }
//, bool ledEnabled) /// <summary> /// Initialisiert die LedEventArgs-Klasse /// </summary> /// <param name="led">die betroffene LED</param> /// <param name="ledEnabled">der Zustand dieser LED</param> public LedEventArgs(Leds led) { Led = led; //LedEnabled = ledEnabled; }