lcdc.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef LCD_GENERAL_H_INCLUDED
  2. #define LCD_GENERAL_H_INCLUDED
  3. #include <rtgui/rtgui.h>
  4. #include <rtgui/driver.h>
  5. #include <rtgui/rtgui_server.h>
  6. #include <rtgui/rtgui_system.h>
  7. #define LCDWIDTH 320
  8. #define LCDHEIGHT 240
  9. //Macro for SIZE register setting
  10. #define XMAX ((LCDWIDTH/16) << 20)
  11. #define YMAX (LCDHEIGHT)
  12. //Macro for PCR register setting
  13. #define TFT ((U32)1 << 31)
  14. #define COLOR (1 << 30) //1为色彩.
  15. #define PBSIZE (0 << 28)
  16. #define BPIX (4 << 25) //存储器中一个像素对应16bit
  17. #define PIXPOL (0 << 24) //像素极性—设置像素的极性,高有效 //0<<24
  18. #define FLMPOL (1 << 23) //首行标志极性—设置首行标志的极性,低有效.
  19. #define LPPOL (1 << 22) //行脉冲极性—设置行脉冲信号的极性,低有效.
  20. #define CLKPOL (0 << 21) //LCD 移位时钟极性—设置LCD 移位时钟的有效沿的极性,下降延有效.
  21. #define OEPOL (1 << 20) //输出使能极性—设置输出使能信号的极性,高有效.
  22. #define END_SEL (0 << 18) //印第安格式选择,小印第安.
  23. #define ACD_SEL (0 << 15) //ACD时钟源选择—选择晶向变换计数器的时钟,使用FLM 作为ACD 计数时钟
  24. #define ACD (0 << 8 ) //被动模式.
  25. #define PCD (10)
  26. //Macro for HCR regiter setting //水平配置寄存器.
  27. #define H_WIDTH ((U32)46 << 26)
  28. #define H_WAIT_1 (20 << 8)
  29. #define H_WAIT_2 (20)
  30. //Macro for VCR register setting //垂直配置寄存器.
  31. #define V_WIDTH ((U32)10 << 26)
  32. #define PASS_FRAME_WAIT (0 <<16)
  33. #define V_WAIT_1 (3 << 8)
  34. #define V_WAIT_2 (3)
  35. //Macro for LGPR register setting
  36. #define GRAY (4) //灰度等级.
  37. //Macro for PWMR register setting
  38. #define SCR (0 << 9) //时钟源选择.行脉冲.
  39. #define CC_EN (0 << 8) //对比度控制使能,关.
  40. #define PW (64) //输出脉冲数目,
  41. //Macro for DMACR register setting
  42. #define BL ((U32)1 << 31) //固定长度.
  43. #define HM (7 << 16)
  44. #define TM (3)
  45. void lcd_set_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y);
  46. void lcd_get_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y);
  47. void lcd_draw_hline(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_t y) ;
  48. void lcd_draw_vline(rtgui_color_t *c, rt_base_t x, rt_base_t y1, rt_base_t y2) ;
  49. void lcd_draw_raw_hline(rt_uint8_t *pixels, rt_base_t x1, rt_base_t x2, rt_base_t y) ;
  50. void lcd_update(rtgui_rect_t *rect);
  51. rt_uint8_t * lcd_get_framebuffer(void);
  52. rt_err_t sep4020_lcd_init(void);
  53. #endif