FreeCalypso > hg > fc-tourmaline
comparison src/cs/drivers/drv_app/r2d/lcds/c139/r2d_task_i.c @ 47:502a0a3f6a49
C139 LCD support reinstated in the new way
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 18 Oct 2020 02:03:10 +0000 |
parents | 4e78acac3d88 |
children | 4221c724c664 |
comparison
equal
deleted
inserted
replaced
46:09cdd5bf04e4 | 47:502a0a3f6a49 |
---|---|
37 | 37 |
38 void r2d_lcd_power_off(void) | 38 void r2d_lcd_power_off(void) |
39 { | 39 { |
40 } | 40 } |
41 | 41 |
42 static int get_pix_from_sw_fb(UINT32 *fb, UINT16 x, UINT16 y) | |
43 { | |
44 UINT32 *p, mask; | |
45 UINT16 yword, ybit; | |
46 | |
47 /* mirroring */ | |
48 x = R2D_WIDTH - 1 - x; | |
49 y = R2D_HEIGHT - 1 - y; | |
50 yword = y >> 5; | |
51 ybit = y & 31; | |
52 p = fb + x * R2D_MWHEIGHT + yword; | |
53 mask = 1 << ybit; | |
54 if (*p & mask) | |
55 return(1); | |
56 else | |
57 return(0); | |
58 } | |
59 | |
60 void r2d_refresh(void) | 42 void r2d_refresh(void) |
61 { | 43 { |
62 UINT16 x, y; | 44 UINT16 i, j, k; |
63 UINT32 *fb; | 45 UINT32 v; |
46 UINT32 *p; | |
47 INT16 y1, y2; | |
64 | 48 |
65 fb = r2d_g_framebuffer->p_memory_words; | 49 p=r2d_g_framebuffer->p_memory_words; |
50 | |
51 y1=r2d_update_ul_y; //0 | |
52 y2=r2d_update_br_y; //63 | |
66 | 53 |
67 /* set the LCD up to refresh the 84x48 area */ | 54 /* set window area */ |
68 c139_set_lcd_addr_region(6, 89, 8, 55); | 55 c139_set_lcd_addr_region(0, 95, y1, y2); |
69 /* send the pixels */ | 56 |
70 for (y = 0; y < R2D_HEIGHT; y++) { | 57 p=p+y1*R2D_MWWIDTH; |
71 for (x = 0; x < R2D_WIDTH; x++) { | 58 |
72 if (get_pix_from_sw_fb(fb, x, y)) | 59 for (i=y1;i<=y2;i++) |
73 c139_lcd_send_pix(LCD16_COLOR_BLACK); | 60 { |
74 else | 61 for (j = 0; j < R2D_MWWIDTH-1; j++) |
75 c139_lcd_send_pix(LCD16_COLOR_WHITE); | 62 { |
76 } | 63 v=*p++; |
77 } | 64 for (k=0;k<32;k++) |
65 { | |
66 if (v&1) | |
67 c139_lcd_send_pix(LCD16_COLOR_BLACK); | |
68 else | |
69 c139_lcd_send_pix(LCD16_COLOR_WHITE); | |
70 v=v>>1; | |
71 } | |
72 } | |
73 p++; | |
74 } | |
78 | 75 |
79 r2d_reinit_update_region(); | 76 r2d_reinit_update_region(); |
80 } | 77 } |