X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=betty%2Fbetty.c;h=163a8e23281eb97d2a5c71e1be8bd8bc8c9830c7;hb=818f43a5586b5c7fa441a8d44405d7b5279e8235;hp=31bc5a2458772c0b388bda8b27016bd6796eacb9;hpb=b4ca71fc214ba3c58cec25661ba1f81cf7b1b871;p=my-code%2Farm.git diff --git a/betty/betty.c b/betty/betty.c index 31bc5a2..163a8e2 100644 --- a/betty/betty.c +++ b/betty/betty.c @@ -20,37 +20,73 @@ int main() { - char buf[]="betty - live from flash at 0x80000000! ;)\r\n"; + char announce[]="betty - live from flash at 0x80000000! ;)\r\n"; t_button button; + u8 contrast; /* system init */ pll_init(); - + pin_init(); + ext_mem_init(); + /* uart init */ uart0_init(); /* display init */ - bl_init(); + display_bl_init(); /* button init */ button_init(&button); button_set_retries(&button,100); + /* flash init */ + flash_init(); + /* * start it ... */ + /* pause - seems to not work if running from flash! (?) */ pause(0xffffff); - bl_toggle(); + /* display init */ + display_bl_toggle(); + display_init(); + contrast=0x38; + + /* pasue again */ + + /* announce */ + uart0_send_string(announce); + + while(1) { pause(0x0fffff); /* button test! */ if(button_get_event(&button)) { - uart0_send_string(buf); - if(button.key[0]==BUTTON_POWER) - bl_toggle(); + uart0_send_string(announce); + switch(button.key[0]) { + case BUTTON_POWER: + display_load_logo(0); + break; + case BUTTON_DOWN: + if(contrast>0x00) + contrast-=1; + DISPLAY_SET_CONTRAST(contrast); + break; + case BUTTON_UP: + if(contrast<0x3f) + contrast+=1; + DISPLAY_SET_CONTRAST(contrast); + break; + case BUTTON_TV: + display_fill_screen(button.key[0]); + break; + default: + display_clear_screen(); + break; + } } }