Adafruit ssd1331 OLED 96x64 SPI model
Fork of OledLib by
Diff: spioled96x64.cpp
- Revision:
- 6:7c25a9403243
- Parent:
- 5:730724f253a4
- Child:
- 7:60b2f555f3b7
diff -r 730724f253a4 -r 7c25a9403243 spioled96x64.cpp --- a/spioled96x64.cpp Fri Jan 14 05:10:02 2011 +0000 +++ b/spioled96x64.cpp Sat Jan 15 03:24:10 2011 +0000 @@ -9,6 +9,8 @@ // Ver1.02 SD1331/1332用 GACcommand対応 // ただし現状ではRectangeしか機能しない模様 // Ver1.03 Box (GAC) Color Bug fix +// Ver.104 Font Position Convert Bug fix +// Position Clip is refine. #include "mbed.h" #include "spioled96x64.h" @@ -145,16 +147,8 @@ void SPIOLED96x64::Draw_Dot(int x,int y,unsigned int Color) { unsigned char cmd[7]={0x15,0x00,0x00,0x75,0x00,0x00,0x00}; - if ( ( x > Dis_X_MAX ) - ||( y > Dis_Y_MAX ) ) return ; - /* - RegWrite(0x15); - RegWrite((unsigned char)x); // Column Start Address - RegWrite((unsigned char)x); // Column End Address - RegWrite(0x75); - RegWrite((unsigned char)y); // Row Start Address - RegWrite((unsigned char)y); // Row End Address - */ + if ( ( x < 0 )||( y < 0 ) + ||( x > Dis_X_MAX )||( y > Dis_Y_MAX ) ) return ; cmd[1] = (unsigned char)x; cmd[2] = (unsigned char)x; cmd[4] = (unsigned char)y; @@ -233,7 +227,7 @@ for(j=Y_Witch-1;j>=0;j--){ for ( k=0;k<lpy;k++){ - Draw_Dot(x+(i*lpx)+l,y+((j+1)*lpy)-k, ((Temp & 0x80)==0x80) ? Char_Color : BGround_Color); + Draw_Dot(x+(i*lpx)+l,y+(((j+1)*lpy)-1)-k, ((Temp & 0x80)==0x80) ? Char_Color : BGround_Color); } Temp = Temp << 1; } @@ -372,8 +366,14 @@ // SSD1331/1332用 GAC(アクセラレートコマンド) unsigned char cmd[11]={ 0 }; - if ( ( x1 > Dis_X_MAX )||( y1 > Dis_Y_MAX ) - ||( x2 > Dis_X_MAX )||( y2 > Dis_Y_MAX ) ) return ; + if ( x1 < 0 ) x1 = 0; + else if ( x1 > Dis_X_MAX ) x1 = Dis_X_MAX; + if ( y1 < 0 ) y1 = 0; + else if ( y1 > Dis_Y_MAX ) y1 = Dis_Y_MAX; + if ( x2 < 0 ) x2 = 0; + else if ( x2 > Dis_X_MAX ) x2 = Dis_X_MAX; + if ( y2 < 0 ) y2 = 0; + else if ( y2 > Dis_Y_MAX ) y2 = Dis_Y_MAX; cmd[0] = GAC_FILL_ENABLE_DISABLE; // cmd[1] = (unsigned char)fill; //( fill ) ? 0 : 0; @@ -552,7 +552,7 @@ { GAC_Useflag = enable; } -/* + // 任意領域のコピー // SSD1332では機能しない模様... @@ -616,4 +616,3 @@ } } -*/