示例#1
0
 public Program()
 {
     lcd          = new LCD(GridTerminalSystem);
     doors        = new Doors(GridTerminalSystem);
     lights       = new Lights(GridTerminalSystem);
     dangerLights = new DangerLights(GridTerminalSystem);
 }
示例#2
0
        public Page1(LCD l)
        {
            lcd = l;
            InitializeComponent();

            update_timer          = new DispatcherTimer();
            update_timer.Interval = new TimeSpan(0, 0, 0, 0, 200);
            update_timer.Tick    += new EventHandler(updateTimer_Tick);

            weatherTimer          = new DispatcherTimer();
            weatherTimer.Interval = new TimeSpan(0, 10, 0);
            weatherTimer.Tick    += new EventHandler(weatherTimer_Tick);

            update_timer.Start();
            weatherTimer.Start();

            yw = new YahooWeather();
            wr = yw.getWeather("Trelleborg", "SE", false);

            if (wr != null)
            {
                imgWeather.Source = setWeatherImage(wr.Condition.Code);
                updateLables();
                setForecast();
            }
        }
示例#3
0
文件: Program.cs 项目: piwi1263/nf429
        /// <summary>
        /// Initiate the TFT:
        /// <list type="bullet">
        /// <item><description>Instantiate driver for a ILI9341</description></item>
        /// <item><description>Clear the screen</description></item>
        /// <item><description>Seton the backlight</description></item>
        /// <item><description>Fill the font structure</description></item>
        /// <item><description>Abstract board info in stand alone text</description></item>
        /// </list>
        /// </summary>
        private static void InitDisplay()
        {
            // Initiate our little driver
            tft = new LCD(Orientation.Landscape);

            // Well, clear the screen
            tft.ClearScreen();

            // Backlight is always on, on STM32F429
            tft.BackLight = true;

            // Get a helper font
            font = new HelpersFont(DejaVuMono8.Bitmaps, DejaVuMono8.Descriptors, DejaVuMono8.Height, DejaVuMono8.FontSpace);

            // Break apart the system build string
            all  = SystemInfo.OEMString;
            idx1 = all.IndexOf('@');
            idx2 = all.IndexOf("built");
            idx3 = all.IndexOf("ChibiOS");

            who  = all.Substring(0, idx1 - 1).Trim();
            what = all.Substring(idx1 + 1, idx2 - (idx1 + 1)).Trim();
            with = all.Substring(idx3).Trim();
            ver  = SystemInfo.Version.ToString();
        }
示例#4
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            update_timer          = new DispatcherTimer();
            update_timer.Interval = new TimeSpan(0, 0, 15);
            update_timer.Tick    += new EventHandler(updateTimer_Tick);
            update_timer.Start();

            lcd = new LCD(1133, 49705);
            lcd.OpenDevice();
            //lcd.captureFrames = true;

            pg1 = new Page1(lcd);
            pg2 = new Page2(lcd);

            _pages.Add(new LcdPageWpf {
                Element = pg1
            });
            _pages.Add(new LcdPageWpf {
                Element = pg2
            });

            lcd.Pages       = _pages;
            lcd.CurrentPage = _pages[0];
            lcd.UpdatePage();


            //MainWindow mw = new MainWindow();
            //mw.setLCD(lcd);
            //mw.Show();
        }
示例#5
0
        public void Test_digit_5()
        {
            var    actual   = LCD.ToString(5);
            String expected = " _ " + Environment.NewLine
                              + "|_ " + Environment.NewLine
                              + " _|";

            Assert.Equal(expected, actual);
        }
示例#6
0
/// <summary>
/// /////////////////////////////////////////////////////////////////////////////////////////////////////
/// </summary>

        private static void InitLCD()
        {
            lcd = new LCD("Flight Simulator FSUIPC/G13 Connect");

            //The fastest you should send updates to the LCD is around 30fps or 34ms.  100ms is probably a good typical update speed.
            drawTimer          = new Timer(40);
            drawTimer.Elapsed += TimerOnElapsed;
            drawTimer.Enabled  = true;
        }
 public void tearDown()
 {
     raspberryPi.reset();
     raspberryPi        = null;
     TestGpiooInterface = null;
     TestLcdDisplay     = null;
     Testpotentiometer  = null;
     Testadconverter    = null;
 }
示例#8
0
        public void Test_100()
        {
            var actual = LCD.ToString(100);

            String expected = "    _  _ " + Environment.NewLine
                              + "  || || |" + Environment.NewLine
                              + "  ||_||_|";

            Assert.Equal(expected, actual);
        }
示例#9
0
        /// <summary>
        /// Write the LCD character in the designated column and record in _currentChars
        /// </summary>
        /// <param name="column"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public new bool WriteN(int column, LCD data)
        {
            return(true);

            /*lock (_criticalSectionLock)
             * {
             *      _currentChars[column - 1] = data;
             *      return base.WriteN(column, data);
             * }*/
        }
示例#10
0
        public void Test_digit_0_width2()
        {
            var actual = LCD.ToString(0, 2);

            String expected = " __ " + Environment.NewLine
                              + "|  |" + Environment.NewLine
                              + "|__|";

            Assert.Equal(expected, actual);
        }
示例#11
0
 public void draw(LCD c)
 {
     if (state)
     {
         c.LedOn(x, y, z);
     }
     else
     {
         c.LedOff(x, y, z);
     }
 }
示例#12
0
 public void draw(LCD c)
 {
     if (state)
     {
         c.LedOn(x, y, z);
     }
     else
     {
         c.LedOff(x, y, z);
     }
 }
示例#13
0
文件: Form1.cs 项目: hipejoe/G19LCD
        private void Form1_Load(object sender, EventArgs e)
        {
            //vID = 0x046D - pID = 0xC229  for the G19
            lcd = new LCD(1133, 49705);
            lcd.OpenDevice();

            //label1.Text = this.Width + "x" + this.Height;

            this.Width  = 320;
            this.Height = 240;
        }
示例#14
0
        public bool Tick()
        {
            var now    = Program.Stopwatch.Elapsed;
            int cycles = (int)((now - LastTick).TotalSeconds * 15000000.0);

            Console.WriteLine("Simulating {0} cycles", cycles);
            Program.Run(cycles);
            LCD.QueueDraw();
            LastTick = now;
            return(true);
        }
示例#15
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            life_timer          = new DispatcherTimer();
            life_timer.Interval = new TimeSpan(0, 0, 0, 0, 50);
            life_timer.Tick    += new EventHandler(Life_Tick);

            //vID = 0x046D - pID = 0xC229  for the G19
            lcd = new LCD(1133, 49705);
            lcd.OpenDevice();

            InitLife();
        }
示例#16
0
        public void Test_456_width2_height2()
        {
            var actual = LCD.ToString(456, 2, 2);

            String expected = "     __  __ " + Environment.NewLine
                              + "|  ||   |   " + Environment.NewLine
                              + "|__||__ |__ " + Environment.NewLine
                              + "   |   ||  |" + Environment.NewLine
                              + "   | __||__|";

            Assert.Equal(expected, actual);
        }
            public LCD GetLCD(string id)
            {
                LCD lcd = _lcds.Find(delegate(RS232LCD o)
                {
                    return(o.ID == id);
                });

                if (lcd != null)
                {
                    return(lcd);
                }
                throw new ApplicationException("Nie znalezion wyświetlacza o identyfikatorze '" + id + "'.");
            }
        public void setUp()
        {
            raspberryPi             = RaspberryPi.Instance;
            testAllComponents       = new HWComponent[] { new GPIOinterface(), new LCD(), new Potentiometer(), new Multiplexer(), new ADConverter() };
            testPartComponents      = new HWComponent[] { new GPIOinterface(), new Multiplexer(), new ADConverter() };
            testDuplicateComponents = new HWComponent[] { new GPIOinterface(), new Multiplexer(), new Multiplexer(), new ADConverter() };

            TestGpiooInterface = new GPIOinterface();
            TestLcdDisplay     = new LCD();
            Testpotentiometer  = new Potentiometer();
            Testmultiplexer    = new Multiplexer();
            Testadconverter    = new ADConverter();
        }
示例#19
0
        /// <summary>
        /// Write the LCD characters to the display and record in _currentChars
        /// </summary>
        /// <param name="data4"></param>
        /// <param name="data3"></param>
        /// <param name="data2"></param>
        /// <param name="data1"></param>
        /// <returns></returns>
        public new bool Write(LCD data4, LCD data3, LCD data2, LCD data1)
        {
            return(true);

            /*lock (_criticalSectionLock)
             * {
             *      _currentChars[4 - 1] = data4;
             *      _currentChars[3 - 1] = data3;
             *      _currentChars[2 - 1] = data2;
             *      _currentChars[1 - 1] = data1;
             *      return base.Write(data4, data3, data2, data1);
             * }*/
        }
示例#20
0
 /// <summary>
 /// Creates a clone of this instance
 /// </summary>
 /// <returns>Clone of this instance</returns>
 public object Clone()
 {
     return(new Channels
     {
         HTTP = (Channel)HTTP.Clone(),
         Telnet = (Channel)Telnet.Clone(),
         File = (Channel)File.Clone(),
         USB = (Channel)USB.Clone(),
         AUX = (Channel)AUX.Clone(),
         Daemon = (Channel)Daemon.Clone(),
         CodeQueue = (Channel)CodeQueue.Clone(),
         LCD = (Channel)LCD.Clone(),
         SPI = (Channel)SPI.Clone(),
         AutoPause = (Channel)AutoPause.Clone()
     });
 }
        /// <summary>
        /// Toogles the Backlight of the LCD to onn or off.
        /// </summary>
        /// <param name="parameter">1 for Backlight on or 0 for off</param>
        /// <returns>The provided parameter represented as a string.</returns>
        public string ToggleBacklight_LCD(int requestedParameter)
        {
            const byte ON  = 0x01;
            const byte OFF = 0x00;

            if (requestedParameter.Equals(1))
            {
                LCD.switchBacklightTo(ON);
            }
            else if (requestedParameter.Equals(0))
            {
                LCD.switchBacklightTo(OFF);
            }

            return(requestedParameter.ToString());
        }
示例#22
0
 public static void Main(string[] args)
 {
     if (args.Length > 0) {
         string input;
         int segments = 2;
         if (args [0] == "-s") {
             input = args [2];
             segments = Int32.Parse (args [1]);
         } else {
             input = args [0];
         }
         LCD lcd = new LCD (input, segments);
         lcd.draw ();
     } else {
         Console.WriteLine ("Usage: LCD.exe [-s SEGMENTS] NUMBER");
     }
 }
示例#23
0
        public void draw(LCD c)
        {
            for (int i = 0; i < sizeX * sizeY * sizeZ; ++i)
            {
                x = (byte)(x + (i / (sizeY * sizeZ)));
                y = (byte)(y + ((i % (sizeY * sizeZ)) / sizeY));
                z = (byte)(z + (i - y * sizeY - x * sizeY * sizeZ));

                if (voxels[i])
                {
                    c.LedOn(x, y, z);
                }
                else
                {
                    c.LedOff(x, y, z);
                }
            }
        }
示例#24
0
        public void draw(LCD c)
        {
            for (int i = 0; i < sizeX * sizeY * sizeZ; ++i)
            {
                x = (byte)(x + (i / (sizeY * sizeZ)));
                y = (byte)(y + ((i % (sizeY * sizeZ)) / sizeY));
                z = (byte)(z + (i - y * sizeY - x * sizeY * sizeZ));

                if (voxels[i])
                {
                    c.LedOn(x, y, z);
                }
                else
                {
                    c.LedOff(x, y, z);
                }
            }
        }
示例#25
0
        static void LCD_thread()
        {
            byte[] oldlcdMessageLine1 = System.Text.Encoding.UTF8.GetBytes("0");
            byte[] oldlcdMessageLine2 = System.Text.Encoding.UTF8.GetBytes("0");

            // initialise the LCD display
            LCD lcd = new LCD("COM2");

            // Timer turns Backlight off after 30 seconds of inactivity
            Timer backlightTimer = new Timer(BacklightTimerOff, lcd, 30000, 0);

            Thread.Sleep(2000);

            // Turn on Backlight for LCD, flickers due to power when only running on USB
            lcd.backlightOn();
            lcd.clear();

            while (true)
            {
                // Check if LCD data needs to be updated
                if (System.Convert.ToBase64String(lcdMessageLine1) != System.Convert.ToBase64String(oldlcdMessageLine1) || System.Convert.ToBase64String(lcdMessageLine2) != System.Convert.ToBase64String(oldlcdMessageLine2))
                {
                    lcd.backlightOn();
                    backlightTimer.Change(30000, 0); // Reset backlight timer to 30 seconds after screen change
                    if ((lcdMessageLine1 != oldlcdMessageLine1) && (lcdMessageLine2 != oldlcdMessageLine2))
                    {
                        lcd.clear();
                    }
                    if (lcdMessageLine1 != oldlcdMessageLine1)
                    {
                        oldlcdMessageLine1 = lcdMessageLine1;
                        lcd.setCursor(0, 0);
                        lcd.print(lcdMessageLine1);
                    }
                    if (lcdMessageLine2 != oldlcdMessageLine2)
                    {
                        oldlcdMessageLine2 = lcdMessageLine2;
                        lcd.setCursor(0, 1);
                        lcd.print(lcdMessageLine2);
                    }
                }
                Thread.Sleep(200);
            }
        }
示例#26
0
        private void Init()
        {
            this.lcd = new LCD(16, 2);
            this.InitAsync();

            Task.Delay(1000).Wait();

            this.led         = new LED(17, GpioPinDriveMode.Output);
            this.btnInvoer   = new Pushbutton(27, GpioPinDriveMode.InputPullUp);
            this.btnBevestig = new Pushbutton(21, GpioPinDriveMode.InputPullUp);

            this.stopwatch          = new Stopwatch();
            this.stopwatchTryDecode = new Stopwatch();

            this.timer          = new DispatcherTimer();
            this.timer.Interval = TimeSpan.FromMilliseconds(10);
            this.timer.Tick    += timerTick;
            this.timer.Start();
        }
示例#27
0
        private static void AnimateLCD(LCD <bool> lcd, string[] cmds, TimeSpan totalTime)
        {
            int cLeft = Console.CursorLeft;
            int cTop  = Console.CursorTop;
            var start = DateTime.UtcNow;
            var end   = start.Add(totalTime);
            int step  = (int)((end - start).TotalMilliseconds / cmds.Length);

            for (int i = 0; i < cmds.Length - 1; i++)
            {
                lcd.RunCommand(cmds[i], true);
                Console.SetCursorPosition(cLeft, cTop);
                Console.Write(lcd);
                Thread.Sleep(Math.Max(0, (int)(start.AddMilliseconds(step * i) - DateTime.UtcNow).TotalMilliseconds));
            }
            lcd.RunCommand(cmds[cmds.Length - 1], true);
            Console.SetCursorPosition(cLeft, cTop);
            Console.Write(lcd);
        }
示例#28
0
 public override ConsoleControl FindControlByAddress(string address)
 {
     if (ChannelLayer.Address == address)
     {
         return(ChannelLayer);
     }
     else if (GroupLayer.Address == address)
     {
         return(GroupLayer);
     }
     else if (SendsOnFader.Address == address)
     {
         return(SendsOnFader);
     }
     else if (LCD.Address == address)
     {
         return(LCD);
     }
     else if (EqBand.Address == address)
     {
         return(EqBand);
     }
     else if (RTAEqPre.Address == address)
     {
         return(RTAEqPre);
     }
     else if (RTAModeEq.Address == address)
     {
         return(RTAModeEq);
     }
     else if (RTASource.Address == address)
     {
         return(RTASource);
     }
     else if (Solo.Address == address)
     {
         return(Solo);
     }
     else
     {
         return(LCD.FindControlByAddress(address));
     }
 }
示例#29
0
        public Page2(LCD l)
        {
            lcd = l;
            InitializeComponent();

            mon = new Monitor();

            updateTimer          = new DispatcherTimer();
            updateTimer.Interval = new TimeSpan(0, 0, 0, 0, 200);
            updateTimer.Tick    += new EventHandler(updateTimer_Tick);

            monitorTimer          = new DispatcherTimer();
            monitorTimer.Interval = new TimeSpan(0, 0, 1);
            monitorTimer.Tick    += new EventHandler(MonitorTimer_Tick);


            mon.getMonitors();
            updateTimer.Start();
            monitorTimer.Start();
            obj = mon.getVLC();
        }
示例#30
0
        /// <summary>
        /// detects whether the diffusion lid is lowered
        /// </summary>
        private bool IsDiffusionLidProperlyPositioned()
        {
            //if instrument is docked return true
            if (Controller.IsDiffusionLidDown())
                return true;


            // else Prompt to lower diffusion lid.
            string message = GetText(DiagnosticResources.LOWER_DIFFUSION_LID, DiagnosticResources.PRESS_ANY_TO_CONTINUE, string.Empty);
            GetAnyKey(message);

            LCD.Display( "" );

            // if diffusion lid is down return true
            if ( Controller.IsDiffusionLidDown() )
                return true;

            // else report the results and return false;
            ReportDiagnostic( DiagnosticResources.NO_DIFFUSION_LID_DETECT, true, true );
            return false;  
        }
示例#31
0
        public static void Run()
        {
            string[] input = System.IO.File.ReadAllLines("day08.txt");

            LCD <bool> lcd = new LCD <bool>(50, 6);

            lcd.Formatter       = val => val ? "#" : ".";
            lcd.FormatDelimiter = null;

            AnimateLCD(lcd, input, TimeSpan.FromMilliseconds(2500));
            Console.WriteLine();
            Console.WriteLine();

            int part1 = lcd.Count(val => val);

            Console.WriteLine("==== Part 1 ====");
            Console.WriteLine($"Lit pixels: {part1}");
            Console.WriteLine();

            Console.WriteLine("==== Part 2 ====");
            Console.WriteLine("Read from the LCD above");
        }
示例#32
0
        /// <summary>
        /// Assigns every property from another instance
        /// </summary>
        /// <param name="from">Object to assign from</param>
        /// <exception cref="ArgumentNullException">other is null</exception>
        /// <exception cref="ArgumentException">Types do not match</exception>
        public void Assign(object from)
        {
            if (from == null)
            {
                throw new ArgumentNullException();
            }
            if (!(from is Channels other))
            {
                throw new ArgumentException("Invalid type");
            }

            HTTP.Assign(other.HTTP);
            Telnet.Assign(other.Telnet);
            File.Assign(other.File);
            USB.Assign(other.USB);
            AUX.Assign(other.AUX);
            Daemon.Assign(other.Daemon);
            CodeQueue.Assign(other.CodeQueue);
            LCD.Assign(other.LCD);
            SPI.Assign(other.SPI);
            AutoPause.Assign(other.AutoPause);
        }
示例#33
0
        private void button_Click(object sender, EventArgs e) //penekanan kepada semua tombol dengan action yang sama yaitu button klik
        {
            if ((LCD.Text == "0") || (operation_pressed))
            {
                LCD.Clear();
                operation_pressed = false;
            }

            Button b = (Button)sender;

            if (b.Text == ".")
            {
                if (!LCD.Text.Contains("."))
                {
                    LCD.Text = LCD.Text + b.Text;
                }
            }
            else
            {
                LCD.Text = LCD.Text + b.Text;
            }
            /* LCD.Text = LCD.Text + "1";*/
        }
示例#34
0
 public void draw(LCD c);
示例#35
0
 public BaseAnim()
 {
     cube = new LCD();
     cts = new CancellationTokenSource();
     anim = new Task(new Action(Run), cts.Token);
 }