X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Farm.git;a=blobdiff_plain;f=betty%2Fbetty.c;fp=betty%2Fbetty.c;h=45e6ae741c513c46f30f8337363e74a43f1e9be9;hp=31bc5a2458772c0b388bda8b27016bd6796eacb9;hb=5da509dc909c60d63c5fba98e7ced43040eb6827;hpb=b4ca71fc214ba3c58cec25661ba1f81cf7b1b871 diff --git a/betty/betty.c b/betty/betty.c index 31bc5a2..45e6ae7 100644 --- a/betty/betty.c +++ b/betty/betty.c @@ -20,8 +20,9 @@ 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; + u32 addr; /* system init */ pll_init(); @@ -36,21 +37,37 @@ int main() { 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); + + /* announce */ + uart0_send_string(announce); + + /* toggle backlight */ bl_toggle(); + //addr=0x82000000; + flash_sector_erase(BANK2,0); + addr=FLASH_BANK2; + while(1) { pause(0x0fffff); /* button test! */ if(button_get_event(&button)) { - uart0_send_string(buf); - if(button.key[0]==BUTTON_POWER) + uart0_send_string(announce); + if(button.key[0]==BUTTON_POWER) { bl_toggle(); + flash_write_buf(addr,(u16 *)announce,42); + addr+=64; + } } }