From: hackbard Date: Thu, 13 Sep 2007 23:19:24 +0000 (+0200) Subject: more display testing X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e12850bb699b1f9088a72840f3ae93a06326ab67;p=my-code%2Farm.git more display testing --- diff --git a/betty/betty.c b/betty/betty.c index 163a8e2..c2aaa38 100644 --- a/betty/betty.c +++ b/betty/betty.c @@ -52,7 +52,7 @@ int main() { /* display init */ display_bl_toggle(); display_init(); - contrast=0x38; + contrast=0x32; /* pasue again */ @@ -65,7 +65,8 @@ int main() { /* button test! */ if(button_get_event(&button)) { - uart0_send_string(announce); + //uart0_send_string(announce); + uart0_send_byte(contrast); switch(button.key[0]) { case BUTTON_POWER: display_load_logo(0); @@ -80,8 +81,27 @@ int main() { contrast+=1; DISPLAY_SET_CONTRAST(contrast); break; - case BUTTON_TV: - display_fill_screen(button.key[0]); + case BUTTON_A: + display_fill_screen(DISPLAY_FILL_W); + break; + case BUTTON_B: + display_fill_screen(DISPLAY_FILL_LG); + break; + case BUTTON_C: + display_fill_screen(DISPLAY_FILL_DG); + break; + case BUTTON_D: + display_fill_screen(DISPLAY_FILL_B); + break; + case BUTTON_1: + display_draw_rectangle(20,20,40,40, + DISPLAY_FILL_B, + 0); + break; + case BUTTON_2: + display_draw_rectangle(50,50,40,40, + DISPLAY_FILL_LG, + 0); break; default: display_clear_screen(); diff --git a/betty/display.c b/betty/display.c index 4d4e1e1..1248279 100644 --- a/betty/display.c +++ b/betty/display.c @@ -5,6 +5,13 @@ * */ +/* + * some comments on alpha blending! + * + * ... + * + */ + #include "display.h" #include "system.h" #include "default_logo.h" @@ -17,55 +24,63 @@ void display_fill_screen(u8 fill) { u8 page,width; + u8 buf[2]; + + buf[0]=0; + buf[1]=0; + + switch(fill) { + case DISPLAY_FILL_LG: + buf[1]=0xff; + break; + case DISPLAY_FILL_DG: + buf[0]=0xff; + break; + case DISPLAY_FILL_B: + buf[0]=0xff; + buf[1]=0xff; + break; + case DISPLAY_FILL_W: + default: + break; + } for(page=0;page c=alpha*a+(1-alpha)*b + + a[0]=0; + a[1]=0; + switch(fill) { + case DISPLAY_FILL_LG: + a[1]=1; + break; + case DISPLAY_FILL_DG: + a[0]=1; + break; + case DISPLAY_FILL_B: + a[0]=1; + a[1]=1; + case DISPLAY_FILL_W: + default: + break; + } + + spage=y>>3; // start page = y/8 + epage=(y+h)>>3; // end page (y+h)/8 + + for(p=spage;p<=epage;p++) { + DISPLAY_SET_PAGE_ADDR(p); + for(c=x;cy+h?y+h:y+8; + for(r=y;r