moved pin/bank configuration to global init routines to system.c + added
[my-code/arm.git] / betty / display.c
index 1d6af1a..71791fc 100644 (file)
@@ -6,6 +6,9 @@
  */
 
 #include "display.h"
+#include "system.h"
+#include "default_logo.h"
+#include "uart.h"
 
 /*
  * functions
@@ -24,18 +27,39 @@ void display_clear_screen(void) {
 
 void display_init(void) {
 
-       /* configure the ext mem bank interface */
-       BCFG1=0x00000c42;
-
        DISPLAY_EXIT_POWER_SAVE;
 
-       /* reset the display, wait until its up again */
        DISPLAY_SOFT_RESET;
        pause(0xffffff);
 
        DISPLAY_START_OSCILLATOR;
 
-       DISPLAY_SET_POWER(DISPLAY_V_BOOST|DISPLAY_REGULATOR);
+       DISPLAY_SET_REGULATOR(7);
+
+       DISPLAY_SET_CONTRAST(0x38);
+
+       DISPLAY_SET_CONV_FACTOR(0x01);
+
+       DISPLAY_SET_UW_CORNER(0x1c,0x0a);
+       DISPLAY_SET_LW_CORNER(0x75,0x81);
+
+       DISPLAY_SET_PWM_FRC(0,0);
+
+       DISPLAY_SET_WHITE(0,0,0,0);
+       DISPLAY_SET_LGRAY(4,4,4,4);
+       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);
+       
+       DISPLAY_RAM_CONTENTS_ON;
+
+       DISPLAY_NORMAL;
 
        display_clear_screen();
 
@@ -45,18 +69,23 @@ void display_init(void) {
 void display_load_logo(u8 *src) {
 
        u32 cnt;
+       u8 *s;
+
+       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=src[cnt];
+               DISPLAY_DATA=s[cnt];
 }
 
 void display_bl_init(void) {
 
-       PINSEL0&=~(1<<9|(1<<8));
        IODIR0|=(1<<4);
+       IOSET0=(1<<4);  // off by default
 }
 
 void display_bl_toggle(void) {