Пример #1
0
        public static void Main()
        {
            //GC.EnableGCMessages(true);

            Debug.WriteLine($"{ SystemInfo.TargetName } running on { SystemInfo.Platform }.");

            //Debug.GC(false);

            // mind to set a pin that exists on the board being tested
            // PJ5 is LD2 in STM32F769I_DISCO
            //GpioPin led = GpioController.GetDefault().OpenPin(PinNumber('J', 5));
            // PD15 is LED6 in DISCOVERY4
            //GpioPin led = GpioController.GetDefault().OpenPin(PinNumber('D', 15));
            // PE15 is LED1 in QUAIL
            //GpioPin led = GpioController.GetDefault().OpenPin(PinNumber('E', 15));
            // PG13 is LD3 in F429I-DISCO
            GpioPin led = GpioController.GetDefault().OpenPin(PinNumber('G', 14));

            //GpioPin led = GpioController.GetDefault().OpenPin(4);

            led.SetDriveMode(GpioPinDriveMode.Output);

            int i = 0;

            for (; ;)
            {
                i++;

                int[] array = new int[8192];

                led.Toggle();
                Thread.Sleep(100);
                led.Toggle();
                Thread.Sleep(400);

                Debug.WriteLine(">> " + i.ToString() + " free memory: " + GC.Run(true) + " bytes");

                Thread.Sleep(1000);
            }
        }
Пример #2
0
        public static void Main()
        {
            GC.EnableGCMessages(true);

            Debug.WriteLine($"{ SystemInfo.TargetName } running on { SystemInfo.Platform }.");

            Debug.WriteLine($"Initial managed heap size: {GC.Run(false)} bytes");

            GpioController gpioController = new();

            // mind to set a pin that exists on the board being tested
            // PJ5 is LD2 in STM32F769I_DISCO
            //GpioPin led = gpioController.OpenPin(PinNumber('J', 5), PinMode.Output);
            // PD15 is LED6 in DISCOVERY4
            //GpioPin led = gpioController.OpenPin(PinNumber('D', 15), PinMode.Output);
            // PE15 is LED1 in QUAIL
            //GpioPin led = gpioController.OpenPin(PinNumber('E', 15), PinMode.Output);
            // PG13 is LD3 in F429I-DISCO
            //GpioPin led = gpioController.OpenPin(PinNumber('G', 14), PinMode.Output);
            // ESP32
            GpioPin led = gpioController.OpenPin(4, PinMode.Output);

            int i = 0;

            for (; ;)
            {
                i++;

                int[] array = new int[4096];

                led.Toggle();
                Thread.Sleep(100);
                led.Toggle();
                Thread.Sleep(400);

                Debug.WriteLine(">> " + i.ToString() + " free memory: " + GC.Run(true) + " bytes");

                Thread.Sleep(1000);
            }
        }