lcd driver
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
/*****************************************************************************/ // Description: Set the brightness of LCD. // Global resource dependence: // Author: Jim.zhang // Note: /*****************************************************************************/ #ifdef LCD_DATA_WIDTH_8BIT LOCAL void ILI9301_InvalidatePixel(uint16 x, uint16 y, uint32 data) { ILI9301_InvalidateRect(x,y,x,y); LCD_DataWrite_ILI9301(data); } #endif LOCAL ERR_LCD_E ILI9301_SetBrightness( uint16 brightness //birghtness to set ) { return ERR_LCD_FUNC_NOT_SUPPORT; } /*****************************************************************************/ // Description: Enable lcd to partial display mode, so can save power. // Global resource dependence: // Author: Jim.zhang // Return: SCI_TRUE:SUCCESS ,SCI_FALSE:failed. // Note: If all input parameters are 0, exit partial display mode. /*****************************************************************************/ LOCAL ERR_LCD_E ILI9301_SetDisplayWindow( uint16 left, //left of the window uint16 top, //top of the window uint16 right, //right of the window uint16 bottom //bottom of the window ) { ILI9301_set_display_window(left, top, right, bottom); return ERR_LCD_NONE; } /******************************************************************************/ // Description: Read lcm id // Global resource dependence: // Author: // Note: CMD: R(0xD3) // DATA:DUMMY(Byte)+DUMMY(Byte)+0x93+0x42 /******************************************************************************/ LOCAL uint32 ILI9301_ReadID(uint16 lcd_cs, uint16 lcd_cd, uint16 lcd_id) { uint32 lcm_id0=0,lcm_id1=0,dummy=0; LCD_CtrlWrite_ILI9301(0x00); { // Get:XX XX 93 41 dummy = LCD_DataRead_ILI9301() & 0xFF; dummy = LCD_DataRead_ILI9301() & 0xFF; lcm_id0 = LCD_DataRead_ILI9301() & 0xFF; lcm_id1 = LCD_DataRead_ILI9301() & 0xFF; SCI_TRACE_LOW("ILI9301_ReadID = 0x%x, 0x%x", lcm_id0, lcm_id1); return ((lcm_id0<<8)|(lcm_id1)); } } /******************************************************************************/ // Description: Close the lcd.(include sub lcd.) // Global resource dependence: // Author: Jim.zhang // Note: /******************************************************************************/ const LCD_OPERATIONS_T ILI9301_operations = { ILI9301_Init, ILI9301_EnterSleep, ILI9301_SetContrast, ILI9301_SetBrightness, ILI9301_SetDisplayWindow, ILI9301_InvalidateRect, ILI9301_Invalidate, ILI9301_Close, ILI9301_RotationInvalidateRect, ILI9301_SetDirection, NULL, ILI9301_ReadID }; /******************************************************************************/ // Description: return the ILI9301 lcd driver funtion pointer // Global resource dependence: // Author: Jim.zhang // Note: /******************************************************************************/ PUBLIC LCD_OPERATIONS_T* ILI9301_GetOperations(void) { //SCI_TRACE_LOW:"qinss LCD: in ILI9301_GetOperations" //SCI_TRACE_ID(TRACE_TOOL_CONVERT,TFT_ILI9301_581_112_2_18_0_33_54_1823,(uint8*)""); return (LCD_OPERATIONS_T*)&ILI9301_operations; } PUBLIC BOOLEAN ILI9301_Probe(void) { return SCI_TRUE; } LOCAL const LCD_TIMING_U s_ILI9301_timing = { // LCM_CYCLE_U start(ns) 15, // CS setup time for LCM read (optional) 120, // low pulse width for LCM read (according spec) 75, // high pulse width for LCM read (according spec) 15, // CS setup time for LCM write (optional) 35,//40, // low pulse width for LCM write (according spec) 35,//25, // high pulse width for LCM write (according spec) // LCM_CYCLE_U end(ns) }; const LCD_SPEC_T g_lcd_ILI9301 = { ILI9301_LCD_WIDTH, ILI9301_LCD_HEIGHT, LCD_MCU, BUS_MODE_8080, WIDTH_8, (LCD_TIMING_U*)&s_ILI9301_timing, (LCD_OPERATIONS_T*)&ILI9301_operations, 0, 0 }; /**---------------------------------------------------------------------------* ** Compiler Flag * **---------------------------------------------------------------------------*/ #ifdef __cplusplus } #endif |