Example #1
0
        private static bool InitLcd()
        {
            //PSP lcd config 4.3" - 480x272
            Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations();
            lcdConfig.PriorityEnable = false;

            lcdConfig.OutputEnableIsFixed  = true;
            lcdConfig.OutputEnablePolarity = true;

            lcdConfig.PixelClockDivider = 8;     //9MHz clock
            lcdConfig.PixelPolarity     = false; //falling edge

            //clocks per line = 525
            lcdConfig.HorizontalSyncPolarity   = false;
            lcdConfig.HorizontalSyncPulseWidth = 41;
            lcdConfig.Width = 480;
            lcdConfig.HorizontalBackPorch  = 2;
            lcdConfig.HorizontalFrontPorch = 2;

            //lines per frame = 286
            lcdConfig.VerticalSyncPolarity   = false;
            lcdConfig.VerticalSyncPulseWidth = 10;
            lcdConfig.Height             = 272;
            lcdConfig.VerticalBackPorch  = 2;
            lcdConfig.VerticalFrontPorch = 2;

            return(Configuration.LCD.Set(lcdConfig));
        }
Example #2
0
        public static bool SetLCDConfiguration_320_240() // 3.5" LCD with resolution of 320x240 used on EMX development system. Part number: PT0353224T-A802.
        {
            if (Utils.IsEmulator)
            {
                return(false);
            }

            //if (Configuration.Heap.SetCustomHeapSize(1024 * 1024 * 2)) // 2 MB
            //    return true;

            Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations();

            lcdConfig.Width  = 320;
            lcdConfig.Height = 240;

            //lcdConfig.PriorityEnable = false;
            lcdConfig.OutputEnableIsFixed    = true;
            lcdConfig.OutputEnablePolarity   = true;
            lcdConfig.PixelPolarity          = false;//true
            lcdConfig.HorizontalSyncPolarity = false;
            lcdConfig.VerticalSyncPolarity   = false;

            lcdConfig.HorizontalSyncPulseWidth = 41;
            lcdConfig.HorizontalBackPorch      = 27;
            lcdConfig.HorizontalFrontPorch     = 51;

            lcdConfig.VerticalSyncPulseWidth = 10;
            lcdConfig.VerticalBackPorch      = 8;
            lcdConfig.VerticalFrontPorch     = 16;

            //lcdConfig.PixelClockDivider = 8;
            lcdConfig.PixelClockRateKHz = 9000;

            return(Configuration.LCD.Set(lcdConfig));
        }
Example #3
0
        public static bool SetLCDConfiguration_480_272() // 4.3" LCD with resolution of 480x272 used on ChipworkX and Embedded Master development systems. Part number: LQ043T1DG01.
        {
            if (Utils.IsEmulator)
            {
                return(false);
            }

            //if (Configuration.Heap.SetCustomHeapSize(1024 * 1024 * 2)) // 2 MB
            //    return true;

            Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations();

            lcdConfig.Width  = 480;
            lcdConfig.Height = 272;

            //lcdConfig.PriorityEnable = false;
            lcdConfig.OutputEnableIsFixed  = true;
            lcdConfig.OutputEnablePolarity = true;
            lcdConfig.PixelPolarity        = false;

            lcdConfig.HorizontalSyncPolarity = false;
            lcdConfig.VerticalSyncPolarity   = false;

            lcdConfig.HorizontalSyncPulseWidth = 41;
            lcdConfig.HorizontalBackPorch      = 2;
            lcdConfig.HorizontalFrontPorch     = 2;

            lcdConfig.VerticalSyncPulseWidth = 10;
            lcdConfig.VerticalBackPorch      = 2;
            lcdConfig.VerticalFrontPorch     = 2;

            //lcdConfig.PixelClockDivider = 8; // for EMX
            lcdConfig.PixelClockRateKHz = 9000;
            //lcdConfig.PixelClockDivider = 4; // for ChipworkX
            //lcdConfig.PixelClockRateKHz = 18000;

            return(Configuration.LCD.Set(lcdConfig));
        }
Example #4
0
        /// <summary>
        /// This sets the LCD configuration.  If the value GT.Mainboard.LCDConfiguration.HeadlessConfig (=null) is specified, no display support should be active.
        /// If a non-null value is specified but the property LCDControllerEnabled is false, the LCD controller should be disabled if present,
        /// though the Bitmap width/height for WPF should be modified to the Width and Height parameters.  This must reboot if the LCD configuration changes require a reboot.
        /// </summary>
        /// <param name="lcdConfig">The LCD Configuration</param>
        public override void SetLCDConfiguration(GT.Mainboard.LCDConfiguration lcdConfig)
        {
            var config = new Configuration.LCD.Configurations();

            if (lcdConfig.LCDControllerEnabled)
            {
                config.Height = lcdConfig.Height;
                config.HorizontalBackPorch      = lcdConfig.HorizontalBackPorch;
                config.HorizontalFrontPorch     = lcdConfig.HorizontalFrontPorch;
                config.HorizontalSyncPolarity   = lcdConfig.HorizontalSyncPolarity;
                config.HorizontalSyncPulseWidth = lcdConfig.HorizontalSyncPulseWidth;
                config.OutputEnableIsFixed      = lcdConfig.OutputEnableIsFixed;
                config.OutputEnablePolarity     = lcdConfig.OutputEnablePolarity;
                config.PixelClockRateKHz        = (uint)(133000 / lcdConfig.PixelClockDivider);
                config.PixelPolarity            = lcdConfig.PixelPolarity;
                config.VerticalBackPorch        = lcdConfig.VerticalBackPorch;
                config.VerticalFrontPorch       = lcdConfig.VerticalFrontPorch;
                config.VerticalSyncPolarity     = lcdConfig.VerticalSyncPolarity;
                config.VerticalSyncPulseWidth   = lcdConfig.VerticalSyncPulseWidth;
                config.Width = lcdConfig.Width;
            }
            else
            {
                config                   = Configuration.LCD.HeadlessConfig;
                config.Width             = lcdConfig.Width;
                config.Height            = lcdConfig.Height;
                config.PixelClockRateKHz = 0;
            }

            if (Configuration.LCD.Set(config))
            {
                Debug.Print("Updating display configuration. THE MAINBOARD WILL NOW REBOOT.");
                Debug.Print("To continue debugging, you will need to restart debugging manually (Ctrl-Shift-F5)");

                Microsoft.SPOT.Hardware.PowerState.RebootDevice(false);
            }
        }
Example #5
0
        public static bool SetLCDConfiguration_800_480() // 7" LCD with resolution of 800x480
        {
            if (Utils.IsEmulator)
            {
                return(false);
            }

            //if (Configuration.Heap.SetCustomHeapSize(1024 * 1024 * 4)) // 4 MB
            //    return true;

            Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations();

            lcdConfig.Width  = 800;
            lcdConfig.Height = 480;

            //lcdConfig.PriorityEnable = true;
            lcdConfig.OutputEnableIsFixed  = false;
            lcdConfig.OutputEnablePolarity = true;
            lcdConfig.PixelPolarity        = false;

            lcdConfig.HorizontalSyncPolarity = false;
            lcdConfig.VerticalSyncPolarity   = false;

            lcdConfig.HorizontalSyncPulseWidth = 150; // For EMX
            // lcdConfig.HorizontalSyncPulseWidth = 60; // On ChipworkX, there is a limited range for the HorizontalSyncPulseWidth. Set it to 60 instead.
            lcdConfig.HorizontalBackPorch  = 150;
            lcdConfig.HorizontalFrontPorch = 150;

            lcdConfig.VerticalSyncPulseWidth = 2;
            lcdConfig.VerticalBackPorch      = 2;
            lcdConfig.VerticalFrontPorch     = 2;

            //lcdConfig.PixelClockDivider = 4;
            lcdConfig.PixelClockRateKHz = 18000;

            return(Configuration.LCD.Set(lcdConfig));
        }
Example #6
0
        public static bool SetLCDConfiguration_640_480() // VGA display with resolution of 640x480 (actual timings for 480x480) on EMX.
        {
            if (Utils.IsEmulator)
            {
                return(false);
            }

            //if (Configuration.Heap.SetCustomHeapSize(1024 * 1024 * 2)) // 2 MB
            //    return true;

            Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations();

            lcdConfig.Width  = 480;
            lcdConfig.Height = 480;

            //lcdConfig.PriorityEnable = true; // VGA requires high refresh rate, enable bus priority.
            lcdConfig.OutputEnableIsFixed  = true;
            lcdConfig.OutputEnablePolarity = true;
            lcdConfig.PixelPolarity        = true;

            lcdConfig.HorizontalSyncPolarity = false;
            lcdConfig.VerticalSyncPolarity   = false;

            lcdConfig.HorizontalSyncPulseWidth = 69;
            lcdConfig.HorizontalBackPorch      = 20;
            lcdConfig.HorizontalFrontPorch     = 3;

            lcdConfig.VerticalSyncPulseWidth = 2;
            lcdConfig.VerticalBackPorch      = 32;
            lcdConfig.VerticalFrontPorch     = 11;

            //lcdConfig.PixelClockDivider = 4;
            lcdConfig.PixelClockRateKHz = 18000;

            return(Configuration.LCD.Set(lcdConfig));
        }
Example #7
0
        /// <summary>
        /// This sets the LCD configuration.  If the value GT.Mainboard.LCDConfiguration.HeadlessConfig (=null) is specified, no display support should be active.
        /// If a non-null value is specified but the property LCDControllerEnabled is false, the LCD controller should be disabled if present,
        /// though the Bitmap width/height for WPF should be modified to the Width and Height parameters.  This must reboot if the LCD configuration changes require a reboot.
        /// </summary>
        /// <param name="lcdConfig">The LCD Configuration</param>
        public override void SetLCDConfiguration(GT.Mainboard.LCDConfiguration lcdConfig)
        {
            if (lcdConfig.LCDControllerEnabled == false)
            {
                //Configuration.LCD.Set(Configuration.LCD.HeadlessConfig);
                var config = new Configuration.LCD.Configurations();
                config = Configuration.LCD.HeadlessConfig;

                config.Width  = lcdConfig.Width;
                config.Height = lcdConfig.Height;

                // removed
                //config.PixelClockDivider = 0xFF;

                // added
                config.PixelClockRateKHz = 0;

                if (Configuration.LCD.Set(config))
                {
                    Debug.Print("Updating display configuration. THE MAINBOARD WILL NOW REBOOT.");
                    Debug.Print("To continue debugging, you will need to restart debugging manually (Ctrl-Shift-F5)");

                    // A new configuration was set, so we must reboot
                    Microsoft.SPOT.Hardware.PowerState.RebootDevice(false);
                }
            }
            else
            {
                var config = new Configuration.LCD.Configurations();

                //if (lcdConfig.LCDControllerEnabled == false)
                //{
                //    // EMX firmware has PixelClockDivider 0xFF as special value meaning "don't run"
                //    config.PixelClockDivider = 0xff;
                //}

                config.Height = lcdConfig.Height;
                config.HorizontalBackPorch      = lcdConfig.HorizontalBackPorch;
                config.HorizontalFrontPorch     = lcdConfig.HorizontalFrontPorch;
                config.HorizontalSyncPolarity   = lcdConfig.HorizontalSyncPolarity;
                config.HorizontalSyncPulseWidth = lcdConfig.HorizontalSyncPulseWidth;
                config.OutputEnableIsFixed      = lcdConfig.OutputEnableIsFixed;
                config.OutputEnablePolarity     = lcdConfig.OutputEnablePolarity;

                // removed
                //config.PixelClockDivider = lcdConfig.PixelClockDivider;

                // added
                config.PixelClockRateKHz = (uint)(72000 / lcdConfig.PixelClockDivider);

                config.PixelPolarity = lcdConfig.PixelPolarity;

                // removed
                //config.PriorityEnable = lcdConfig.PriorityEnable;

                config.VerticalBackPorch      = lcdConfig.VerticalBackPorch;
                config.VerticalFrontPorch     = lcdConfig.VerticalFrontPorch;
                config.VerticalSyncPolarity   = lcdConfig.VerticalSyncPolarity;
                config.VerticalSyncPulseWidth = lcdConfig.VerticalSyncPulseWidth;
                config.Width = lcdConfig.Width;

                if (Configuration.LCD.Set(config))
                {
                    Debug.Print("Updating display configuration. THE MAINBOARD WILL NOW REBOOT.");
                    Debug.Print("To continue debugging, you will need to restart debugging manually (Ctrl-Shift-F5)");

                    // A new configuration was set, so we must reboot
                    Microsoft.SPOT.Hardware.PowerState.RebootDevice(false);
                }
            }
        }
Example #8
0
        // 3.5" LCD with resolution of 320x240 used on EMX development system. Part number: PT0353224T-A802.
        public static bool SetLCDConfiguration_320_240()
        {
            if (Utils.IsEmulator)
                return false;

            //if (Configuration.Heap.SetCustomHeapSize(1024 * 1024 * 2)) // 2 MB
            //    return true;

            Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations();

            lcdConfig.Width = 320;
            lcdConfig.Height = 240;

            //lcdConfig.PriorityEnable = false;
            lcdConfig.OutputEnableIsFixed = true;
            lcdConfig.OutputEnablePolarity = true;
            lcdConfig.PixelPolarity = false;//true
            lcdConfig.HorizontalSyncPolarity = false;
            lcdConfig.VerticalSyncPolarity = false;

            lcdConfig.HorizontalSyncPulseWidth = 41;
            lcdConfig.HorizontalBackPorch = 27;
            lcdConfig.HorizontalFrontPorch = 51;

            lcdConfig.VerticalSyncPulseWidth = 10;
            lcdConfig.VerticalBackPorch = 8;
            lcdConfig.VerticalFrontPorch = 16;

            //lcdConfig.PixelClockDivider = 8;
            lcdConfig.PixelClockRateKHz = 9000;

            return Configuration.LCD.Set(lcdConfig);
        }
Example #9
0
        // 7" LCD with resolution of 800x480
        public static bool SetLCDConfiguration_800_480()
        {
            if (Utils.IsEmulator)
                return false;

            //if (Configuration.Heap.SetCustomHeapSize(1024 * 1024 * 4)) // 4 MB
            //    return true;

            Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations();

            lcdConfig.Width = 800;
            lcdConfig.Height = 480;

            //lcdConfig.PriorityEnable = true;
            lcdConfig.OutputEnableIsFixed = false;
            lcdConfig.OutputEnablePolarity = true;
            lcdConfig.PixelPolarity = false;

            lcdConfig.HorizontalSyncPolarity = false;
            lcdConfig.VerticalSyncPolarity = false;

            lcdConfig.HorizontalSyncPulseWidth = 150; // For EMX
            // lcdConfig.HorizontalSyncPulseWidth = 60; // On ChipworkX, there is a limited range for the HorizontalSyncPulseWidth. Set it to 60 instead.
            lcdConfig.HorizontalBackPorch = 150;
            lcdConfig.HorizontalFrontPorch = 150;

            lcdConfig.VerticalSyncPulseWidth = 2;
            lcdConfig.VerticalBackPorch = 2;
            lcdConfig.VerticalFrontPorch = 2;

            //lcdConfig.PixelClockDivider = 4;
            lcdConfig.PixelClockRateKHz = 18000;

            return Configuration.LCD.Set(lcdConfig);
        }
Example #10
0
        // VGA display with resolution of 640x480 (actual timings for 480x480) on EMX.
        public static bool SetLCDConfiguration_640_480()
        {
            if (Utils.IsEmulator)
                return false;

            //if (Configuration.Heap.SetCustomHeapSize(1024 * 1024 * 2)) // 2 MB
            //    return true;

            Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations();

            lcdConfig.Width = 480;
            lcdConfig.Height = 480;

            //lcdConfig.PriorityEnable = true; // VGA requires high refresh rate, enable bus priority.
            lcdConfig.OutputEnableIsFixed = true;
            lcdConfig.OutputEnablePolarity = true;
            lcdConfig.PixelPolarity = true;

            lcdConfig.HorizontalSyncPolarity = false;
            lcdConfig.VerticalSyncPolarity = false;

            lcdConfig.HorizontalSyncPulseWidth = 69;
            lcdConfig.HorizontalBackPorch = 20;
            lcdConfig.HorizontalFrontPorch = 3;

            lcdConfig.VerticalSyncPulseWidth = 2;
            lcdConfig.VerticalBackPorch = 32;
            lcdConfig.VerticalFrontPorch = 11;

            //lcdConfig.PixelClockDivider = 4;
            lcdConfig.PixelClockRateKHz = 18000;

            return Configuration.LCD.Set(lcdConfig);
        }