2 * display.h - header file for the display handling
4 * author: hackbard@hackdaworld.org
15 #define DISPLAY_BANK1 0x81000000
17 #define DISPLAY_CMD (*((volatile u8 *)DISPLAY_BANK1))
18 #define DISPLAY_DATA (*((volatile u8 *)DISPLAY_BANK1+1))
20 #define DISPLAY_DIMX 128
21 #define DISPLAY_DIMY 160
22 #define DISPLAY_PAGE_MAX (DISPLAY_DIMY/8)
23 #define DISPLAY_COL_MAX DISPLAY_DIMX
24 #define DISPLAY_RAM_CONTENT (DISPLAY_PAGE_MAX*DISPLAY_COL_MAX*2)
27 #define DISPLAY_SET_COL_ADDR(c) DISPLAY_CMD=(0x00|((c)&0x0f)); \
28 DISPLAY_CMD=(0x10|(((c)&0x70)>>4))
29 #define DISPLAY_SET_MASTER DISPLAY_CMD=0x18
30 #define DISPLAY_SET_SLAVE DISPLAY_CMD=0x19
31 #define DISPLAY_SET_REGULATOR(r) DISPLAY_CMD=(0x20|((r)&0x07))
32 #define DISPLAY_SET_POWER(p) DISPLAY_CMD=(0x28|((p)&0x07))
33 #define DISPLAY_V_BOOST 0x01
34 #define DISPLAY_REGULATOR 0x02
35 #define DISPLAY_OPAMP 0x04
36 #define DISPLAY_SET_START_LINE(s) DISPLAY_CMD=0x40; \
38 #define DISPLAY_SET_OFFSET(o) DISPLAY_CMD=0x44; \
40 #define DISPLAY_SET_MPLEX_RATIO(m) DISPLAY_CMD=0x48; \
42 #define DISPLAY_SET_NINV(n) DISPLAY_CMD=0x4c; \
44 #define DISPLAY_SET_BIAS(b) DISPLAY_CMD=(0x50|((b)&0x07))
45 #define DISPLAY_SET_UW_CORNER(x,y) DISPLAY_CMD=0x60; \
46 DISPLAY_CMD=((x)&0x7f); \
49 #define DISPLAY_SET_LW_CORNER(x,y) DISPLAY_CMD=0x62; \
50 DISPLAY_CMD=((x)&0x7f); \
53 #define DISPLAY_SET_CONV_FACTOR(c) DISPLAY_CMD=(0x64|((c)&0x03))
54 #define DISPLAY_SET_CONTRAST(c) DISPLAY_CMD=0x81; \
55 DISPLAY_CMD=((c)&0x3f)
56 #define DISPLAY_SET_WHITE(a,b,c,d) DISPLAY_CMD=0x88; \
57 DISPLAY_CMD=(((b)&0x0f)<<4|((a)&0x0f)); \
59 DISPLAY_CMD=(((d)&0x0f)<<4|((c)&0x0f))
60 #define DISPLAY_SET_LGRAY(a,b,c,d) DISPLAY_CMD=0x8a; \
61 DISPLAY_CMD=(((b)&0x0f)<<4|((a)&0x0f)); \
63 DISPLAY_CMD=(((d)&0x0f)<<4|((c)&0x0f))
64 #define DISPLAY_SET_DGRAY(a,b,c,d) DISPLAY_CMD=0x8c; \
65 DISPLAY_CMD=(((b)&0x0f)<<4|((a)&0x0f)); \
67 DISPLAY_CMD=(((d)&0x0f)<<4|((c)&0x0f))
68 #define DISPLAY_SET_BLACK(a,b,c,d) DISPLAY_CMD=0x8e; \
69 DISPLAY_CMD=(((b)&0x0f)<<4|((a)&0x0f)); \
71 DISPLAY_CMD=(((d)&0x0f)<<4|((c)&0x0f))
72 #define DISPLAY_SET_PWM_FRC(p,f) DISPLAY_CMD=(0x90| \
73 (((f&0x01)<<2)|(p&0x03)))
74 #define DISPLAY_SET_SEGMENT_REMAP_00H DISPLAY_CMD=0xa0
75 #define DISPLAY_SET_SEGMENT_REMAP_7fH DISPLAY_CMD=0xa1
76 #define DISPLAY_RAM_CONTENTS_ON DISPLAY_CMD=0xa4
77 #define DISPLAY_ENTIRE_ON DISPLAY_CMD=0xa5
78 #define DISPLAY_NORMAL DISPLAY_CMD=0xa6
79 #define DISPLAY_REVERSE DISPLAY_CMD=0xa7
80 #define DISPLAY_SET_POWER_SAVE DISPLAY_CMD=0xa9
81 #define DISPLAY_START_OSCILLATOR DISPLAY_CMD=0xab
82 #define DISPLAY_SET_OFF DISPLAY_CMD=0xae
83 #define DISPLAY_SET_ON DISPLAY_CMD=0xaf
84 #define DISPLAY_SET_PAGE_ADDR(p) DISPLAY_CMD=0xb0; \
85 DISPLAY_CMD=((p)&0x1f)
86 #define DISPLAY_SET_COM_ODIR_NORMAL DISPLAY_CMD=0xc0
87 #define DISPLAY_SET_COM_ODIR_REMAPPED DISPLAY_CMD=0xc8
88 #define DISPLAY_EXIT_POWER_SAVE DISPLAY_CMD=0xe1
89 #define DISPLAY_SOFT_RESET DISPLAY_CMD=0xe2
90 #define DISPLAY_EXIT_NLINE_INVERSION DISPLAY_CMD=0xe4
91 #define DISPLAY_SCROLL_BUF_ENABLE DISPLAY_CMD=0xe6
92 #define DISPLAY_SCROLL_BUF_DISABLE DISPLAY_CMD=0xe7
93 #define DISPLAY_SET_TC(c) DISPLAY_CMD=0xe9; \
95 #define DISPLAY_EXTENDED_FEATURES DISPLAY_CMD=0xf0
97 /* experimental cmds */
98 #define DISPLAY_SET_READ_MODIFY_WRITE DISPLAY_CMD=0xe0;
99 #define DISPLAY_UNSET_READ_MODIFY_WRITE DISPLAY_CMD=0xee;
101 /* display api specific defines */
102 #define DISPLAY_FILL_W 0x00
103 #define DISPLAY_FILL_LG 0x01
104 #define DISPLAY_FILL_DG 0x02
105 #define DISPLAY_FILL_B 0x03
108 /* function prototypes */
109 void display_fill_screen(u8 fill);
110 void display_clear_screen(void);
111 void display_init(void);
112 void display_logo(u8 *src);
113 void display_rectangle_page(u8 x,u8 p,u8 w,u8 h,u8 fill,u8 alpha);
114 void display_draw_rectangle(u8 x,u8 y,u8 w,u8 h,u8 fill,u8 alpha);
115 void display_font_page(u8 x,u8 page,u8 *font,u8 fill);
116 void display_draw_font(u8 x,u8 y,u8 *font,u8 fill,u8 alpha);
117 void display_bl_init(void);
118 void display_bl_toggle(void);
119 void display_bl_on(void);
120 void display_bl_off(void);