1 | /*
|
---|
2 | SeeedOLED.h - SSD130x 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 SeeedOLED_data_H
|
---|
23 | #define SeeedOLED_data_H
|
---|
24 |
|
---|
25 | // SeeedOLED Instruction set addresses
|
---|
26 |
|
---|
27 | #if defined(ARDUINO) && ARDUINO >= 100
|
---|
28 | #include "Arduino.h"
|
---|
29 | #else
|
---|
30 | #include <WProgram.h>
|
---|
31 | #include "Wire.h"
|
---|
32 | #endif
|
---|
33 |
|
---|
34 |
|
---|
35 |
|
---|
36 | #define SeeedOLED_Max_X 127 //128 Pixels
|
---|
37 | #define SeeedOLED_Max_Y 63 //64 Pixels
|
---|
38 |
|
---|
39 | #define PAGE_MODE 01
|
---|
40 | #define HORIZONTAL_MODE 02
|
---|
41 |
|
---|
42 |
|
---|
43 | #define SeeedOLED_Address 0x3c
|
---|
44 | #define SeeedOLED_Command_Mode 0x80
|
---|
45 | #define SeeedOLED_Data_Mode 0x40
|
---|
46 | #define SeeedOLED_Display_Off_Cmd 0xAE
|
---|
47 | #define SeeedOLED_Display_On_Cmd 0xAF
|
---|
48 | #define SeeedOLED_Normal_Display_Cmd 0xA6
|
---|
49 | #define SeeedOLED_Inverse_Display_Cmd 0xA7
|
---|
50 | #define SeeedOLED_Activate_Scroll_Cmd 0x2F
|
---|
51 | #define SeeedOLED_Dectivate_Scroll_Cmd 0x2E
|
---|
52 | #define SeeedOLED_Set_Brightness_Cmd 0x81
|
---|
53 |
|
---|
54 | #define Scroll_Left 0x00
|
---|
55 | #define Scroll_Right 0x01
|
---|
56 |
|
---|
57 | #define Scroll_2Frames 0x7
|
---|
58 | #define Scroll_3Frames 0x4
|
---|
59 | #define Scroll_4Frames 0x5
|
---|
60 | #define Scroll_5Frames 0x0
|
---|
61 | #define Scroll_25Frames 0x6
|
---|
62 | #define Scroll_64Frames 0x1
|
---|
63 | #define Scroll_128Frames 0x2
|
---|
64 | #define Scroll_256Frames 0x3
|
---|
65 |
|
---|
66 |
|
---|
67 | class SeeedOLED {
|
---|
68 |
|
---|
69 | public:
|
---|
70 |
|
---|
71 | char addressingMode;
|
---|
72 |
|
---|
73 |
|
---|
74 | void init(void);
|
---|
75 |
|
---|
76 | void setNormalDisplay();
|
---|
77 | void setInverseDisplay();
|
---|
78 |
|
---|
79 | void sendCommand(unsigned char command);
|
---|
80 | void sendData(unsigned char Data);
|
---|
81 |
|
---|
82 | void setPageMode();
|
---|
83 | void setHorizontalMode();
|
---|
84 |
|
---|
85 | void setTextXY(unsigned char Row, unsigned char Column);
|
---|
86 | void clearDisplay();
|
---|
87 | void setBrightness(unsigned char Brightness);
|
---|
88 | void putChar(unsigned char c);
|
---|
89 | void putString(const char *String);
|
---|
90 | unsigned char putNumber(long n);
|
---|
91 | unsigned char putFloat(float floatNumber,unsigned char decimal);
|
---|
92 | unsigned char putFloat(float floatNumber);
|
---|
93 | void drawBitmap(unsigned char *bitmaparray,int bytes);
|
---|
94 |
|
---|
95 | void setHorizontalScrollProperties(bool direction,unsigned char startPage, unsigned char endPage, unsigned char scrollSpeed);
|
---|
96 | void activateScroll();
|
---|
97 | void deactivateScroll();
|
---|
98 | };
|
---|
99 |
|
---|
100 | extern SeeedOLED SeeedOled; // SeeedOLED object
|
---|
101 |
|
---|
102 | #endif
|
---|
103 |
|
---|
104 |
|
---|