some display testing (doesn't work by now!)
[my-code/arm.git] / betty / display.c
1 /*
2  * display.c - handling the display
3  *
4  * author: hackbard@hackdaworld.org
5  *
6  */
7
8 #include "display.h"
9
10 /*
11  * functions
12  */
13
14 void display_clear_screen(void) {
15
16         u32 cnt;
17
18         DISPLAY_SET_PAGE_ADDR(0);
19         DISPLAY_SET_C_ADDR(0);
20
21         for(cnt=0;cnt<DISPLAY_RAM_CONTENT;cnt++)
22                 DISPLAY_DATA=0x00;
23 }
24
25 void display_init(void) {
26
27         /* configure the ext mem bank interface */
28         BCFG1=0x00000c42;
29
30         DISPLAY_SOFT_RESET;
31
32         pause(0xffffff);
33
34         DISPLAY_START_OSCILLATOR;
35
36         DISPLAY_SET_POWER(DISPLAY_V_BOOST|DISPLAY_REGULATOR);
37
38         display_clear_screen();
39
40         DISPLAY_SET_ON;
41 }
42
43 void display_load_logo(u8 *src) {
44
45         u32 cnt;
46
47         DISPLAY_SET_PAGE_ADDR(0);
48         DISPLAY_SET_C_ADDR(0);
49
50         for(cnt=0;cnt<DISPLAY_RAM_CONTENT;cnt++)
51                 DISPLAY_DATA=src[cnt];
52 }
53
54 void display_bl_init(void) {
55
56         PINSEL0&=~(1<<9|(1<<8));
57         IODIR0|=(1<<4);
58 }
59
60 void display_bl_toggle(void) {
61
62         if(IOPIN0&(1<<4))
63                 IOCLR0=(1<<4);
64         else
65                 IOSET0=(1<<4);
66 }
67
68 void display_bl_on(void) {
69
70         IOCLR0=(1<<4);
71 }
72
73 void display_bl_off(void) {
74
75         IOSET0=(1<<4);
76 }
77