]> hackdaworld.org Git - my-code/arm.git/commitdiff
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 ed4247588da8cf05551c866412431a4afd894b4e..e5923e9855cb05193b28cc455f2669114b86c861 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 71791fc0449fd97013c6d7b14ea7b43e3272b278..e102141d2a562ce4d7a87cea7c902fac3dbf832d 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 0926655303ac98fdcd4b3883f3ec9fcca067055a..b129d8815cd5f9cc79aecd1b99d99c237017f5c9 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);