basic lcd control (must get improved!)
authorhackbard <hackbard@staubsauger.localdomain>
Thu, 13 Sep 2007 00:22:23 +0000 (02:22 +0200)
committerhackbard <hackbard@staubsauger.localdomain>
Thu, 13 Sep 2007 00:22:23 +0000 (02:22 +0200)
betty/betty.c
betty/display.c
betty/display.h

index ed42475..e5923e9 100644 (file)
@@ -51,6 +51,7 @@ int main() {
        pause(0xffffff);
 
        /* display init */
+       display_bl_toggle();
        display_init();
        contrast=0x38;
 
@@ -81,10 +82,7 @@ int main() {
                                        DISPLAY_SET_CONTRAST(contrast);
                                        break;
                                default:
-                                       DISPLAY_SET_C_ADDR(0);
-                                       DISPLAY_SET_PAGE_ADDR(0);
-                                       for(cnt=0;cnt<DISPLAY_RAM_CONTENT;cnt++)
-                                               DISPLAY_DATA=button.key[0];
+                                       display_clear_screen();
                                        break;
                        }
                }
index 71791fc..e102141 100644 (file)
 
 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;
+       u8 page,width;
+
+       for(page=0;page<DISPLAY_PAGE_MAX;page++) {
+               DISPLAY_SET_C_ADDR(0);
+               DISPLAY_SET_PAGE_ADDR(page);
+               for(width=0;width<DISPLAY_DIMX;width++) {
+                       DISPLAY_DATA=0x00;
+                       DISPLAY_DATA=0x00;
+               }
+       }
 }
 
 void display_init(void) {
@@ -40,19 +43,14 @@ void display_init(void) {
 
        DISPLAY_SET_CONV_FACTOR(0x01);
 
-       DISPLAY_SET_UW_CORNER(0x1c,0x0a);
-       DISPLAY_SET_LW_CORNER(0x75,0x81);
-
        DISPLAY_SET_PWM_FRC(0,0);
 
+       // gray scale palette
        DISPLAY_SET_WHITE(0,0,0,0);
-       DISPLAY_SET_LGRAY(4,4,4,4);
+       DISPLAY_SET_LGRAY(2,2,2,2);
        DISPLAY_SET_DGRAY(6,6,6,6);
        DISPLAY_SET_BLACK(9,9,9,9);
 
-       DISPLAY_SET_SEGMENT_REMAP_00H;
-       DISPLAY_SET_COM_ODIR_REMAPPED;
-
        DISPLAY_SET_POWER(DISPLAY_REGULATOR|DISPLAY_OPAMP);
        pause(0xffffff);
        DISPLAY_SET_POWER(DISPLAY_V_BOOST|DISPLAY_REGULATOR|DISPLAY_OPAMP);
@@ -68,18 +66,24 @@ void display_init(void) {
 
 void display_load_logo(u8 *src) {
 
-       u32 cnt;
        u8 *s;
+       u8 page,width;
+       u32 cnt;
 
        s=src;
        if(s==0)
                s=default_logo;
 
-       DISPLAY_SET_PAGE_ADDR(0);
-       DISPLAY_SET_C_ADDR(0);
-
-       for(cnt=0;cnt<DISPLAY_RAM_CONTENT;cnt++)
-               DISPLAY_DATA=s[cnt];
+       cnt=0;
+       for(page=0;page<DISPLAY_PAGE_MAX;page++) {
+               DISPLAY_SET_C_ADDR(0);
+               DISPLAY_SET_PAGE_ADDR(page);
+               for(width=0;width<DISPLAY_DIMX;width++) {
+                       DISPLAY_DATA=s[cnt];
+                       DISPLAY_DATA=s[cnt+1];
+                       cnt+=2;
+               }
+       }
 }
 
 void display_bl_init(void) {
index 0926655..b129d88 100644 (file)
@@ -95,6 +95,7 @@
 #define DISPLAY_EXTENDED_FEATURES      DISPLAY_CMD=0xf0
 
 /* function prototypes */
+void display_clear_screen(void);
 void display_init(void);
 void display_load_logo(u8 *src);
 void display_bl_init(void);