/************************************************************************ * Function: void GfxTconInit(void) * * Overview: Initialize the IOs to implement Bitbanged SPI interface * to connect to the Timing Controller through SPI. * * Input: none * * Output: none * ************************************************************************/ void GfxTconInit(void) { InitBitBangedIO(); GfxTconWriteCommand(0x0028, 0x0006); GfxTconWriteCommand(0x0000, 0x0001); DelayMs(15); GfxTconWriteCommand(0x002B, 0x9532); GfxTconWriteCommand(0x0003, 0xAAAC); GfxTconWriteCommand(0x000C, 0x0002); GfxTconWriteCommand(0x000D, 0x000A); GfxTconWriteCommand(0x000E, 0x2C00); GfxTconWriteCommand(0x001E, 0x00AA); GfxTconWriteCommand(0x0025, 0x8000); DelayMs(15); GfxTconWriteCommand(0x0001, 0x2B3F); GfxTconWriteCommand(0x0002, 0x0600); GfxTconWriteCommand(0x0010, 0x0000); DelayMs(20); GfxTconWriteCommand(0x0005, 0x0000); GfxTconWriteCommand(0x0006, 0x0000); GfxTconWriteCommand(0x0016, 0xEF1C); GfxTconWriteCommand(0x0017, 0x0003); GfxTconWriteCommand(0x0007, 0x0233); GfxTconWriteCommand(0x000B, 0x5312); GfxTconWriteCommand(0x000F, 0x0000); DelayMs(20); GfxTconWriteCommand(0x0041, 0x0000); GfxTconWriteCommand(0x0042, 0x0000); GfxTconWriteCommand(0x0048, 0x0000); GfxTconWriteCommand(0x0049, 0x013F); GfxTconWriteCommand(0x0044, 0xEF00); GfxTconWriteCommand(0x0045, 0x0000); GfxTconWriteCommand(0x0046, 0x013F); GfxTconWriteCommand(0x004A, 0x0000); GfxTconWriteCommand(0x004B, 0x0000); DelayMs(20); GfxTconWriteCommand(0x0030, 0x0707); GfxTconWriteCommand(0x0031, 0x0704); GfxTconWriteCommand(0x0032, 0x0204); GfxTconWriteCommand(0x0033, 0x0201); GfxTconWriteCommand(0x0034, 0x0203); GfxTconWriteCommand(0x0035, 0x0204); GfxTconWriteCommand(0x0036, 0x0204); GfxTconWriteCommand(0x0037, 0x0502); GfxTconWriteCommand(0x003A, 0x0302); GfxTconWriteCommand(0x003B, 0x0500); DelayMs(20); TCON_CLKLow(); }
/************************************************************************ * Function: void GfxTconSetIO(BYTE mask, BYTE level) * * Overview: This sets the IO specified by mask to the value set by * level. * * Input: mask - specifies the IO to be toggles. * level - specifies the logic where the IO will be set. * * Output: none * ************************************************************************/ void GfxTconSetIO(BYTE mask, BYTE level) { #if defined (GFX_USE_DISPLAY_CONTROLLER_MCHP_DA210) || defined (GFX_USE_DISPLAY_CONTROLLER_DMA) switch(mask) { case BB_CS: (level == 1 ? TCON_CSHigh() : TCON_CSLow()); break; case BB_SCL: (level == 1 ? TCON_CLKHigh() : TCON_CLKLow()); break; case BB_SDO: (level == 1 ? TCON_DataHigh() : TCON_DataLow()); break; case BB_DC: (level == 1 ? TCON_SetData() : TCON_SetCommand()); break; default: break; } Nop(); #elif defined (GFX_USE_DISPLAY_CONTROLLER_SSD1926) static BYTE value = 0xFF; if(level == 0) { value &= ~mask; } else { value |= mask; } SetCtrlBitBangedIO(0xAC, value); #endif }
/************************************************************************ * Function: void GfxTconSetIO(BYTE mask, BYTE level) * * Overview: This sets the IO specified by mask to the value set by * level. * * Input: mask - specifies the IO to be toggles. * level - specifies the logic where the IO will be set. * * Output: none * ************************************************************************/ void GfxTconSetIO(BYTE mask, BYTE level) { #if defined (GFX_USE_DISPLAY_CONTROLLER_MCHP_DA210) || defined (GFX_USE_DISPLAY_CONTROLLER_DMA) switch(mask) { case BB_CS: (level == 1 ? TCON_CSHigh() : TCON_CSLow()); break; case BB_SCL: (level == 1 ? TCON_CLKHigh() : TCON_CLKLow()); break; case BB_SDO: (level == 1 ? TCON_DataHigh() : TCON_DataLow()); break; case BB_DC: (level == 1 ? TCON_SetData() : TCON_SetCommand()); break; default: break; } Nop(); #elif defined (GFX_USE_DISPLAY_CONTROLLER_SSD1926) static BYTE value = 0xFF; if(level == 0) { value &= ~mask; } else { value |= mask; } SetCtrlBitBangedIO(0xAC, value); #elif defined (GFX_USE_DISPLAY_CONTROLLER_S1D13517) static BYTE temp = 0; switch(mask) { case BB_CS: temp = GetReg(REG6E_GPO_1); if(level == 1) temp |= 0x02; else temp &= 0xFD; SetReg(REG6E_GPO_1,temp); break; case BB_SCL: TCON_SCL_PORT = level; break; case BB_SDO: TCON_SDO_PORT = level; break; case BB_DC: temp = GetReg(REG6E_GPO_1); if(level == 1) temp |= 0x04; else temp &= 0xFB; SetReg(REG6E_GPO_1,temp); break; } Nop(); #else #error "This TCON_SSD1289 is written for SSD1926, S1D13517 and Microchip Graphics Module driver. If you are not using those drivers you may need to re-write this driver and remove this error message." #endif }