1 /* Jim Lindblom @ SparkFun Electronics
3 * https://github.com/sparkfun/Micro_OLED_Breakout/tree/master/Firmware/Arduino/libraries/SFE_MicroOLED
6 * Emil Varughese @ Edwin Robotics Pvt. Ltd.
8 * https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/
10 * This code was heavily based around the MicroView library, written by GeekAmmo
11 * (https://github.com/geekammo/MicroView-Arduino-Library).
14 * Jack Humbert <jack.humb@gmail.com>
17 * This program is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program. If not, see <http://www.gnu.org/licenses/>.
34 void micro_oled_init(void);
36 void send_command(uint8_t command);
37 void send_data(uint8_t data);
38 void set_page_address(uint8_t address);
39 void set_column_address(uint8_t address);
40 void clear_screen(void);
41 void clear_buffer(void);
42 void send_buffer(void);
43 void draw_pixel(uint8_t x, uint8_t y, uint8_t color, uint8_t mode);
44 void draw_line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint8_t color, uint8_t mode);
45 void draw_line_hori(uint8_t x, uint8_t y, uint8_t width, uint8_t color, uint8_t mode);
46 void draw_line_vert(uint8_t x, uint8_t y, uint8_t height, bool color, uint8_t mode);
47 void draw_rect(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode);
48 void draw_rect_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode);
49 void draw_rect_filled(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode);
50 void draw_rect_filled_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode);
51 void draw_char(uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t mode, uint8_t font);
52 void draw_string(uint8_t x, uint8_t y, char * string, uint8_t color, uint8_t mode, uint8_t font);
54 #define I2C_ADDRESS_SA0_0 0b0111100
55 #ifndef I2C_ADDRESS_SA0_1
56 #define I2C_ADDRESS_SA0_1 0b0111101
58 #define I2C_COMMAND 0x00
69 #define FONTHEADERSIZE 6
77 #define WIDGETSTYLE0 0
78 #define WIDGETSTYLE1 1
79 #define WIDGETSTYLE2 2
81 #define SETCONTRAST 0x81
82 #define DISPLAYALLONRESUME 0xA4
83 #define DISPLAYALLON 0xA5
84 #define NORMALDISPLAY 0xA6
85 #define INVERTDISPLAY 0xA7
86 #define DISPLAYOFF 0xAE
87 #define DISPLAYON 0xAF
88 #define SETDISPLAYOFFSET 0xD3
89 #define SETCOMPINS 0xDA
90 #define SETVCOMDESELECT 0xDB
91 #define SETDISPLAYCLOCKDIV 0xD5
92 #define SETPRECHARGE 0xD9
93 #define SETMULTIPLEX 0xA8
94 #define SETLOWCOLUMN 0x00
95 #define SETHIGHCOLUMN 0x10
96 #define SETSTARTLINE 0x40
97 #define MEMORYMODE 0x20
98 #define COMSCANINC 0xC0
99 #define COMSCANDEC 0xC8
100 #define SEGREMAP 0xA0
101 #define CHARGEPUMP 0x8D
102 #define EXTERNALVCC 0x01
103 #define SWITCHCAPVCC 0x02
106 #define ACTIVATESCROLL 0x2F
107 #define DEACTIVATESCROLL 0x2E
108 #define SETVERTICALSCROLLAREA 0xA3
109 #define RIGHTHORIZONTALSCROLL 0x26
110 #define LEFT_HORIZONTALSCROLL 0x27
111 #define VERTICALRIGHTHORIZONTALSCROLL 0x29
112 #define VERTICALLEFTHORIZONTALSCROLL 0x2A
130 CMD_GETLCDWIDTH, //15
131 CMD_GETLCDHEIGHT, //16