/// <summary>
            /// Sets the display configuration.  This must be called by all display module constructors (even ones not using LCD displays)
            /// </summary>
            /// <param name="displayConfig">The display configuration.</param>
            protected static void SetLCDConfig(Mainboard.LCDConfiguration displayConfig)
            {
                if (_numDisplaysConstructed != _numDisplaysConfigured + 1)
                {
                    DisplayError("ERROR IN DISPLAY MODULE DRIVER: All display module constructors must call DisplayModule.SetLCDConfig() once.");
                }

                if (displayConfig != Mainboard.LCDConfiguration.HeadlessConfig && (displayConfig.Height == 0 || displayConfig.Width == 0))
                {
                    DisplayError("ERROR IN DISPLAY MODULE DRIVER: LCDConfiguration must specify Height and Width of display");
                }
                _numDisplaysConfigured++;
                _displayModuleToBeConfigured._config = displayConfig;

                if (displayConfig.LCDControllerEnabled)
                {
                    if (_lcdControllerConfig != null)
                    {
                        if (_lcdControllerConfig == lcdPinsUsedAsIOs)
                        {
                            DisplayError("ERROR: Cannot use LCD controller pins as IOs and also use an LCD controller based display");
                        }
                        else
                        {
                            DisplayError("ERROR: Cannot use more than one LCD controller based display at a time");
                        }
                    }

                    _lcdControllerConfig = displayConfig;
                    Mainboard.SetLCDConfiguration(displayConfig);
                }
            }
Ejemplo n.º 2
0
        private void ConfigureLCD()
        {
            Mainboard.LCDConfiguration lcdConfig = new Mainboard.LCDConfiguration();

            lcdConfig.LCDControllerEnabled = true;

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

            // Only use if needed, see documentation.
            lcdConfig.PriorityEnable = false;

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

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

            lcdConfig.HorizontalSyncPulseWidth = 41;
            lcdConfig.HorizontalBackPorch      = 2;
            lcdConfig.HorizontalFrontPorch     = 2;
            lcdConfig.VerticalSyncPulseWidth   = 10;
            lcdConfig.VerticalBackPorch        = 2;
            lcdConfig.VerticalFrontPorch       = 2;

            lcdConfig.PixelClockDivider = 6;

            // Set configs
            DisplayModule.SetLCDConfig(lcdConfig);
        }
Ejemplo n.º 3
0
        private void ConfigureLCD()
        {
            Mainboard.LCDConfiguration lcdConfig = new Mainboard.LCDConfiguration();

            lcdConfig.LCDControllerEnabled = true;

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

            // Only use if needed, see documentation.
            //lcdConfig.PriorityEnable = true;

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

            lcdConfig.HorizontalSyncPolarity = true;
            lcdConfig.VerticalSyncPolarity   = true;
            lcdConfig.PixelPolarity          = false;

            lcdConfig.HorizontalSyncPulseWidth = 1;
            lcdConfig.HorizontalBackPorch      = 46;
            lcdConfig.HorizontalFrontPorch     = 16;
            lcdConfig.VerticalSyncPulseWidth   = 1;
            lcdConfig.VerticalBackPorch        = 23;
            lcdConfig.VerticalFrontPorch       = 7;

            // NOTE: This is used for ChipworkX, comment if using EMX.
            lcdConfig.PixelClockDivider = 5;
            //lcdConfig.PixelClockRate = 25000;

            // Set configs
            DisplayModule.SetLCDConfig(lcdConfig);
        }
            /// <summary>
            /// Called when a pin otherwise used for the LCD controller is reserved for another module
            /// We have to ensure the LCD controller pins are disabled so they can be reused
            /// </summary>
            internal static void LCDControllerPinReuse()
            {
                if (_lcdControllerConfig != null && _lcdControllerConfig.LCDControllerEnabled)
                {
                    DisplayError("ERROR: Cannot use LCD controller pins as IOs simultaneously with using them to drive a display");
                }

                Mainboard.SetLCDConfiguration(lcdPinsUsedAsIOs); // this will reboot if necessary
                if (_lcdControllerConfig == null)
                {
                    _lcdControllerConfig = lcdPinsUsedAsIOs;
                }
            }
            /// <summary>
            /// Called when a pin otherwise used for the LCD controller is reserved for another module
            /// We have to ensure the LCD controller pins are disabled so they can be reused
            /// </summary>
            internal static void LCDControllerPinReuse()
            {
                if (_lcdControllerConfig != null && _lcdControllerConfig.LCDControllerEnabled)
                {
                    DisplayError("ERROR: Cannot use LCD controller pins as IOs simultaneously with using them to drive a display");
                }

                if (_lcdConfigInUnknownState || LCDControllerEnabled)
                {
                    Mainboard.SetLCD(lcdPinsUsedAsIOs);
                    LCDControllerEnabled = false;
                    // need to explicitly reboot in case _lcdConfigInUnknownState
                    DisplayReboot();
                }
                if (_lcdControllerConfig == null)
                {
                    _lcdControllerConfig = lcdPinsUsedAsIOs;
                }
            }
            /// <summary>
            /// Sets the display configuration.  This must be called by all display module constructors (even ones not using LCD displays)
            /// </summary>
            /// <param name="displayConfig">The display configuration.</param>
            protected static void SetLCDConfig(Mainboard.LCDConfiguration displayConfig)
            {
                if (_numDisplaysConstructed != _numDisplaysConfigured + 1)
                {
                    DisplayError("ERROR IN DISPLAY MODULE DRIVER: All display module constructors must call DisplayModule.SetLCDConfig()");
                }

                if (displayConfig != Mainboard.LCDConfiguration.HeadlessConfig && (displayConfig.Height == 0 || displayConfig.Width == 0))
                {
                    DisplayError("ERROR IN DISPLAY MODULE DRIVER: LCDConfiguration must specify Height and Width of display");
                }
                _numDisplaysConfigured++;
                _displayModuleToBeConfigured._config = displayConfig;

                if (displayConfig.LCDControllerEnabled)
                {
                    if (_lcdControllerConfig != null)
                    {
                        if (_lcdControllerConfig == lcdPinsUsedAsIOs)
                        {
                            DisplayError("ERROR: Cannot use LCD controller pins as IOs and also use an LCD controller based display");
                        }
                        else
                        {
                            DisplayError("ERROR: Cannot use more than one LCD controller based display at a time");
                        }
                    }

                    _lcdControllerConfig = displayConfig;
                    Mainboard.SetLCD(displayConfig);
                    // this reboots if necessary
                    LCDControllerEnabled = true;
                    // known issue: this does not check all settings match (will be fixed in the NETMF 4.2 version)
                    if (SystemMetrics.ScreenWidth != displayConfig.Width || SystemMetrics.ScreenHeight != displayConfig.Height)
                    {
                        DisplayReboot();
                    }
                }
            }
Ejemplo n.º 7
0
            /// <summary>
            /// Sets the display configuration.  This must be called by all display module constructors (even ones not using LCD displays)
            /// </summary>
            /// <param name="displayConfig">The display configuration.</param>
            protected static void SetLCDConfig(Mainboard.LCDConfiguration displayConfig)
            {
                if (_numDisplaysConstructed != _numDisplaysConfigured + 1)
                {
                    DisplayError("ERROR IN DISPLAY MODULE DRIVER: All display module constructors must call DisplayModule.SetLCDConfig() once.");
                }

                if (displayConfig != Mainboard.LCDConfiguration.HeadlessConfig && (displayConfig.Height == 0 || displayConfig.Width == 0))
                {
                    DisplayError("ERROR IN DISPLAY MODULE DRIVER: LCDConfiguration must specify Height and Width of display");
                }
                _numDisplaysConfigured++;
                _displayModuleToBeConfigured._config = displayConfig;

                if (displayConfig.LCDControllerEnabled)
                {
                    if (_lcdControllerConfig != null)
                    {
                        if (_lcdControllerConfig == lcdPinsUsedAsIOs)
                        {
                            DisplayError("ERROR: Cannot use LCD controller pins as IOs and also use an LCD controller based display");
                        }
                        else
                        {
                            DisplayError("ERROR: Cannot use more than one LCD controller based display at a time");
                        }
                    }

                    _lcdControllerConfig = displayConfig;
                    Mainboard.SetLCDConfiguration(displayConfig);
                }
            }
Ejemplo n.º 8
0
            /// <summary>
            /// Called when a pin otherwise used for the LCD controller is reserved for another module
            /// We have to ensure the LCD controller pins are disabled so they can be reused
            /// </summary>
            internal static void LCDControllerPinReuse()
            {
                if (_lcdControllerConfig != null && _lcdControllerConfig.LCDControllerEnabled)
                {
                    DisplayError("ERROR: Cannot use LCD controller pins as IOs simultaneously with using them to drive a display");
                }

                Mainboard.SetLCDConfiguration(lcdPinsUsedAsIOs); // this will reboot if necessary
                if(_lcdControllerConfig == null)_lcdControllerConfig = lcdPinsUsedAsIOs;
            }
Ejemplo n.º 9
0
        /// <summary>
        /// Selects a resolution based on the passed in value, and sets the mainboard's display configuration and the proper registers
        /// for the module to match the mainboard's display configuration.
        /// </summary>
        /// <remarks>NOTE: Any time the mainboard display configuration is changed, the board will have to reset to apply the changes.
        /// If the same resolution is selected (320x240 RCA to 320x240 VGA) the board will not need to reset.</remarks>
        /// <param name="res">The desired output type and resolution.</param>
        public void SetDisplayConfiguration(VideoOut_InputResolution res)
        {
            Mainboard.LCDConfiguration lcdConfig = new Mainboard.LCDConfiguration();
            lcdConfig.LCDControllerEnabled = true;
            lcdConfig.PriorityEnable       = true;

            switch (res)
            {
                #region 320_240_RCA
            case VideoOut_InputResolution.Output_320x240_RCA:
            {
                lcdConfig.Width  = m_currWidth = 320;
                lcdConfig.Height = m_currHeight = 240;
                Write320x240RCARegisters();
                break;
            }

                #endregion
                #region 640_480_RCA
            case VideoOut_InputResolution.Output_640x480_RCA:
            {
                lcdConfig.Width  = m_currWidth = 640;
                lcdConfig.Height = m_currHeight = 480;
                Write640x480RCARegisters();
                break;
            }

                #endregion
                #region 800_600_RCA
            case VideoOut_InputResolution.Output_800x600_RCA:
            {
                lcdConfig.Width  = m_currWidth = 800;
                lcdConfig.Height = m_currHeight = 600;
                Write800x600RCARegisters();
                break;
            }

                #endregion
                #region 320_240_VGA
            case VideoOut_InputResolution.Output_320x240_VGA:
            {
                lcdConfig.Width  = m_currWidth = 320;
                lcdConfig.Height = m_currHeight = 240;
                Write320x240VGARegisters();
                break;
            }

                #endregion
                #region 640_480_VGA
            case VideoOut_InputResolution.Output_640x480_VGA:
            {
                lcdConfig.Width  = m_currWidth = 640;
                lcdConfig.Height = m_currHeight = 480;
                Write640x480VGARegisters();
                break;
            }

                #endregion
                #region 800_600_VGA
            case VideoOut_InputResolution.Output_800x600_VGA:
            {
                lcdConfig.Width  = m_currWidth = 800;
                lcdConfig.Height = m_currHeight = 600;
                Write800x600VGARegisters();
                break;
            }

                #endregion
            case VideoOut_InputResolution.Output_320x240_RCA_PAL:
            {
                lcdConfig.Width  = m_currWidth = 320;
                lcdConfig.Height = m_currHeight = 240;
                Write320x240VGAPALRegisters();
                break;
            }
            }

            lcdConfig.OutputEnableIsFixed      = false;
            lcdConfig.OutputEnablePolarity     = false;
            lcdConfig.HorizontalSyncPolarity   = true;
            lcdConfig.VerticalSyncPolarity     = true;
            lcdConfig.PixelPolarity            = false;
            lcdConfig.HorizontalSyncPulseWidth = 10;
            lcdConfig.HorizontalBackPorch      = 10;
            lcdConfig.HorizontalFrontPorch     = 10;
            lcdConfig.VerticalSyncPulseWidth   = 10;
            lcdConfig.VerticalBackPorch        = 10;
            lcdConfig.VerticalFrontPorch       = 10;

            // NOTE: This is used for EMX
            lcdConfig.PixelClockDivider = 8;

            // Set config
            DisplayModule.SetLCDConfig(lcdConfig);

            const int CH7025_DID = 0x55;
            const int CH7026_DID = 0x54;

            System.Threading.Thread.Sleep(1000);

            byte ud = I2CRead(0x00);
            if ((ud != CH7025_DID) && (ud != CH7026_DID))
            {
                throw new Exception();// 1; // CH7025/26B was not found
            }
        }
Ejemplo n.º 10
0
            /// <summary>
            /// Sets the display configuration.  This must be called by all display module constructors (even ones not using LCD displays)
            /// </summary>
            /// <param name="displayConfig">The display configuration.</param>
            protected static void SetLCDConfig(Mainboard.LCDConfiguration displayConfig)
            {
                if (_numDisplaysConstructed != _numDisplaysConfigured + 1)
                {
                    DisplayError("ERROR IN DISPLAY MODULE DRIVER: All display module constructors must call DisplayModule.SetLCDConfig()");
                }

                if (displayConfig != Mainboard.LCDConfiguration.HeadlessConfig && (displayConfig.Height == 0 || displayConfig.Width == 0))
                {
                    DisplayError("ERROR IN DISPLAY MODULE DRIVER: LCDConfiguration must specify Height and Width of display");
                }
                _numDisplaysConfigured++;
                _displayModuleToBeConfigured._config = displayConfig;

                if (displayConfig.LCDControllerEnabled)
                {
                    if (_lcdControllerConfig != null)
                    {
                        if (_lcdControllerConfig == lcdPinsUsedAsIOs)
                        {
                            DisplayError("ERROR: Cannot use LCD controller pins as IOs and also use an LCD controller based display");
                        }
                        else
                        {
                            DisplayError("ERROR: Cannot use more than one LCD controller based display at a time");
                        }
                    }

                    _lcdControllerConfig = displayConfig;
                    Mainboard.SetLCD(displayConfig);
                    // this reboots if necessary
                    LCDControllerEnabled = true;
                    // known issue: this does not check all settings match (will be fixed in the NETMF 4.2 version)
                    if (SystemMetrics.ScreenWidth != displayConfig.Width || SystemMetrics.ScreenHeight != displayConfig.Height) DisplayReboot();
                }
            }
Ejemplo n.º 11
0
            /// <summary>
            /// Called when a pin otherwise used for the LCD controller is reserved for another module
            /// We have to ensure the LCD controller pins are disabled so they can be reused
            /// </summary>
            internal static void LCDControllerPinReuse()
            {
                if (_lcdControllerConfig != null && _lcdControllerConfig.LCDControllerEnabled)
                {
                    DisplayError("ERROR: Cannot use LCD controller pins as IOs simultaneously with using them to drive a display");
                }

                if (_lcdConfigInUnknownState || LCDControllerEnabled)
                {
                    Mainboard.SetLCD(lcdPinsUsedAsIOs);
                    LCDControllerEnabled = false;
                    // need to explicitly reboot in case _lcdConfigInUnknownState
                     DisplayReboot();
                }
                if(_lcdControllerConfig == null) _lcdControllerConfig = lcdPinsUsedAsIOs;
            }
Ejemplo n.º 12
0
        private void ConfigureDisplay()
        {
            Mainboard.LCDConfiguration lcdConfig = new Mainboard.LCDConfiguration();
            lcdConfig.LCDControllerEnabled = false;
            lcdConfig.Width  = Width;
            lcdConfig.Height = Height;
            DisplayModule.SetLCDConfig(lcdConfig);


            #region N22
            WriteCommand(0xCB);
            WriteData(0x39);
            WriteData(0x2C);
            WriteData(0x00);
            WriteData(0x34);
            WriteData(0x02);

            WriteCommand(0xCF);
            WriteData(0x00);
            WriteData(0XC1);
            WriteData(0X30);

            WriteCommand(0xE8);
            WriteData(0x85);
            WriteData(0x00);
            WriteData(0x78);

            WriteCommand(0xEA);
            WriteData(0x00);
            WriteData(0x00);

            WriteCommand(0xED);
            WriteData(0x64);
            WriteData(0x03);
            WriteData(0X12);
            WriteData(0X81);

            WriteCommand(0xF7);
            WriteData(0x20);

            WriteCommand(0xC0); //Power control
            WriteData(0x23);    //VRH[5:0]

            WriteCommand(0xC1); //Power control
            WriteData(0x10);    //SAP[2:0];BT[3:0]

            WriteCommand(0xC5); //VCM control
            WriteData(0x3e);    //Contrast
            WriteData(0x28);

            WriteCommand(0xC7); //VCM control2
            WriteData(0x86);    //--

            WriteCommand(0x36); // Memory Access Control
            WriteData(0x48);

            WriteCommand(0x3A);
            WriteData(0x55);

            WriteCommand(0xB1);
            WriteData(0x00);
            WriteData(0x18);

            WriteCommand(0xB6);    // Display Function Control
            WriteData(0x08);
            WriteData(0x82);
            WriteData(0x27);

            /*
             *  WriteCommand(0xF2);    // 3Gamma Function Disable
             *  WriteData(0x00);
             *
             *  WriteCommand(0x26);    //Gamma curve selected
             *  WriteData(0x01);
             *
             *  WriteCommand(0xE0);    //Set Gamma
             *  WriteData(0x0F);
             *  WriteData(0x31);
             *  WriteData(0x2B);
             *  WriteData(0x0C);
             *  WriteData(0x0E);
             *  WriteData(0x08);
             *  WriteData(0x4E);
             *  WriteData(0xF1);
             *  WriteData(0x37);
             *  WriteData(0x07);
             *  WriteData(0x10);
             *  WriteData(0x03);
             *  WriteData(0x0E);
             *  WriteData(0x09);
             *  WriteData(0x00);
             *
             *  WriteCommand(0XE1);    //Set Gamma
             *  WriteData(0x00);
             *  WriteData(0x0E);
             *  WriteData(0x14);
             *  WriteData(0x03);
             *  WriteData(0x11);
             *  WriteData(0x07);
             *  WriteData(0x31);
             *  WriteData(0xC1);
             *  WriteData(0x48);
             *  WriteData(0x08);
             *  WriteData(0x0F);
             *  WriteData(0x0C);
             *  WriteData(0x31);
             *  WriteData(0x36);
             *  WriteData(0x0F);
             */
            WriteCommand(0x11);    //Exit Sleep
            Thread.Sleep(120);

            WriteCommand(0x29);    //Display on
            WriteCommand(0x2c);
            #endregion

            return;

            #region N18
            WriteCommand(0x11); //Sleep exit
            Thread.Sleep(120);

            //ST7735R Frame Rates
            WriteCommand(0xB1);
            WriteData(0x01); WriteData(0x2C); WriteData(0x2D);
            WriteCommand(0xB2);
            WriteData(0x01); WriteData(0x2C); WriteData(0x2D);
            WriteCommand(0xB3);
            WriteData(0x01); WriteData(0x2C); WriteData(0x2D);
            WriteData(0x01); WriteData(0x2C); WriteData(0x2D);

            WriteCommand(0xB4); //Column inversion
            WriteData(0x07);

            //ST7735R Power Sequence
            WriteCommand(0xC0);
            WriteData(0xA2); WriteData(0x02); WriteData(0x84);
            WriteCommand(0xC1); WriteData(0xC5);
            WriteCommand(0xC2);
            WriteData(0x0A); WriteData(0x00);
            WriteCommand(0xC3);
            WriteData(0x8A); WriteData(0x2A);
            WriteCommand(0xC4);
            WriteData(0x8A); WriteData(0xEE);

            WriteCommand(0xC5); //VCOM
            WriteData(0x0E);

            WriteCommand(0x36); //MX, MY, RGB mode
            WriteData(0xC8);

            //ST7735R Gamma Sequence
            WriteCommand(0xe0);
            WriteData(0x0f); WriteData(0x1a);
            WriteData(0x0f); WriteData(0x18);
            WriteData(0x2f); WriteData(0x28);
            WriteData(0x20); WriteData(0x22);
            WriteData(0x1f); WriteData(0x1b);
            WriteData(0x23); WriteData(0x37); WriteData(0x00);

            WriteData(0x07);
            WriteData(0x02); WriteData(0x10);
            WriteCommand(0xe1);
            WriteData(0x0f); WriteData(0x1b);
            WriteData(0x0f); WriteData(0x17);
            WriteData(0x33); WriteData(0x2c);
            WriteData(0x29); WriteData(0x2e);
            WriteData(0x30); WriteData(0x30);
            WriteData(0x39); WriteData(0x3f);
            WriteData(0x00); WriteData(0x07);
            WriteData(0x03); WriteData(0x10);

            WriteCommand(0x2a);
            WriteData(0x00); WriteData(0x00);
            WriteData(0x00); WriteData(0x7f);
            WriteCommand(0x2b);
            WriteData(0x00); WriteData(0x00);
            WriteData(0x00); WriteData(0x9f);

            WriteCommand(0xF0); //Enable test command
            WriteData(0x01);
            WriteCommand(0xF6); //Disable ram power save mode
            WriteData(0x00);

            WriteCommand(0x3A); //65k mode
            WriteData(0x05);

            WriteCommand(0x29);//Display on
            #endregion
        }
Ejemplo n.º 13
0
        private void ConfigureDisplay()
        {
            Mainboard.LCDConfiguration lcdConfig = new Mainboard.LCDConfiguration();
            lcdConfig.LCDControllerEnabled = false;
            lcdConfig.Width  = Width;
            lcdConfig.Height = Height;
            DisplayModule.SetLCDConfig(lcdConfig);

            WriteCommand(0xCB);
            WriteData(0x39);
            WriteData(0x2C);
            WriteData(0x00);
            WriteData(0x34);
            WriteData(0x02);

            WriteCommand(0xCF);
            WriteData(0x00);
            WriteData(0XC1);
            WriteData(0X30);

            WriteCommand(0xE8);
            WriteData(0x85);
            WriteData(0x00);
            WriteData(0x78);

            WriteCommand(0xEA);
            WriteData(0x00);
            WriteData(0x00);

            WriteCommand(0xED);
            WriteData(0x64);
            WriteData(0x03);
            WriteData(0X12);
            WriteData(0X81);

            WriteCommand(0xF7);
            WriteData(0x20);

            WriteCommand(0xC0); //Power control
            WriteData(0x23);    //VRH[5:0]

            WriteCommand(0xC1); //Power control
            WriteData(0x10);    //SAP[2:0];BT[3:0]

            WriteCommand(0xC5); //VCM control
            WriteData(0x3e);    //Contrast
            WriteData(0x28);

            WriteCommand(0xC7); //VCM control2
            WriteData(0x86);    //--

            WriteCommand(0x36); // Memory Access Control
            WriteData(0x48);

            WriteCommand(0x3A);
            WriteData(0x55);

            WriteCommand(0xB1);
            WriteData(0x00);
            WriteData(0x18);

            WriteCommand(0xB6);    // Display Function Control
            WriteData(0x08);
            WriteData(0x82);
            WriteData(0x27);

            /*
             * WriteCommand(0xF2);    // 3Gamma Function Disable
             * WriteData(0x00);
             *
             * WriteCommand(0x26);    //Gamma curve selected
             * WriteData(0x01);
             *
             * WriteCommand(0xE0);    //Set Gamma
             * WriteData(0x0F);
             * WriteData(0x31);
             * WriteData(0x2B);
             * WriteData(0x0C);
             * WriteData(0x0E);
             * WriteData(0x08);
             * WriteData(0x4E);
             * WriteData(0xF1);
             * WriteData(0x37);
             * WriteData(0x07);
             * WriteData(0x10);
             * WriteData(0x03);
             * WriteData(0x0E);
             * WriteData(0x09);
             * WriteData(0x00);
             *
             * WriteCommand(0XE1);    //Set Gamma
             * WriteData(0x00);
             * WriteData(0x0E);
             * WriteData(0x14);
             * WriteData(0x03);
             * WriteData(0x11);
             * WriteData(0x07);
             * WriteData(0x31);
             * WriteData(0xC1);
             * WriteData(0x48);
             * WriteData(0x08);
             * WriteData(0x0F);
             * WriteData(0x0C);
             * WriteData(0x31);
             * WriteData(0x36);
             * WriteData(0x0F);
             */

            WriteCommand(0x11);    //Exit Sleep
            Thread.Sleep(120);

            //WriteCommand(0x28);    //Display off
            WriteCommand(0x29);    //Display on
            WriteCommand(0x2c);

            //WriteCommand(0x21);     // Display inversion ON
            //WriteCommand(0x20);     // Display inversion OFF

            //WriteCommand(0x39);     // Idle mode on
            //WriteCommand(0x38);     // Idle mode off

            WriteCommand(0x51);     // brightness
            WriteData(0x88);        //0x00...0xFF
        }
Ejemplo n.º 14
0
        private void ConfigureDisplay()
        {
            Mainboard.LCDConfiguration lcdConfig = new Mainboard.LCDConfiguration();

            lcdConfig.LCDControllerEnabled = false;
            lcdConfig.Width  = Width;
            lcdConfig.Height = Height;

            DisplayModule.SetLCDConfig(lcdConfig);

            this.WriteCommand(0x11);            //Sleep exit
            Thread.Sleep(120);

            //ST7735R Frame Rate
            this.WriteCommand(0xB1);
            this.WriteData(0x01); this.WriteData(0x2C); this.WriteData(0x2D);
            this.WriteCommand(0xB2);
            this.WriteData(0x01); this.WriteData(0x2C); this.WriteData(0x2D);
            this.WriteCommand(0xB3);
            this.WriteData(0x01); this.WriteData(0x2C); this.WriteData(0x2D);
            this.WriteData(0x01); this.WriteData(0x2C); this.WriteData(0x2D);

            this.WriteCommand(0xB4); //Column inversion
            this.WriteData(0x07);

            //ST7735R Power Sequence
            this.WriteCommand(0xC0);
            this.WriteData(0xA2); this.WriteData(0x02); this.WriteData(0x84);
            this.WriteCommand(0xC1); this.WriteData(0xC5);
            this.WriteCommand(0xC2);
            this.WriteData(0x0A); this.WriteData(0x00);
            this.WriteCommand(0xC3);
            this.WriteData(0x8A); this.WriteData(0x2A);
            this.WriteCommand(0xC4);
            this.WriteData(0x8A); this.WriteData(0xEE);

            this.WriteCommand(0xC5); //VCOM
            this.WriteData(0x0E);

            this.WriteCommand(0x36); //MX, MY, RGB mode
            this.WriteData(0xC8);

            //ST7735R Gamma Sequence
            this.WriteCommand(0xe0);
            this.WriteData(0x0f); this.WriteData(0x1a);
            this.WriteData(0x0f); this.WriteData(0x18);
            this.WriteData(0x2f); this.WriteData(0x28);
            this.WriteData(0x20); this.WriteData(0x22);
            this.WriteData(0x1f); this.WriteData(0x1b);
            this.WriteData(0x23); this.WriteData(0x37); this.WriteData(0x00);

            this.WriteData(0x07);
            this.WriteData(0x02); this.WriteData(0x10);
            this.WriteCommand(0xe1);
            this.WriteData(0x0f); this.WriteData(0x1b);
            this.WriteData(0x0f); this.WriteData(0x17);
            this.WriteData(0x33); this.WriteData(0x2c);
            this.WriteData(0x29); this.WriteData(0x2e);
            this.WriteData(0x30); this.WriteData(0x30);
            this.WriteData(0x39); this.WriteData(0x3f);
            this.WriteData(0x00); this.WriteData(0x07);
            this.WriteData(0x03); this.WriteData(0x10);

            this.WriteCommand(0x2a);
            this.WriteData(0x00); this.WriteData(0x00);
            this.WriteData(0x00); this.WriteData(0x7f);
            this.WriteCommand(0x2b);
            this.WriteData(0x00); this.WriteData(0x00);
            this.WriteData(0x00); this.WriteData(0x9f);

            this.WriteCommand(0xF0); //Enable test command
            this.WriteData(0x01);
            this.WriteCommand(0xF6); //Disable ram power save mode
            this.WriteData(0x00);

            this.WriteCommand(0x3A); //65k mode
            this.WriteData(0x05);

            this.WriteCommand(0x29);            //Display on
        }