]> hackdaworld.org Git - my-code/arm.git/commitdiff
some display testing (doesn't work by now!)
authorhackbard <hackbard@staubsauger.localdomain>
Tue, 11 Sep 2007 22:19:15 +0000 (00:19 +0200)
committerhackbard <hackbard@staubsauger.localdomain>
Tue, 11 Sep 2007 22:19:15 +0000 (00:19 +0200)
betty/betty.c
betty/display.c
betty/display.h

index 859860a03e4ce8e9347afe3c69fb26c95c36bac8..200bd6f473ede0ad27337bc3cd3db045479273e0 100644 (file)
@@ -47,15 +47,20 @@ int main() {
        /* pause - seems to not work if running from flash! (?) */
        pause(0xffffff);
 
+       /* display init */
+       display_init();
+
+       /* pasue again */
+
        /* announce */
        uart0_send_string(announce);
 
-       /* toggle backlight */
-       display_bl_toggle();
-
        //addr=0x82000000;
-       flash_sector_erase(BANK2,0);
-       addr=FLASH_BANK2;
+       //flash_sector_erase(BANK2,0);
+       //addr=FLASH_BANK2;
+       
+       DISPLAY_SET_C_ADDR(0);
+       DISPLAY_SET_PAGE_ADDR(0);
 
        while(1) {
                pause(0x0fffff);
@@ -64,9 +69,8 @@ int main() {
                if(button_get_event(&button)) {
                        uart0_send_string(announce);
                        if(button.key[0]==BUTTON_POWER) {
-                               display_bl_toggle();
-                               flash_write_buf(addr,(u16 *)announce,42);
-                               addr+=64;
+                               DISPLAY_DATA=0xff;
+                               DISPLAY_DATA=0xff;
                        }
                }
        }
index 210cd17766cb92358a9736f7228ac29f0f166492..fad0804e5a5bfc477885791db874dbcf14d4247b 100644 (file)
  * functions
  */
 
+void display_clear_screen(void) {
+
+       u32 cnt;
+
+       DISPLAY_SET_PAGE_ADDR(0);
+       DISPLAY_SET_C_ADDR(0);
+
+       for(cnt=0;cnt<DISPLAY_RAM_CONTENT;cnt++)
+               DISPLAY_DATA=0x00;
+}
+
 void display_init(void) {
 
+       /* configure the ext mem bank interface */
        BCFG1=0x00000c42;
+
+       DISPLAY_SOFT_RESET;
+
+       pause(0xffffff);
+
+       DISPLAY_START_OSCILLATOR;
+
+       DISPLAY_SET_POWER(DISPLAY_V_BOOST|DISPLAY_REGULATOR);
+
+       display_clear_screen();
+
+       DISPLAY_SET_ON;
+}
+
+void display_load_logo(u8 *src) {
+
+       u32 cnt;
+
+       DISPLAY_SET_PAGE_ADDR(0);
+       DISPLAY_SET_C_ADDR(0);
+
+       for(cnt=0;cnt<DISPLAY_RAM_CONTENT;cnt++)
+               DISPLAY_DATA=src[cnt];
 }
 
 void display_bl_init(void) {
index afaa399a22a1faf1660e70ccde91801bdb54de0d..b4588873ec29034e260981f804c73b80ef36118e 100644 (file)
 #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);