Example #1
0
        /// <summary>Constructs a new instance.</summary>
        /// <param name="DigitalPin9onGSocket">Pin 9 on Socket G.</param>
        public void ConfigureDisplay()
        {
            displayController = DisplayController.GetDefault(); //Currently returns the hardware LCD controller by default

            if (DisplayType == DisplayTypes.Display7inch)
            {
                //Enables the display
                displayController.ApplySettings(new ParallelDisplayControllerSettings
                {
                    Width                    = 800,
                    Height                   = 480,
                    PixelClockRate           = 20000,
                    PixelPolarity            = false,
                    OutputEnablePolarity     = true,
                    OutputEnableIsFixed      = false,
                    HorizontalFrontPorch     = 40,
                    HorizontalBackPorch      = 88,
                    HorizontalSyncPulseWidth = 48,
                    HorizontalSyncPolarity   = false,
                    VerticalFrontPorch       = 13,
                    VerticalBackPorch        = 32,
                    VerticalSyncPulseWidth   = 3,
                    VerticalSyncPolarity     = false,
                });

                /*
                 * UsesCommonSyncPin = false, //not the proper property, but we needed it for OutputEnableIsFixed
                 *              CommonSyncPinIsActiveHigh = true, //not the proper property, but we needed it for OutputEnablePolarity
                 *              PixelDataIsValidOnClockRisingEdge = false,
                 *              MaximumClockSpeed = 20000,
                 *              HorizontalSyncPulseIsActiveHigh = false,
                 *              HorizontalSyncPulseWidth = 48,
                 *              HorizontalBackPorch = 88,
                 *              HorizontalFrontPorch = 40,
                 *              VerticalSyncPulseIsActiveHigh = false,
                 *              VerticalSyncPulseWidth = 3,
                 *              VerticalBackPorch = 32,
                 *              VerticalFrontPorch = 13,
                 * 800, 480
                 */
            }
            else if (DisplayType == DisplayTypes.Display43Inch)
            {
                displayController.ApplySettings(new ParallelDisplayControllerSettings
                {
                    Width                    = 480,
                    Height                   = 272,
                    PixelClockRate           = 20000,
                    PixelPolarity            = false,
                    OutputEnablePolarity     = true,
                    OutputEnableIsFixed      = false,
                    HorizontalFrontPorch     = 2,
                    HorizontalBackPorch      = 2,
                    HorizontalSyncPulseWidth = 41,
                    HorizontalSyncPolarity   = false,
                    VerticalFrontPorch       = 2,
                    VerticalBackPorch        = 2,
                    VerticalSyncPulseWidth   = 10,
                    VerticalSyncPolarity     = false,
                });

                /*
                 * UsesCommonSyncPin = false, //not the proper property, but we needed it for OutputEnableIsFixed
                 *              CommonSyncPinIsActiveHigh = true, //not the proper property, but we needed it for OutputEnablePolarity
                 *              PixelDataIsValidOnClockRisingEdge = false,
                 *              MaximumClockSpeed = 20000,
                 *              HorizontalSyncPulseIsActiveHigh = false,
                 *              HorizontalSyncPulseWidth = 41,
                 *              HorizontalBackPorch = 2,
                 *              HorizontalFrontPorch = 2,
                 *              VerticalSyncPulseIsActiveHigh = false,
                 *              VerticalSyncPulseWidth = 10,
                 *              VerticalBackPorch = 2,
                 *              VerticalFrontPorch = 2,
                 * 480, 272,
                 */
            }
            Screen = Graphics.FromHdc(displayController.Hdc); //Calling flush on the object returned will flush to the display represented by Hdc. Only one active display is supported at this time.
        }