Пример #1
0
        private static void CheckCircuit(Mbi5027 sr)
        {
            Console.WriteLine("Checking circuit");
            sr.EnableDetectionMode();

            var index = sr.BitLength - 1;

            foreach (var value in sr.ReadOutputErrorStatus())
            {
                Console.WriteLine($"Bit {index--}: {value}");
            }

            sr.EnableNormalMode();
        }
Пример #2
0
        /// <summary>
        /// Application entrypoint
        /// </summary>
        public static void Main(string[] args)
        {
            var sr = new Mbi5027(Mbi5027PinMapping.Complete);
            var cancellationSource = new CancellationTokenSource();

            Console.CancelKeyPress += (s, e) =>
            {
                e.Cancel = true;
                cancellationSource.Cancel();
            };

            Console.WriteLine($"Driver for {nameof(Mbi5027)}");
            Console.WriteLine($"Register bit length: {sr.BitLength}");

            CheckCircuit(sr);
            BinaryCounter(sr, cancellationSource);
            CheckCircuit(sr);
            sr.ShiftClear();
        }