Fork of C12832_lcd by
Diff: C12832_lcd.cpp
- Revision:
- 12:a66fded29327
- Parent:
- 11:045ceacdd1af
- Parent:
- 10:8f86576007d6
--- a/C12832_lcd.cpp Sat Jul 16 18:46:12 2016 +0000 +++ b/C12832_lcd.cpp Sat Jul 16 18:52:33 2016 +0000 @@ -14,7 +14,8 @@ // 13.10.12 initial design // 25.10.12 add autorefresh of screen -// 25.10.12 add standart font +// 25.10.12 add standart font +// 20.12.12 add bitmap graphics // optional defines : // #define debug_lcd 1 @@ -151,9 +152,10 @@ memset(buffer,0x00,1024); // clear display buffer copy_to_lcd(); auto_up = 1; // switch on auto update - claim(stdout); // redirekt printf to lcd + // dont do this by default. Make the user call + //claim(stdout); // redirekt printf to lcd locate(0,0); - set_font((unsigned char*)Small_7); // standart font + set_font((unsigned char*)Small_7); // standart font } // set one pixel in buffer @@ -457,7 +459,7 @@ for (i = 0; i <= r; i++) circle(x,y,i,color); auto_up = up; - if(auto_up) copy_to_lcd(); + if(auto_up) copy_to_lcd(); } void C12832_LCD::setmode(int mode) @@ -552,10 +554,33 @@ void C12832_LCD::set_auto_up(unsigned int up) { if(up ) auto_up = 1; + else auto_up = 0; } -unsigned int C12832_LCD::get_auto_up(void){ +unsigned int C12832_LCD::get_auto_up(void) +{ return (auto_up); } +void C12832_LCD::print_bm(Bitmap bm, int x, int y) +{ + int h,v,b; + char d; + for(v=0; v < bm.ySize; v++) { // lines + for(h=0; h < bm.xSize; h++) { // pixel + if(h + x > 127) break; + if(v + y > 31) break; + d = bm.data[bm.Byte_in_Line * v + ((h & 0xF8) >> 3)]; + b = 0x80 >> (h & 0x07); + if((d & b) == 0) { + pixel(x+h,y+v,0); + } else { + pixel(x+h,y+v,1); + } + } + } + +} + +