예제 #1
0
        public static async Task ScrollString(this DisplayDriver driver, string str, int duration)
        {
            var displayString  = DisplayFrame.GetString(str).ToArray();
            int scrollInterval = duration / (displayString.Length + 6);

            // Start with a blank frame
            var frame = DisplayFrame.Empty;

            driver.WriteFrame(frame);
            await Task.Delay(scrollInterval);

            // Push each character in from the right, one at a time
            foreach (var c in displayString)
            {
                frame = frame.WithPushedCharacter(c);
                driver.WriteFrame(frame);
                await Task.Delay(scrollInterval);
            }

            // Push three more blank characters to end off with a blank screen
            for (int i = 0; i < 3; i++)
            {
                frame = frame.WithPushedCharacter(DisplayCharacter.Empty);
                driver.WriteFrame(frame);
                await Task.Delay(scrollInterval);
            }
        }
예제 #2
0
        public static async Task BusyLoop(this DisplayDriver driver, int interval, int duration)
        {
            using (var controller = new DisplayLoopController())
            {
                await controller.StartNewLoop(new BusyDisplayLoop(driver, interval));

                await Task.Delay(duration);
            }
        }
예제 #3
0
        public BusyDisplayLoop(DisplayDriver driver, int delay)
        {
            driver.ThrowIfNull(nameof(driver));
            if (delay < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(delay));
            }

            Driver = driver;
            Delay  = delay;
        }
예제 #4
0
 public static void Clear(this DisplayDriver driver)
 {
     driver.WriteFrame(DisplayFrame.Empty);
 }
예제 #5
0
 public static void WriteDecimal(this DisplayDriver driver, decimal value, StatusLed signLed = StatusLed.Blue)
 {
     driver.WriteFrame(DisplayFrame.FromDecimal(value, signLed));
 }
예제 #6
0
 public static void WriteString(this DisplayDriver driver, string str)
 {
     driver.WriteFrame(DisplayFrame.FromString(str));
 }