PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

initlcd.h 3.1KB

3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. case ILI9325C:
  2. LCD_Write_COM_DATA(0xE5, 0x78F0); // set SRAM internal timing
  3. LCD_Write_COM_DATA(0x01, 0x0100); // set Driver Output Control
  4. LCD_Write_COM_DATA(0x02, 0x0700); // set 1 line inversion
  5. LCD_Write_COM_DATA(0x03, 0x1030); // set GRAM write direction and BGR=1.
  6. LCD_Write_COM_DATA(0x04, 0x0000); // Resize register
  7. LCD_Write_COM_DATA(0x08, 0x0207); // set the back porch and front porch
  8. LCD_Write_COM_DATA(0x09, 0x0000); // set non-display area refresh cycle ISC[3:0]
  9. LCD_Write_COM_DATA(0x0A, 0x0000); // FMARK function
  10. LCD_Write_COM_DATA(0x0C, 0x0000); // RGB interface setting
  11. LCD_Write_COM_DATA(0x0D, 0x0000); // Frame marker Position
  12. LCD_Write_COM_DATA(0x0F, 0x0000); // RGB interface polarity
  13. //*************Power On sequence ****************//
  14. LCD_Write_COM_DATA(0x10, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB
  15. LCD_Write_COM_DATA(0x11, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0]
  16. LCD_Write_COM_DATA(0x12, 0x0000); // VREG1OUT voltage
  17. LCD_Write_COM_DATA(0x13, 0x0000); // VDV[4:0] for VCOM amplitude
  18. LCD_Write_COM_DATA(0x07, 0x0001);
  19. delay(200); // Dis-charge capacitor power voltage
  20. LCD_Write_COM_DATA(0x10, 0x1090); // SAP, BT[3:0], AP, DSTB, SLP, STB
  21. LCD_Write_COM_DATA(0x11, 0x0227); // Set DC1[2:0], DC0[2:0], VC[2:0]
  22. delay(50); // Delay 50ms
  23. LCD_Write_COM_DATA(0x12, 0x001F); // 0012
  24. delay(50); // Delay 50ms
  25. LCD_Write_COM_DATA(0x13, 0x1500); // VDV[4:0] for VCOM amplitude
  26. LCD_Write_COM_DATA(0x29, 0x0027); // 04 VCM[5:0] for VCOMH
  27. LCD_Write_COM_DATA(0x2B, 0x000D); // Set Frame Rate
  28. delay(50); // Delay 50ms
  29. LCD_Write_COM_DATA(0x20, 0x0000); // GRAM horizontal Address
  30. LCD_Write_COM_DATA(0x21, 0x0000); // GRAM Vertical Address
  31. // ----------- Adjust the Gamma Curve ----------//
  32. LCD_Write_COM_DATA(0x30, 0x0000);
  33. LCD_Write_COM_DATA(0x31, 0x0707);
  34. LCD_Write_COM_DATA(0x32, 0x0307);
  35. LCD_Write_COM_DATA(0x35, 0x0200);
  36. LCD_Write_COM_DATA(0x36, 0x0008);
  37. LCD_Write_COM_DATA(0x37, 0x0004);
  38. LCD_Write_COM_DATA(0x38, 0x0000);
  39. LCD_Write_COM_DATA(0x39, 0x0707);
  40. LCD_Write_COM_DATA(0x3C, 0x0002);
  41. LCD_Write_COM_DATA(0x3D, 0x1D04);
  42. //------------------ Set GRAM area ---------------//
  43. LCD_Write_COM_DATA(0x50, 0x0000); // Horizontal GRAM Start Address
  44. LCD_Write_COM_DATA(0x51, 0x00EF); // Horizontal GRAM End Address
  45. LCD_Write_COM_DATA(0x52, 0x0000); // Vertical GRAM Start Address
  46. LCD_Write_COM_DATA(0x53, 0x013F); // Vertical GRAM Start Address
  47. LCD_Write_COM_DATA(0x60, 0xA700); // Gate Scan Line
  48. LCD_Write_COM_DATA(0x61, 0x0001); // NDL,VLE, REV
  49. LCD_Write_COM_DATA(0x6A, 0x0000); // set scrolling line
  50. //-------------- Partial Display Control ---------//
  51. LCD_Write_COM_DATA(0x80, 0x0000);
  52. LCD_Write_COM_DATA(0x81, 0x0000);
  53. LCD_Write_COM_DATA(0x82, 0x0000);
  54. LCD_Write_COM_DATA(0x83, 0x0000);
  55. LCD_Write_COM_DATA(0x84, 0x0000);
  56. LCD_Write_COM_DATA(0x85, 0x0000);
  57. //-------------- Panel Control -------------------//
  58. LCD_Write_COM_DATA(0x90, 0x0010);
  59. LCD_Write_COM_DATA(0x92, 0x0600);
  60. LCD_Write_COM_DATA(0x07, 0x0133); // 262K color and display ON
  61. break;