1 | /*
|
---|
2 | SeeedGrayOLED.h - SSD1327 Gray OLED Driver Library
|
---|
3 | 2011 Copyright (c) Seeed Technology Inc. All right reserved.
|
---|
4 |
|
---|
5 | Author: Visweswara R
|
---|
6 |
|
---|
7 | This library is free software; you can redistribute it and/or
|
---|
8 | modify it under the terms of the GNU Lesser General Public
|
---|
9 | License as published by the Free Software Foundation; either
|
---|
10 | version 2.1 of the License, or (at your option) any later version.
|
---|
11 |
|
---|
12 | This library is distributed in the hope that it will be useful,
|
---|
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
15 | Lesser General Public License for more details.
|
---|
16 |
|
---|
17 | You should have received a copy of the GNU Lesser General Public
|
---|
18 | License along with this library; if not, write to the Free Software
|
---|
19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef SeeedGrayOLED_data_H
|
---|
23 | #define SeeedGrayOLED_data_H
|
---|
24 |
|
---|
25 | // SeeedGrayOLED Instruction set addresses
|
---|
26 |
|
---|
27 | #include "Arduino.h"
|
---|
28 |
|
---|
29 | #define VERTICAL_MODE 01
|
---|
30 | #define HORIZONTAL_MODE 02
|
---|
31 |
|
---|
32 | #define SeeedGrayOLED_Address 0x3c
|
---|
33 | #define SeeedGrayOLED_Command_Mode 0x80
|
---|
34 | #define SeeedGrayOLED_Data_Mode 0x40
|
---|
35 |
|
---|
36 | #define SeeedGrayOLED_Display_Off_Cmd 0xAE
|
---|
37 | #define SeeedGrayOLED_Display_On_Cmd 0xAF
|
---|
38 |
|
---|
39 | #define SeeedGrayOLED_Normal_Display_Cmd 0xA4
|
---|
40 | #define SeeedGrayOLED_Inverse_Display_Cmd 0xA7
|
---|
41 | #define SeeedGrayOLED_Activate_Scroll_Cmd 0x2F
|
---|
42 | #define SeeedGrayOLED_Dectivate_Scroll_Cmd 0x2E
|
---|
43 | #define SeeedGrayOLED_Set_ContrastLevel_Cmd 0x81
|
---|
44 |
|
---|
45 | #define Scroll_Left 0x00
|
---|
46 | #define Scroll_Right 0x01
|
---|
47 |
|
---|
48 | #define Scroll_2Frames 0x7
|
---|
49 | #define Scroll_3Frames 0x4
|
---|
50 | #define Scroll_4Frames 0x5
|
---|
51 | #define Scroll_5Frames 0x0
|
---|
52 | #define Scroll_25Frames 0x6
|
---|
53 | #define Scroll_64Frames 0x1
|
---|
54 | #define Scroll_128Frames 0x2
|
---|
55 | #define Scroll_256Frames 0x3
|
---|
56 |
|
---|
57 |
|
---|
58 | class SeeedGrayOLED {
|
---|
59 |
|
---|
60 | public:
|
---|
61 |
|
---|
62 | char addressingMode;
|
---|
63 |
|
---|
64 | void init(void);
|
---|
65 |
|
---|
66 | void setNormalDisplay();
|
---|
67 | void setInverseDisplay();
|
---|
68 |
|
---|
69 | void sendCommand(unsigned char command);
|
---|
70 | void sendData(unsigned char Data);
|
---|
71 | void setGrayLevel(unsigned char grayLevel);
|
---|
72 |
|
---|
73 | void setVerticalMode();
|
---|
74 | void setHorizontalMode();
|
---|
75 |
|
---|
76 | void setTextXY(unsigned char Row, unsigned char Column);
|
---|
77 | void clearDisplay();
|
---|
78 | void setContrastLevel(unsigned char ContrastLevel);
|
---|
79 | void putChar(unsigned char c);
|
---|
80 | void putString(const char *String);
|
---|
81 | unsigned char putNumber(long n);
|
---|
82 | unsigned char putFloat(float floatNumber,unsigned char decimal);
|
---|
83 | unsigned char putFloat(float floatNumber);
|
---|
84 |
|
---|
85 | void drawBitmap(unsigned char *bitmaparray,int bytes);
|
---|
86 |
|
---|
87 | void setHorizontalScrollProperties(bool direction,unsigned char startRow, unsigned char endRow,unsigned char startColumn, unsigned char endColumn, unsigned char scrollSpeed);
|
---|
88 | void activateScroll();
|
---|
89 | void deactivateScroll();
|
---|
90 |
|
---|
91 | private:
|
---|
92 |
|
---|
93 | unsigned char grayH;
|
---|
94 | unsigned char grayL;
|
---|
95 |
|
---|
96 |
|
---|
97 | };
|
---|
98 |
|
---|
99 | extern SeeedGrayOLED SeeedGrayOled; // SeeedGrayOLED object
|
---|
100 |
|
---|
101 | #endif
|
---|
102 |
|
---|
103 |
|
---|