Example #1
0
 /// <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);
 }
Example #2
0
 /// <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);
 }
Example #3
0
        public void LedOff(Leds leds)
        {
            Leds myLeds = ledStatus & ~leds;

            SetLed(myLeds);
            ledStatus = myLeds;
        }
Example #4
0
        public void LedOn(Leds leds)
        {
            Leds myLeds = ledStatus | leds;

            SetLed(myLeds);
            ledStatus = myLeds;
        }
Example #5
0
File: Led.cs Project: maesi/prgsy
 /// <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;
 }
Example #6
0
        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;
        }
Example #7
0
        /// <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;
        }
Example #8
0
 public void LedOff(Leds leds)
 {
     primaryDisplay.LedOff(leds);
     foreach (IDisplay d in auxilaryDisplays)
     {
         d.LedOff(leds);
     }
 }
Example #9
0
 /// <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);
     }
 }
Example #10
0
        /// <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;
        }
Example #11
0
        /// <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;
        }
Example #12
0
 /// <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));
     }
 }
Example #13
0
 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
             });
         }
     }
 }
Example #15
0
 /// <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
     });
 }
Example #16
0
        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();
        }
Example #17
0
        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));
        }
Example #18
0
        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;
             * }
             */
        }
Example #19
0
        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);
        }
Example #20
0
        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();
        }
Example #21
0
 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);
     }
 }
Example #22
0
 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);
     }
 }
Example #23
0
        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();
        }
Example #24
0
 private void SetLed(Leds led, bool state)
 {
     indicators[(int)led] = state;
 }
Example #25
0
 public MainWindow()
 {
     InitializeComponent();
     //UpdateRaspberryPiCode();
     DataContext = new Leds();
 }
Example #26
0
 /// <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]); }
 }
Example #27
0
 abstract public bool IsLedOn(Leds leds);
Example #28
0
 abstract public void LedOff(Leds leds);
Example #29
0
 private void BlinkLed(Leds led)
 {
     new Thread(() =>
     {
         SetLed(led, false);
         Thread.Sleep(10);
         SetLed(led, true);
     }).Start();
 }
Example #30
0
 private bool GetLed(Leds led)
 {
     return indicators[(int)led];
 }
Example #31
0
 /// <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;
 }
Example #32
0
 public bool IsLedOn(Leds leds)
 {
     return(cashierDisplay.IsLedOn(leds));
 }
Example #33
0
 public Program()
 {
     phy = new CC2420(CC2420PinConfig.DefaultiMXS(), false);
     leds = new Leds();
 }
Example #34
0
 public bool IsLedOn(Leds leds)
 {
     return((ledStatus & leds) == leds);
 }
 private string SetLeds(Leds leds)
 {
     return TransmitBufferAndAwaitResponse(Commands.SetLeds, new byte[] { (byte)leds }, 0, 1);
 }
Example #36
0
 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);
 }
Example #38
0
 public Program()
 {
     phy  = new CC2420(CC2420PinConfig.DefaultiMXS(), false);
     leds = new Leds();
 }
Example #39
0
 /// <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;
 }
Example #40
0
 /// <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);
 }
Example #41
0
 /// <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]; }
 }
Example #42
0
 //, 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;
 }