200bd6f473ede0ad27337bc3cd3db045479273e0
[my-code/arm.git] / betty / betty.c
1 /*
2  * betty.c - alternative firmware for the betty tv ;)
3  *
4  * author: hackbard@hackdaworld.org
5  *
6  */
7
8 /* includes */
9 #include "betty.h"
10
11 /*
12  * functions
13  */
14
15 #define cc1100_init     spi1_init(8,SPI_MASTER,8)
16
17 /*
18  * main function
19  */
20
21 int main() {
22
23         char announce[]="betty - live from flash at 0x80000000! ;)\r\n";
24         t_button button;
25         u32 addr;
26
27         /* system init */
28         pll_init();
29
30         /* uart init */
31         uart0_init();
32
33         /* display init */
34         display_bl_init();
35
36         /* button init */
37         button_init(&button);
38         button_set_retries(&button,100);
39
40         /* flash init */
41         flash_init();
42
43         /*
44          * start it ...
45          */
46
47         /* pause - seems to not work if running from flash! (?) */
48         pause(0xffffff);
49
50         /* display init */
51         display_init();
52
53         /* pasue again */
54
55         /* announce */
56         uart0_send_string(announce);
57
58         //addr=0x82000000;
59         //flash_sector_erase(BANK2,0);
60         //addr=FLASH_BANK2;
61         
62         DISPLAY_SET_C_ADDR(0);
63         DISPLAY_SET_PAGE_ADDR(0);
64
65         while(1) {
66                 pause(0x0fffff);
67
68                 /* button test! */
69                 if(button_get_event(&button)) {
70                         uart0_send_string(announce);
71                         if(button.key[0]==BUTTON_POWER) {
72                                 DISPLAY_DATA=0xff;
73                                 DISPLAY_DATA=0xff;
74                         }
75                 }
76         }
77
78         return 0;
79 }
80