/// <summary>Constructs a new instance.</summary>
        /// <param name="DigitalPin9onGSocket">Pin 9 on Socket G.</param>
        public void ConfigureDisplay()
        {
            display = DisplayController.GetDefault();

            var controllerSetting = new
                                    GHIElectronics.TinyCLR.Devices.Display.ParallelDisplayControllerSettings
            {
                Width                    = 480,
                Height                   = 272,
                DataFormat               = GHIElectronics.TinyCLR.Devices.Display.DisplayDataFormat.Rgb565,
                PixelClockRate           = 10000000,
                PixelPolarity            = false,
                DataEnablePolarity       = false,
                DataEnableIsFixed        = false,
                HorizontalFrontPorch     = 2,
                HorizontalBackPorch      = 2,
                HorizontalSyncPulseWidth = 41,
                HorizontalSyncPolarity   = false,
                VerticalFrontPorch       = 2,
                VerticalBackPorch        = 2,
                VerticalSyncPulseWidth   = 10,
                VerticalSyncPolarity     = false,
            };

            display.SetConfiguration(controllerSetting);
            display.Enable();


            Screen = Graphics.FromHdc(display.Hdc); //Calling flush on the object returned will flush to the display represented by Hdc. Only one active display is supported at this time.

            var ptr  = Memory.UnmanagedMemory.Allocate(640 * 480 * 2);
            var data = Memory.UnmanagedMemory.ToBytes(ptr, 640 * 480 * 2);
        }
Beispiel #2
0
        public static void InitializeDisplay()
        {
            var backlight = GpioController.GetDefault().OpenPin(SC20260.GpioPin.PA15);

            backlight.SetDriveMode(GpioPinDriveMode.Output);

            backlight.Write(GpioPinValue.High);

            DisplayController = GHIElectronics.TinyCLR.Devices.Display.DisplayController.GetDefault();

            var controllerSetting = new GHIElectronics.TinyCLR.Devices.Display.ParallelDisplayControllerSettings {
                // 480x272
                Width                    = 480,
                Height                   = 272,
                DataFormat               = GHIElectronics.TinyCLR.Devices.Display.DisplayDataFormat.Rgb565,
                PixelClockRate           = 10000000,
                PixelPolarity            = false,
                DataEnablePolarity       = false,
                DataEnableIsFixed        = false,
                HorizontalFrontPorch     = 2,
                HorizontalBackPorch      = 2,
                HorizontalSyncPulseWidth = 41,
                HorizontalSyncPolarity   = false,
                VerticalFrontPorch       = 2,
                VerticalBackPorch        = 2,
                VerticalSyncPulseWidth   = 10,
                VerticalSyncPolarity     = false,
            };

            DisplayController.SetConfiguration(controllerSetting);
            DisplayController.Enable();
        }
Beispiel #3
0
        static void DisplayConfigWPF()
        {
            var backlight = GpioController.GetDefault().OpenPin(BACKLIGHT);

            backlight.SetDriveMode(GpioPinDriveMode.Output);
            backlight.Write(GpioPinValue.High);

            var displayController = GHIElectronics.TinyCLR.Devices.Display.DisplayController.GetDefault();
            var controllerSetting = new GHIElectronics.TinyCLR.Devices.Display.ParallelDisplayControllerSettings {
                // 480x272
                Width                    = SCREEN_WIDTH,
                Height                   = SCREEN_HEIGHT,
                DataFormat               = GHIElectronics.TinyCLR.Devices.Display.DisplayDataFormat.Rgb565,
                PixelClockRate           = 10000000,
                PixelPolarity            = false,
                DataEnablePolarity       = false,
                DataEnableIsFixed        = false,
                HorizontalFrontPorch     = 2,
                HorizontalBackPorch      = 2,
                HorizontalSyncPulseWidth = 41,
                HorizontalSyncPolarity   = false,
                VerticalFrontPorch       = 2,
                VerticalBackPorch        = 2,
                VerticalSyncPulseWidth   = 10,
                VerticalSyncPolarity     = false,
            };

            displayController.SetConfiguration(controllerSetting);
            displayController.Enable();

            var i2cController = I2cController.FromName(SC20260.I2cBus.I2c1);

            var settings = new I2cConnectionSettings(0x38)  // the slave's address
            {
                BusSpeed      = 100000,
                AddressFormat = I2cAddressFormat.SevenBit,
            };

            var i2cDevice = i2cController.GetDevice(settings);

            var interrupt = GpioController.GetDefault().OpenPin(TOUCH_IRQ);

            touch            = new FT5xx6Controller(i2cDevice, interrupt);
            touch.TouchDown += Touch_TouchDown;
            touch.TouchUp   += Touch_TouchUp;

            // Create WPF window
            app = new Program(displayController);

            SelectPage  = new SelectPage();
            ConnectPage = new ConnectPage("");
            SplashPage  = new SplashPage();

            WpfWindow            = Program.CreateWindow(displayController);
            WpfWindow.Child      = SplashPage.Elements;
            WpfWindow.Visibility = Visibility.Visible;

            app.Run(WpfWindow);
        }
        static void InitLcd()
        {
            const int Backlight = SC20260.GpioPin.PA15;

            var backlight = GpioController.GetDefault().OpenPin(Backlight);

            backlight.SetDriveMode(GpioPinDriveMode.Output);

            backlight.Write(GpioPinValue.Low);

            Thread.Sleep(100);

            backlight.Write(GpioPinValue.High);

            var displayController = DisplayController.GetDefault();

            var controllerSetting = new GHIElectronics.TinyCLR.Devices.Display.ParallelDisplayControllerSettings {
                Width                    = 480,
                Height                   = 272,
                DataFormat               = GHIElectronics.TinyCLR.Devices.Display.DisplayDataFormat.Rgb565,
                PixelClockRate           = 10000000,
                PixelPolarity            = false,
                DataEnablePolarity       = false,
                DataEnableIsFixed        = false,
                HorizontalFrontPorch     = 2,
                HorizontalBackPorch      = 2,
                HorizontalSyncPulseWidth = 41,
                HorizontalSyncPolarity   = false,
                VerticalFrontPorch       = 2,
                VerticalBackPorch        = 2,
                VerticalSyncPulseWidth   = 10,
                VerticalSyncPolarity     = false,
            };

            displayController.SetConfiguration(controllerSetting);
            displayController.Enable();

            screen = Graphics.FromHdc(displayController.Hdc);
            font   = Resources.GetFont(Resources.FontResources.NinaB);
        }