昊威 程 / drive1

Dependencies:   SSD1327

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SeeedGrayOLED.h Source File

SeeedGrayOLED.h

00001 /*
00002  * SeeedGrayOLED.cpp
00003  * SSD1327 Gray OLED Driver Library
00004  *
00005  * Copyright (c) 2011 seeed technology inc.
00006  * Author        :   Visweswara R
00007  * Create Time   :   Dec 2011
00008  * Change Log    :
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00023  */
00024  
00025 #ifndef SeeedGrayOLED_data_H
00026 #define SeeedGrayOLED_data_H
00027 
00028 // SeeedGrayOLED Instruction set addresses
00029 
00030 //#include "Arduino.h"
00031 #include "mbed.h"
00032 #define SH1107G  1
00033 #define SSD1327  2
00034 
00035 #define VERTICAL_MODE                       01
00036 #define HORIZONTAL_MODE                     02
00037 
00038 // #define SeeedGrayOLED_Address               0x3c
00039 const int SeeedGrayOLED_Address = 0x3c<<1;
00040 #define SeeedGrayOLED_Command_Mode          0x80
00041 #define SeeedGrayOLED_Data_Mode             0x40
00042 
00043 #define SeeedGrayOLED_Display_Off_Cmd       0xAE
00044 #define SeeedGrayOLED_Display_On_Cmd        0xAF
00045 
00046 #define SeeedGrayOLED_Normal_Display_Cmd    0xA4
00047 #define SeeedGrayOLED_Inverse_Display_Cmd   0xA7
00048 #define SeeedGrayOLED_Activate_Scroll_Cmd   0x2F
00049 #define SeeedGrayOLED_Dectivate_Scroll_Cmd  0x2E
00050 #define SeeedGrayOLED_Set_ContrastLevel_Cmd 0x81
00051 
00052 #define Scroll_Left             0x00
00053 #define Scroll_Right            0x01
00054 
00055 #define Scroll_2Frames          0x7
00056 #define Scroll_3Frames          0x4
00057 #define Scroll_4Frames          0x5
00058 #define Scroll_5Frames          0x0
00059 #define Scroll_25Frames         0x6
00060 #define Scroll_64Frames         0x1
00061 #define Scroll_128Frames        0x2
00062 #define Scroll_256Frames        0x3
00063 
00064 
00065 class SeeedGrayOLED {
00066 
00067 public:
00068 
00069 char addressingMode;
00070 
00071 void init(int IC);
00072 
00073 void setNormalDisplay();
00074 void setInverseDisplay();
00075 
00076 void sendCommand(unsigned char command);
00077 void sendData(unsigned char Data);
00078 void setGrayLevel(unsigned char grayLevel);
00079 
00080 void setVerticalMode();
00081 void setHorizontalMode();
00082 
00083 void setTextXY(unsigned char Row, unsigned char Column);
00084 void setzifuXY(unsigned char Row, unsigned char Column);
00085 void clearDisplay();
00086 void setContrastLevel(unsigned char ContrastLevel);
00087 void putChar(unsigned char c);
00088 void putzifu(unsigned char c);
00089 void putString(const char *String);
00090 unsigned char putNumber(long n);
00091 unsigned char putFloat(float floatNumber,unsigned char decimal);
00092 unsigned char putFloat(float floatNumber);
00093 
00094 void drawBitmap(const unsigned char *bitmaparray,int bytes);
00095 void drawzifu(unsigned char Row, unsigned char Column,const unsigned char *bitmaparray,int bytes);
00096 
00097 void setHorizontalScrollProperties(bool direction,unsigned char startRow, unsigned char endRow,unsigned char startColumn, unsigned char endColumn, unsigned char scrollSpeed);
00098 void activateScroll();
00099 void deactivateScroll();
00100 
00101 private:
00102 
00103 unsigned char grayH;
00104 unsigned char grayL;
00105 int Drive_IC;
00106 
00107 };
00108 
00109 extern SeeedGrayOLED myOLED;  // SeeedGrayOLED object 
00110 
00111 #endif
00112 
00113