lcdc.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * File : lcdc.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2009 - 2012, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. */
  13. #ifndef LCD_GENERAL_H_INCLUDED
  14. #define LCD_GENERAL_H_INCLUDED
  15. #include <rtgui/rtgui.h>
  16. #include <rtgui/driver.h>
  17. #include <rtgui/rtgui_server.h>
  18. #include <rtgui/rtgui_system.h>
  19. #define LCDWIDTH 320
  20. #define LCDHEIGHT 240
  21. //Macro for SIZE register setting
  22. #define XMAX ((LCDWIDTH/16) << 20)
  23. #define YMAX (LCDHEIGHT)
  24. //Macro for PCR register setting
  25. #define TFT ((U32)1 << 31)
  26. #define COLOR (1 << 30) //1为色彩.
  27. #define PBSIZE (0 << 28)
  28. #define BPIX (4 << 25) //存储器中一个像素对应16bit
  29. #define PIXPOL (0 << 24) //像素极性—设置像素的极性,高有效 //0<<24
  30. #define FLMPOL (1 << 23) //首行标志极性—设置首行标志的极性,低有效.
  31. #define LPPOL (1 << 22) //行脉冲极性—设置行脉冲信号的极性,低有效.
  32. #define CLKPOL (0 << 21) //LCD 移位时钟极性—设置LCD 移位时钟的有效沿的极性,下降延有效.
  33. #define OEPOL (1 << 20) //输出使能极性—设置输出使能信号的极性,高有效.
  34. #define END_SEL (0 << 18) //印第安格式选择,小印第安.
  35. #define ACD_SEL (0 << 15) //ACD时钟源选择—选择晶向变换计数器的时钟,使用FLM 作为ACD 计数时钟
  36. #define ACD (0 << 8 ) //被动模式.
  37. #define PCD (10)
  38. //Macro for HCR regiter setting //水平配置寄存器.
  39. #define H_WIDTH ((U32)46 << 26)
  40. #define H_WAIT_1 (20 << 8)
  41. #define H_WAIT_2 (20)
  42. //Macro for VCR register setting //垂直配置寄存器.
  43. #define V_WIDTH ((U32)10 << 26)
  44. #define PASS_FRAME_WAIT (0 <<16)
  45. #define V_WAIT_1 (3 << 8)
  46. #define V_WAIT_2 (3)
  47. //Macro for LGPR register setting
  48. #define GRAY (4) //灰度等级.
  49. //Macro for PWMR register setting
  50. #define SCR (0 << 9) //时钟源选择.行脉冲.
  51. #define CC_EN (0 << 8) //对比度控制使能,关.
  52. #define PW (64) //输出脉冲数目,
  53. //Macro for DMACR register setting
  54. #define BL ((U32)1 << 31) //固定长度.
  55. #define HM (7 << 16)
  56. #define TM (3)
  57. void lcd_set_pixel(rtgui_color_t *c, int x, int y);
  58. void lcd_get_pixel(rtgui_color_t *c, int x, int y);
  59. void lcd_draw_hline(rtgui_color_t *c, int x1, int x2, int y) ;
  60. void lcd_draw_vline(rtgui_color_t *c, int x, int y1, int y2) ;
  61. void lcd_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y) ;
  62. void lcd_update(rtgui_rect_t *rect);
  63. rt_uint8_t * lcd_get_framebuffer(void);
  64. rt_err_t sep4020_lcd_init(void);
  65. #endif