*/
#include "display.h"
+#include "system.h"
+#include "default_logo.h"
+#include "uart.h"
/*
* functions
*/
-void display_clear_screen(void) {
+void display_fill_screen(u8 fill) {
- u32 cnt;
+ u8 page,width;
- DISPLAY_SET_PAGE_ADDR(0);
- DISPLAY_SET_C_ADDR(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=fill;
+ DISPLAY_DATA=fill;
+ }
+ }
+}
- for(cnt=0;cnt<DISPLAY_RAM_CONTENT;cnt++)
- DISPLAY_DATA=0x00;
+void display_clear_screen(void) {
+
+ display_fill_screen(0x00);
}
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_PWM_FRC(0,0);
+
+ // gray scale palette
+ DISPLAY_SET_WHITE(0,0,0,0);
+ DISPLAY_SET_LGRAY(2,2,2,2);
+ DISPLAY_SET_DGRAY(6,6,6,6);
+ DISPLAY_SET_BLACK(9,9,9,9);
+
+ 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();
void display_load_logo(u8 *src) {
+ u8 *s;
+ u8 page,width;
u32 cnt;
- DISPLAY_SET_PAGE_ADDR(0);
- DISPLAY_SET_C_ADDR(0);
-
- for(cnt=0;cnt<DISPLAY_RAM_CONTENT;cnt++)
- DISPLAY_DATA=src[cnt];
+ s=src;
+ if(s==0)
+ s=default_logo;
+
+ 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) {
- PINSEL0&=~(1<<9|(1<<8));
IODIR0|=(1<<4);
+ IOSET0=(1<<4); // off by default
}
void display_bl_toggle(void) {