Hi,
ich nutze gerade die Lib von andre.master:
Beitrag "GLCD Routinen ( KS0108, HD61202 )". Nun m?chte ich
folgendes machen: Eine Grafik (32x16 oder 48x16 oder 64x16) soll ab
einem beliebigen Punkt angezeigt werden. In dieser Lib gibt es eine
Methode:
1 | void lcd_draw_fullscreen_bmp(ubyte* bitmap)
|
2 | {
|
3 | // INFO:
|
4 | // data is organized page after page (0-to-127)
|
5 | // (LSB-to-MSB TOP-to-Bottom)
|
6 | // from 0 to 127 in eight lines (127*8=1024 Byte)
|
7 |
|
8 | uint16_t byte=0;
|
9 | uint8_t x,y;
|
10 | for (y=0;y<8;y++)
|
11 | {
|
12 | lcd_write_cmd(LCD_SET_PAGE|y,CHIP1|CHIP2); //start a new page
|
13 | lcd_write_cmd(LCD_SET_ADD|0,CHIP1|CHIP2); // start at 0
|
14 | for (x=0;x<128;x++)
|
15 | {
|
16 | if (x<64)
|
17 | lcd_write_data(*(bitmap+(byte++)),CHIP1);
|
18 | else
|
19 | lcd_write_data(*(bitmap+(byte++)),CHIP2);
|
20 | }
|
21 | }
|
22 |
|
23 |
|
24 | /*
|
25 | this was used to test lcd_set_pixel
|
26 | (can be used to overlay a bmp to current screen)
|
27 | */
|
28 |
|
29 | /*
|
30 | uint16_t byte=0;
|
31 | uint8_t x,y,bit_var,temp;
|
32 | for (y=0;y<8;y++)
|
33 | {
|
34 | for(x=0;x<128;x++)
|
35 | {
|
36 | temp= *(bitmap+(byte++));
|
37 | for (bit_var=0;bit_var<8;bit_var++)
|
38 | if ((temp& (1<<bit_var))!=0)
|
39 | lcd_set_pixel(x,y*8+bit_var,BLACK);
|
40 | }
|
41 | }
|
42 | */
|
43 |
|
44 | }
|
Ich m?chte folgende Methode aus der zweiten Alternative machen:
1 | lcd_draw_bmp(uint8_t x, uint8_t y, uint8_t n, uint8_t bitmap)
|
2 | // n = 2 bedeutet 2x16 usw.
|
3 | {
|
4 | uint16_t byte=0;
|
5 | uint8_t x1,y1,bit_var,temp;
|
6 | for (y1=y;y1<y+2;y1++)
|
7 | // 16 Zeilen
|
8 | {
|
9 | for(x1=x;x1<x+16*n;x1++)
|
10 | // 16*n Spalten
|
11 | {
|
12 | temp= *(bitmap+(byte++));
|
13 | for (bit_var=0;bit_var<8;bit_var++)
|
14 | if ((temp& (1<<bit_var))!=0)
|
15 | lcd_set_pixel(x1,y1*8+bit_var,BLACK);
|
16 | }
|
17 | }
|
18 | }
|
Leider verfüge ich über keine Hardware. Funktioniert meine Funktion?
Danke
Owen