#include "lpc2xxx.h"
#include "types.h"
+/* defines */
+#define DISPLY_BANK1 0x81000000
+
+#define DISPLAY_CMD (*((volatile u8 *)DISPLY_BANK1))
+#define DISPLAY_DATA (*((volatile u8 *)DISPLY_BANK1+1))
+
+#define DISPLAY_DIMX 128
+#define DISPLAY_DIMY 160
+#define DISPLAY_PAGE_MAX (DISPLAY_DIMY/8)
+#define DISPLAY_COL_MAX DISPLAY_DIMX
+#define DISPLAY_RAM_CONTENT (DISPLAY_PAGE_MAX*DISPLAY_COL_MAX*2)
+
+#define DISPLAY_SET_C_ADDR(c) DISPLAY_CMD=(0x00|((c)&0x0f)); \
+ DISPLAY_CMD=(0x10|(((c)&0x70)>>4))
+#define DISPLAY_SET_MASTER DISPLAY_CMD=0x18
+#define DISPLAY_SET_SLAVE DISPLAY_CMD=0x19
+#define DISPLAY_SET_REGULATOR(r) DISPLAY_CMD=(0x20|((r)&0x07))
+#define DISPLAY_SET_POWER(p) DISPLAY_CMD=(0x28|((p)&0x07))
+#define DISPLAY_V_BOOST 0x01
+#define DISPLAY_REGULATOR 0x02
+#define DISPLAY_OPAMP 0x04
+#define DISPLAY_SET_START_LINE(s) DISPLAY_CMD=0x40; \
+ DISPLAY_CMD=(s)
+#define DISPLAY_SET_OFFSET(o) DISPLAY_CMD=0x44; \
+ DISPLAY_CMD=(o)
+#define DISPLAY_SET_MPLEX_RATIO(m) DISPLAY_CMD=0x48; \
+ DISPLAY_CMD=(m)
+#define DISPLAY_SET_NINV(n) DISPLAY_CMD=0x4c; \
+ DISPLAY_CMD=(n)
+#define DISPLAY_SET_BIAS(b) DISPLAY_CMD=(0x50|((b)&0x07))
+#define DISPLAY_SET_UW_CORNER_X(x) DISPLAY_CMD=0x60; \
+ DISPLAY_CMD=((x)&0x7f)
+#define DISPLAY_SET_UW_CORNER_Y(y) DISPLAY_CMD=0x61; \
+ DISPLAY_CMD=(y)
+#define DISPLAY_SET_LW_CORNER_X(x) DISPLAY_CMD=0x62; \
+ DISPLAY_CMD=((x)&0x7f)
+#define DISPLAY_SET_LW_CORNER_Y(y) DISPLAY_CMD=0x63; \
+ DISPLAY_CMD=(y)
+#define DISPLAY_SET_CONV_FACTOR(c) DISPLAY_CMD=(0x64|((c)&0x03))
+#define DISPLAY_SET_CONTRAST(c) DISPLAY_CMD=0x81; \
+ DISPLAY_CMD=((c)&0x3f)
+#define DISPLAY_SET_WHITE(a,b,c,d) DISPLAY_CMD=0x88; \
+ DISPLAY_CMD=(((b)&0x0f)<<4|((a)&0x0f)); \
+ DISPLAY_CMD=0x89; \
+ DISPLAY_CMD=(((d)&0x0f)<<4|((c)&0x0f))
+#define DISPLAY_SET_LGRAY(a,b,c,d) DISPLAY_CMD=0x8a; \
+ DISPLAY_CMD=(((b)&0x0f)<<4|((a)&0x0f)); \
+ DISPLAY_CMD=0x8b; \
+ DISPLAY_CMD=(((d)&0x0f)<<4|((c)&0x0f))
+#define DISPLAY_SET_DGRAY(a,b,c,d) DISPLAY_CMD=0x8c; \
+ DISPLAY_CMD=(((b)&0x0f)<<4|((a)&0x0f)); \
+ DISPLAY_CMD=0x8d; \
+ DISPLAY_CMD=(((d)&0x0f)<<4|((c)&0x0f))
+#define DISPLAY_SET_BLACK(a,b,c,d) DISPLAY_CMD=0x88; \
+ DISPLAY_CMD=(((b)&0x0f)<<4|((a)&0x0f)); \
+ DISPLAY_CMD=0x89; \
+ DISPLAY_CMD=(((d)&0x0f)<<4|((c)&0x0f))
+#define DISPLAY_SET_PWM_FRC(p,f) DISPLAY_CMD=(0x90|(((f&0x01)<<2)|p&0x03))
+#define DISPLAY_SET_SEGMENT_REMAP_00H DISPLAY_CMD=0xa0
+#define DISPLAY_SET_SEGMENT_REMAP_7fH DISPLAY_CMD=0xa1
+#define DISPLAY_RAM_CONTENTS_ON DISPLAY_CMD=0xa4
+#define DISPLAY_ENTIRE_ON DISPLAY_CMD=0xa5
+#define DISPLAY_NORMAL DISPLAY_CMD=0xa6
+#define DISPLAY_REVERSE DISPLAY_CMD=0xa7
+#define DISPLAY_SET_POWER_SAVE DISPLAY_CMD=0xa9
+#define DISPLAY_START_OSCILLATOR DISPLAY_CMD=0xab
+#define DISPLAY_SET_OFF DISPLAY_CMD=0xae
+#define DISPLAY_SET_ON DISPLAY_CMD=0xaf
+#define DISPLAY_SET_PAGE_ADDR(p) DISPLAY_CMD=0xb0; \
+ DISPLAY_CMD=((p)&0x1f)
+#define DISPLAY_SET_COM_ODIR_NORMAL DISPLAY_CMD=0xc0
+#define DISPLAY_SET_COM_ODIR_REMAPPED DISPLAY_CMD=0xc8
+#define DISPLAY_EXIT_POWER_SAVE DISPLAY_CMD=0xe1
+#define DISPLAY_SOFT_RESET DISPLAY_CMD=0xe2
+#define DISPLAY_EXIT_NLINE_INVERSION DISPLAY_CMD=0xe4
+#define DISPLAY_SCROLL_BUF_ENABLE DISPLAY_CMD=0xe6
+#define DISPLAY_SCROLL_BUF_DISABLE DISPLAY_CMD=0xe7
+#define DISPLAY_SET_TC(c) DISPLAY_CMD=0xe9; \
+ DISPLAY_CMD=(c)
+#define DISPLAY_EXTENDED_FEATURES DISPLAY_CMD=0xf0
+
/* function prototypes */
void display_bl_init(void);
void display_bl_toggle(void);