*/
#include "display.h"
+#include "system.h"
+#include "default_logo.h"
+#include "uart.h"
/*
* functions
*/
-void bl_init(void) {
+void display_fill_screen(u8 fill) {
+
+ 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=fill;
+ DISPLAY_DATA=fill;
+ }
+ }
+}
+
+void display_clear_screen(void) {
+
+ display_fill_screen(0x00);
+}
+
+void display_init(void) {
+
+ DISPLAY_EXIT_POWER_SAVE;
+
+ DISPLAY_SOFT_RESET;
+ pause(0xffffff);
+
+ DISPLAY_START_OSCILLATOR;
+
+ 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();
+
+ DISPLAY_SET_ON;
+}
+
+void display_load_logo(u8 *src) {
+
+ u8 *s;
+ u8 page,width;
+ u32 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 bl_toggle(void) {
+void display_bl_toggle(void) {
if(IOPIN0&(1<<4))
IOCLR0=(1<<4);
IOSET0=(1<<4);
}
-void bl_on(void) {
+void display_bl_on(void) {
IOCLR0=(1<<4);
}
-void bl_off(void) {
+void display_bl_off(void) {
IOSET0=(1<<4);
}