ALO-095BWNN-J9 aitendo OLED 96x64 SPI model Ver1.04

Files at this revision

API Documentation at this revision

Comitter:
TETSUYA
Date:
Sat Jan 15 03:24:10 2011 +0000
Parent:
5:730724f253a4
Commit message:

Changed in this revision

spioled96x64.cpp Show annotated file Show diff for this revision Revisions of this file
spioled96x64.h Show annotated file Show diff for this revision Revisions of this file
--- 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 @@
     }
 }
 
-*/
--- a/spioled96x64.h	Fri Jan 14 05:10:02 2011 +0000
+++ b/spioled96x64.h	Sat Jan 15 03:24:10 2011 +0000
@@ -25,14 +25,13 @@
 
 
 
-#define GAC_FILL_ENABLE_DISABLE  0x26   // 塗りつぶし可否コマンド
+#define GAC_FILL_ENABLE_DISABLE  0x26   // �h��‚Ԃ��”ۃR�}���h
 #define GAC_DRAW_RECTANGLE       0x22   // Rectangle cmd
-/*
+
 #define GAC_COPY_AREA            0x23   // Copy Area
 #define GAC_SCROLL_SETUP         0x27
 #define GAC_SCROLL_STOP          0x2E
 #define GAC_SCROLL_START         0x2F
-*/
 
 class SPIOLED96x64 : public Stream {
 public:
@@ -60,17 +59,16 @@
     void locate(int column, int row);
     int row();
     int column();
-    //void puts( char *s );
 
     void line( int x0,int y0,int x1,int y1, unsigned int fore_col ,int pat  );
     void circle (int radius, int x, int y , unsigned int col, int fill);
     void Pattern(int x,int y,int width, int height, unsigned int *p);
     void GACEnable(int enable);
-    /*
+    
     void Copy(int src_x1,int src_y1,int src_x2,int src_y2, int dst_x,int dst_y);
     void ScrollSet(int a, int b, int c, int d , int frame_interval);
     void Scroll(int enable);
-    */
+    
 protected:
      // Stream implementation functions
      virtual int _putc( int c );