UniGraphic-Fork for ST7920-LCD-controller and SH1106. Tested with 128x64 LCD with SPI and 128x64-OLED with IIC
Dependents: UniGraphic-St7920-Test AfficheurUTILECO
Fork of UniGraphic by
Fork of the UniGraphic-Library for monochrome LCDs with ST7920 controller and 128x64-IIC-OLED-Display with SH1106-Controller

Had to adapt LCD for following reasons:
- Give access to screenbuffer buffer[] to parent class
- pixel() and pixel_read() as they are hardware-dependent
- added reset-pin to IIC-Interface
GraphicDisplay:: sends buffer to LCD when auto_update is set to true.
Testprogram for ST7920 can be found here:
https://developer.mbed.org/users/charly/code/UniGraphic-St7920-Test/
Revision 16:244f9563ebc1, committed 2015-02-23
- Comitter:
- Geremia
- Date:
- Mon Feb 23 23:36:22 2015 +0000
- Parent:
- 15:b9483ba842c8
- Child:
- 17:1dafb896c6f5
- Child:
- 18:ffa58f1a680a
- Commit message:
- revised Bitmap() for faster plotting
Changed in this revision
| Graphics/GraphicsDisplay.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Graphics/GraphicsDisplay.cpp Mon Feb 23 16:05:16 2015 +0000
+++ b/Graphics/GraphicsDisplay.cpp Mon Feb 23 23:36:22 2015 +0000
@@ -333,36 +333,30 @@
}
void GraphicsDisplay::Bitmap(int x, int y, int w, int h,unsigned char *bitmap)
{
- int j,i;
- int padd;
+ int j;
+ unsigned char padd;
unsigned short *bitmap_ptr = (unsigned short *)bitmap;
-// unsigned short i;
-
- // the lines are padded to multiple of 4 bytes in a bitmap
- padd = -1;
- do {
- padd ++;
- } while (2*(w + padd)%4 != 0);
+
+ padd = w%2; // the lines are padded to multiple of 4 bytes in a bitmap
if(x<0) x=0;
+ else if(x>=oriented_width) return;
if(y<0) y=0;
+ else if(y>=oriented_height) return;
int cropX = (x+w)-oriented_width;
if(cropX<0) cropX=0;
- window(x, y, w-cropX, h);
- bitmap_ptr += ((h - 1)* (w + padd));
-// wr_cmd(0x2C); // send pixel
- for (j = 0; j < h; j++) { //Lines
- if((h + y) >= oriented_height) break; // no need to crop Y
- for (i = 0; i < w; i++) { // one line
- if((w + x) < oriented_width) window_pushpixel(*bitmap_ptr); //fixme, send chunk w-cropX lenght and incr bitmapptr if out of margin
- bitmap_ptr++;
- }
- bitmap_ptr -= 2*w;
- bitmap_ptr -= padd;
+ int cropY = (y+h)-oriented_height;
+ if(cropY<0) cropY=0;
+ window(x, y, w-cropX, h-cropY);
+ bitmap_ptr += ((h - 1)* (w + padd)); // begin of last line in array (first line of image)(standard bmp scan direction is left->right bottom->top)
+ for (j = 0; j < h-cropY; j++) { //Lines
+ window_pushpixelbuf(bitmap_ptr, w-cropX);
+ bitmap_ptr -= w+padd;
}
if(auto_up) copy_to_lcd();
}
+
// local filesystem is not implemented in kinetis board , but you can add a SD card
-
+// fixme this whole functions needs testing and speedup
int GraphicsDisplay::BMP_16(int x, int y, const char *Name_BMP)
{
