X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Farm.git;a=blobdiff_plain;f=betty%2Fbetty.c;h=ed4247588da8cf05551c866412431a4afd894b4e;hp=200bd6f473ede0ad27337bc3cd3db045479273e0;hb=ec21607f7dc421c6a474d93b90e9045ec465a222;hpb=be9286b8103eef7df95506c831b48ec5c1d6f32f diff --git a/betty/betty.c b/betty/betty.c index 200bd6f..ed42475 100644 --- a/betty/betty.c +++ b/betty/betty.c @@ -22,11 +22,14 @@ int main() { char announce[]="betty - live from flash at 0x80000000! ;)\r\n"; t_button button; - u32 addr; + u8 contrast; + int cnt; /* system init */ pll_init(); - + pin_init(); + ext_mem_init(); + /* uart init */ uart0_init(); @@ -49,28 +52,40 @@ int main() { /* display init */ display_init(); + contrast=0x38; /* pasue again */ /* announce */ uart0_send_string(announce); - //addr=0x82000000; - //flash_sector_erase(BANK2,0); - //addr=FLASH_BANK2; - DISPLAY_SET_C_ADDR(0); - DISPLAY_SET_PAGE_ADDR(0); - while(1) { pause(0x0fffff); /* button test! */ if(button_get_event(&button)) { uart0_send_string(announce); - if(button.key[0]==BUTTON_POWER) { - DISPLAY_DATA=0xff; - DISPLAY_DATA=0xff; + 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; + default: + DISPLAY_SET_C_ADDR(0); + DISPLAY_SET_PAGE_ADDR(0); + for(cnt=0;cnt