├── .github
├── ISSUE_TEMPLATE.md
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ └── githubci.yml
├── .gitignore
├── Adafruit_SSD1351.cpp
├── Adafruit_SSD1351.h
├── README.md
├── examples
├── displayOnOffTest
│ └── displayOnOffTest.ino
└── test
│ └── test.ino
├── library.properties
└── license.txt
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | Thank you for opening an issue on an Adafruit Arduino library repository. To
2 | improve the speed of resolution please review the following guidelines and
3 | common troubleshooting steps below before creating the issue:
4 |
5 | - **Do not use GitHub issues for troubleshooting projects and issues.** Instead use
6 | the forums at http://forums.adafruit.com to ask questions and troubleshoot why
7 | something isn't working as expected. In many cases the problem is a common issue
8 | that you will more quickly receive help from the forum community. GitHub issues
9 | are meant for known defects in the code. If you don't know if there is a defect
10 | in the code then start with troubleshooting on the forum first.
11 |
12 | - **If following a tutorial or guide be sure you didn't miss a step.** Carefully
13 | check all of the steps and commands to run have been followed. Consult the
14 | forum if you're unsure or have questions about steps in a guide/tutorial.
15 |
16 | - **For Arduino projects check these very common issues to ensure they don't apply**:
17 |
18 | - For uploading sketches or communicating with the board make sure you're using
19 | a **USB data cable** and **not** a **USB charge-only cable**. It is sometimes
20 | very hard to tell the difference between a data and charge cable! Try using the
21 | cable with other devices or swapping to another cable to confirm it is not
22 | the problem.
23 |
24 | - **Be sure you are supplying adequate power to the board.** Check the specs of
25 | your board and plug in an external power supply. In many cases just
26 | plugging a board into your computer is not enough to power it and other
27 | peripherals.
28 |
29 | - **Double check all soldering joints and connections.** Flakey connections
30 | cause many mysterious problems. See the [guide to excellent soldering](https://learn.adafruit.com/adafruit-guide-excellent-soldering/tools) for examples of good solder joints.
31 |
32 | - **Ensure you are using an official Arduino or Adafruit board.** We can't
33 | guarantee a clone board will have the same functionality and work as expected
34 | with this code and don't support them.
35 |
36 | If you're sure this issue is a defect in the code and checked the steps above
37 | please fill in the following fields to provide enough troubleshooting information.
38 | You may delete the guideline and text above to just leave the following details:
39 |
40 | - Arduino board: **INSERT ARDUINO BOARD NAME/TYPE HERE**
41 |
42 | - Arduino IDE version (found in Arduino -> About Arduino menu): **INSERT ARDUINO
43 | VERSION HERE**
44 |
45 | - List the steps to reproduce the problem below (if possible attach a sketch or
46 | copy the sketch code in too): **LIST REPRO STEPS BELOW**
47 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | Thank you for creating a pull request to contribute to Adafruit's GitHub code!
2 | Before you open the request please review the following guidelines and tips to
3 | help it be more easily integrated:
4 |
5 | - **Describe the scope of your change--i.e. what the change does and what parts
6 | of the code were modified.** This will help us understand any risks of integrating
7 | the code.
8 |
9 | - **Describe any known limitations with your change.** For example if the change
10 | doesn't apply to a supported platform of the library please mention it.
11 |
12 | - **Please run any tests or examples that can exercise your modified code.** We
13 | strive to not break users of the code and running tests/examples helps with this
14 | process.
15 |
16 | Thank you again for contributing! We will try to test and integrate the change
17 | as soon as we can, but be aware we have many GitHub repositories to manage and
18 | can't immediately respond to every request. There is no need to bump or check in
19 | on a pull request (it will clutter the discussion of the request).
20 |
21 | Also don't be worried if the request is closed or not integrated--sometimes the
22 | priorities of Adafruit's GitHub code (education, ease of use) might not match the
23 | priorities of the pull request. Don't fret, the open source community thrives on
24 | forks and GitHub makes it easy to keep your changes in a forked repo.
25 |
26 | After reviewing the guidelines above you can delete this text from the pull request.
27 |
--------------------------------------------------------------------------------
/.github/workflows/githubci.yml:
--------------------------------------------------------------------------------
1 | name: Arduino Library CI
2 |
3 | on: [pull_request, push, repository_dispatch]
4 |
5 | jobs:
6 | build:
7 | runs-on: ubuntu-latest
8 |
9 | steps:
10 | - uses: actions/setup-python@v4
11 | with:
12 | python-version: '3.x'
13 | - uses: actions/checkout@v3
14 | - uses: actions/checkout@v3
15 | with:
16 | repository: adafruit/ci-arduino
17 | path: ci
18 |
19 | - name: pre-install
20 | run: bash ci/actions_install.sh
21 |
22 | - name: test platforms
23 | run: python3 ci/build_platform.py main_platforms
24 |
25 | - name: clang
26 | run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
27 |
28 | - name: doxygen
29 | env:
30 | GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
31 | PRETTYNAME : "Adafruit SSD1351 Arduino Library"
32 | run: bash ci/doxy_gen_and_deploy.sh
33 |
34 |
35 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Our handy .gitignore for automation ease
2 | Doxyfile*
3 | doxygen_sqlite3.db
4 | html
5 |
--------------------------------------------------------------------------------
/Adafruit_SSD1351.cpp:
--------------------------------------------------------------------------------
1 | /*!
2 | * @file Adafruit_SSD1351.cpp
3 | *
4 | * @mainpage Arduino library for color OLEDs based on SSD1351 drivers.
5 | *
6 | * @section intro_sec Introduction
7 | *
8 | * This is documentation for Adafruit's SSD1351 library for color OLED
9 | * displays: http://www.adafruit.com/category/98
10 | *
11 | * These displays use SPI to communicate. SPI requires 4 pins (MOSI, SCK,
12 | * select, data/command) and optionally a reset pin. Hardware SPI or
13 | * 'bitbang' software SPI are both supported.
14 | *
15 | * Adafruit invests time and resources providing this open source code,
16 | * please support Adafruit and open-source hardware by purchasing
17 | * products from Adafruit!
18 | *
19 | * @section dependencies Dependencies
20 | *
21 | * This library depends on Adafruit_GFX
23 | * being present on your system. Please make sure you have installed the latest
24 | * version before using this library.
25 | *
26 | * @section author Author
27 | *
28 | * Written by Limor Fried/Ladyada for Adafruit Industries, with
29 | * contributions from the open source community.
30 | *
31 | * @section license License
32 | *
33 | * BSD license, all text above must be included in any redistribution.
34 | */
35 |
36 | #include "Adafruit_SSD1351.h"
37 |
38 | #define SPI_DEFAULT_FREQ 8000000 ///< SPI default frequency
39 |
40 | /*!
41 | @brief Constructor for SSD1351 displays, using software (bitbang) SPI.
42 | @param width
43 | Display width in pixels (usu. 128)
44 | @param height
45 | Display height in pixels (usu. 128 or 96)
46 | @param cs_pin
47 | Chip-select pin (using Arduino pin numbering) for sharing the
48 | bus with other devices. Active low.
49 | @param dc_pin
50 | Data/command pin (using Arduino pin numbering), selects whether
51 | display is receiving commands (low) or data (high).
52 | @param mosi_pin
53 | MOSI (master out, slave in) pin (using Arduino pin numbering).
54 | This transfers serial data from microcontroller to display.
55 | @param sclk_pin
56 | SCLK (serial clock) pin (using Arduino pin numbering).
57 | This clocks each bit from MOSI.
58 | @param rst_pin
59 | Reset pin (using Arduino pin numbering), or -1 if not used
60 | (some displays might be wired to share the microcontroller's
61 | reset pin).
62 | @return Adafruit_SSD1351 object.
63 | @note Call the object's begin() function before use.
64 | */
65 | Adafruit_SSD1351::Adafruit_SSD1351(uint16_t width, uint16_t height,
66 | int8_t cs_pin, int8_t dc_pin,
67 | int8_t mosi_pin, int8_t sclk_pin,
68 | int8_t rst_pin)
69 | : Adafruit_SPITFT(width, height, cs_pin, dc_pin, mosi_pin, sclk_pin,
70 | rst_pin, -1) {}
71 |
72 | /*!
73 | @brief Constructor for SSD1351 displays, using native hardware SPI.
74 | @param width
75 | Display width in pixels
76 | @param height
77 | Display height in pixels
78 | @param spi
79 | Pointer to an existing SPIClass instance (e.g. &SPI, the
80 | microcontroller's primary SPI bus).
81 | @param cs_pin
82 | Chip-select pin (using Arduino pin numbering) for sharing the
83 | bus with other devices. Active low.
84 | @param dc_pin
85 | Data/command pin (using Arduino pin numbering), selects whether
86 | display is receiving commands (low) or data (high).
87 | @param rst_pin
88 | Reset pin (using Arduino pin numbering), or -1 if not used
89 | (some displays might be wired to share the microcontroller's
90 | reset pin).
91 | @return Adafruit_SSD1351 object.
92 | @note Call the object's begin() function before use.
93 | */
94 |
95 | Adafruit_SSD1351::Adafruit_SSD1351(uint16_t width, uint16_t height,
96 | SPIClass *spi, int8_t cs_pin, int8_t dc_pin,
97 | int8_t rst_pin)
98 | :
99 | #if defined(ESP8266)
100 | Adafruit_SPITFT(width, height, cs_pin, dc_pin, rst_pin) {
101 | #elif defined(__SAM3X8E__)
102 | Adafruit_SPITFT(width, height, cs_pin, dc_pin, rst_pin) {
103 | #else
104 | Adafruit_SPITFT(width, height, spi, cs_pin, dc_pin, rst_pin){
105 | #endif
106 | }
107 |
108 | /*!
109 | @brief DEPRECATED constructor for SSD1351 displays, using software
110 | (bitbang) SPI. Provided for older code to maintain
111 | compatibility with the current library. Screen size is
112 | determined by editing the SSD1351WIDTH and SSD1351HEIGHT
113 | defines in Adafruit_SSD1351.h. New code should NOT use this.
114 | @param cs_pin
115 | Chip-select pin (using Arduino pin numbering) for sharing the
116 | bus with other devices. Active low.
117 | @param dc_pin
118 | Data/command pin (using Arduino pin numbering), selects whether
119 | display is receiving commands (low) or data (high).
120 | @param mosi_pin
121 | MOSI (master out, slave in) pin (using Arduino pin numbering).
122 | This transfers serial data from microcontroller to display.
123 | @param sclk_pin
124 | SCLK (serial clock) pin (using Arduino pin numbering).
125 | This clocks each bit from MOSI.
126 | @param rst_pin
127 | Reset pin (using Arduino pin numbering), or -1 if not used
128 | (some displays might be wired to share the microcontroller's
129 | reset pin).
130 | @return Adafruit_SSD1351 object.
131 | @note Call the object's begin() function before use.
132 | */
133 | Adafruit_SSD1351::Adafruit_SSD1351(int8_t cs_pin, int8_t dc_pin,
134 | int8_t mosi_pin, int8_t sclk_pin,
135 | int8_t rst_pin)
136 | : Adafruit_SPITFT(SSD1351WIDTH, SSD1351HEIGHT, cs_pin, dc_pin, mosi_pin,
137 | sclk_pin, rst_pin, -1) {}
138 |
139 | /*!
140 | @brief DEPRECATED constructor for SSD1351 displays, using native
141 | hardware SPI. Provided for older code to maintain
142 | compatibility with the current library. Screen size is
143 | determined by editing the SSD1351WIDTH and SSD1351HEIGHT
144 | defines in Adafruit_SSD1351.h. Only the primary SPI bus is
145 | supported, and bitrate is fixed at a default. New code should
146 | NOT use this.
147 | @param cs_pin
148 | Chip-select pin (using Arduino pin numbering) for sharing the
149 | bus with other devices. Active low.
150 | @param dc_pin
151 | Data/command pin (using Arduino pin numbering), selects whether
152 | display is receiving commands (low) or data (high).
153 | @param rst_pin
154 | Reset pin (using Arduino pin numbering), or -1 if not used
155 | (some displays might be wired to share the microcontroller's
156 | reset pin).
157 | @return Adafruit_SSD1351 object.
158 | @note Call the object's begin() function before use.
159 | */
160 | Adafruit_SSD1351::Adafruit_SSD1351(int8_t cs_pin, int8_t dc_pin, int8_t rst_pin)
161 | :
162 | #if defined(ESP8266)
163 | Adafruit_SPITFT(SSD1351WIDTH, SSD1351HEIGHT, cs_pin, dc_pin, rst_pin)
164 | #else
165 | Adafruit_SPITFT(SSD1351WIDTH, SSD1351HEIGHT, &SPI, cs_pin, dc_pin,
166 | rst_pin)
167 | #endif
168 | {
169 | }
170 |
171 | /*!
172 | @brief Destructor for Adafruit_SSD1351 object.
173 | */
174 | Adafruit_SSD1351::~Adafruit_SSD1351(void) {}
175 |
176 | // INIT DISPLAY ------------------------------------------------------------
177 |
178 | static const uint8_t PROGMEM initList[] = {
179 | SSD1351_CMD_COMMANDLOCK,
180 | 1, // Set command lock, 1 arg
181 | 0x12,
182 | SSD1351_CMD_COMMANDLOCK,
183 | 1, // Set command lock, 1 arg
184 | 0xB1,
185 | SSD1351_CMD_DISPLAYOFF,
186 | 0, // Display off, no args
187 | SSD1351_CMD_CLOCKDIV,
188 | 1,
189 | 0xF1, // 7:4 = Oscillator Freq, 3:0 = CLK Div Ratio (A[3:0]+1 = 1..16)
190 | SSD1351_CMD_MUXRATIO,
191 | 1,
192 | 127,
193 | SSD1351_CMD_DISPLAYOFFSET,
194 | 1,
195 | 0x0,
196 | SSD1351_CMD_SETGPIO,
197 | 1,
198 | 0x00,
199 | SSD1351_CMD_FUNCTIONSELECT,
200 | 1,
201 | 0x01, // internal (diode drop)
202 | SSD1351_CMD_PRECHARGE,
203 | 1,
204 | 0x32,
205 | SSD1351_CMD_VCOMH,
206 | 1,
207 | 0x05,
208 | SSD1351_CMD_NORMALDISPLAY,
209 | 0,
210 | SSD1351_CMD_CONTRASTABC,
211 | 3,
212 | 0xC8,
213 | 0x80,
214 | 0xC8,
215 | SSD1351_CMD_CONTRASTMASTER,
216 | 1,
217 | 0x0F,
218 | SSD1351_CMD_SETVSL,
219 | 3,
220 | 0xA0,
221 | 0xB5,
222 | 0x55,
223 | SSD1351_CMD_PRECHARGE2,
224 | 1,
225 | 0x01,
226 | SSD1351_CMD_DISPLAYON,
227 | 0, // Main screen turn on
228 | 0}; // END OF COMMAND LIST
229 |
230 | /*!
231 | @brief Initialize SSD1351 chip. Configures pins, connects to the
232 | SSD1351 and sends initialization commands.
233 | @param freq
234 | SPI bitrate -- default of 0 will use a (usually) platform-
235 | optimized value, e.g. 8 MHz on AVR, 12 MHz on M0.
236 | @return None (void).
237 | */
238 | void Adafruit_SSD1351::begin(uint32_t freq) {
239 |
240 | if (!freq)
241 | freq = SPI_DEFAULT_FREQ; // Will move to SPITFT initSPI
242 | initSPI(freq);
243 |
244 | const uint8_t *addr = (const uint8_t *)initList;
245 | uint8_t cmd, x, numArgs;
246 |
247 | while ((cmd = pgm_read_byte(addr++)) > 0) { // '0' command ends list
248 | x = pgm_read_byte(addr++);
249 | numArgs = x & 0x7F;
250 | if (cmd != 0xFF) { // '255' is ignored
251 | sendCommand(cmd, addr, numArgs);
252 | }
253 | addr += numArgs;
254 | }
255 | setRotation(0);
256 | }
257 |
258 | // GFX FUNCTIONS -----------------------------------------------------------
259 |
260 | /*!
261 | @brief Set origin of (0,0) and orientation of OLED display
262 | @param r
263 | The index for rotation, from 0-3 inclusive
264 | @return None (void).
265 | @note SSD1351 works differently than most (all?) other SPITFT
266 | displays. With certain rotation changes the screen contents
267 | may change immediately into a peculiar format (mirrored, not
268 | necessarily rotated) (other displays, this only affects new
269 | drawing -- rotation combinations can apply to different
270 | areas). Therefore, it's recommend to clear the screen
271 | (fillScreen(0)) before changing rotation.
272 | */
273 | void Adafruit_SSD1351::setRotation(uint8_t r) {
274 | // madctl bits:
275 | // 6,7 Color depth (01 = 64K)
276 | // 5 Odd/even split COM (0: disable, 1: enable)
277 | // 4 Scan direction (0: top-down, 1: bottom-up)
278 | // 3 Reserved
279 | // 2 Color remap (0: A->B->C, 1: C->B->A)
280 | // 1 Column remap (0: 0-127, 1: 127-0)
281 | // 0 Address increment (0: horizontal, 1: vertical)
282 | uint8_t madctl = 0b01100100; // 64K, enable split, CBA
283 |
284 | rotation = r & 3; // Clip input to valid range
285 |
286 | switch (rotation) {
287 | case 0:
288 | madctl |= 0b00010000; // Scan bottom-up
289 | _width = WIDTH;
290 | _height = HEIGHT;
291 | break;
292 | case 1:
293 | madctl |= 0b00010011; // Scan bottom-up, column remap 127-0, vertical
294 | _width = HEIGHT;
295 | _height = WIDTH;
296 | break;
297 | case 2:
298 | madctl |= 0b00000010; // Column remap 127-0
299 | _width = WIDTH;
300 | _height = HEIGHT;
301 | break;
302 | case 3:
303 | madctl |= 0b00000001; // Vertical
304 | _width = HEIGHT;
305 | _height = WIDTH;
306 | break;
307 | }
308 |
309 | sendCommand(SSD1351_CMD_SETREMAP, &madctl, 1);
310 | uint8_t startline = (rotation < 2) ? HEIGHT : 0;
311 | sendCommand(SSD1351_CMD_STARTLINE, &startline, 1);
312 | }
313 |
314 | /*!
315 | @brief Enable/Disable display color inversion
316 | @param i
317 | True to invert display, False for normal color.
318 | @return None (void).
319 | @note This syntax is used by other SPITFT compatible libraries.
320 | New code should use this.
321 | */
322 | void Adafruit_SSD1351::invertDisplay(boolean i) {
323 | sendCommand(i ? SSD1351_CMD_INVERTDISPLAY : SSD1351_CMD_NORMALDISPLAY);
324 | }
325 |
326 | /*!
327 | @brief Enable/Disable display color inversion
328 | @param i
329 | True to invert display, False for normal color.
330 | @return None (void).
331 | @note This is an older syntax used by this library prior to the
332 | SPITFT library. New code should avoid it.
333 | */
334 | void Adafruit_SSD1351::invert(boolean i) { invertDisplay(i); }
335 |
336 | #define ssd1351_swap(a, b) \
337 | (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b))) ///< No-temp-var swap operation
338 |
339 | /*!
340 | @brief Set the "address window" - the rectangle we will write to
341 | graphics RAM with the next chunk of SPI data writes. The
342 | SSD1351 will automatically wrap the data as each row is filled.
343 | @param x1
344 | Leftmost column of rectangle (screen pixel coordinates).
345 | @param y1
346 | Topmost row of rectangle (screen pixel coordinates).
347 | @param w
348 | Width of rectangle.
349 | @param h
350 | Height of rectangle.
351 | @return None (void).
352 | */
353 | void Adafruit_SSD1351::setAddrWindow(uint16_t x1, uint16_t y1, uint16_t w,
354 | uint16_t h) {
355 |
356 | uint16_t x2 = x1 + w - 1, y2 = y1 + h - 1;
357 | if (rotation & 1) { // Vertical address increment mode
358 | ssd1351_swap(x1, y1);
359 | ssd1351_swap(x2, y2);
360 | }
361 | writeCommand(SSD1351_CMD_SETCOLUMN); // X range
362 | spiWrite(x1);
363 | spiWrite(x2);
364 | writeCommand(SSD1351_CMD_SETROW); // Y range
365 | spiWrite(y1);
366 | spiWrite(y2);
367 | writeCommand(SSD1351_CMD_WRITERAM); // Begin write
368 | }
369 |
370 | /**************************************************************************/
371 | /*!
372 | @brief Change whether display is on or off
373 | @param enable True if you want the display ON, false OFF
374 | */
375 | /**************************************************************************/
376 | void Adafruit_SSD1351::enableDisplay(boolean enable) {
377 | sendCommand(enable ? SSD1351_CMD_DISPLAYON : SSD1351_CMD_DISPLAYOFF);
378 | }
379 |
--------------------------------------------------------------------------------
/Adafruit_SSD1351.h:
--------------------------------------------------------------------------------
1 | /*!
2 | * @file Adafruit_SSD1351.h
3 | *
4 | * This is the documentation for Adafruit's SSD1351 driver for the
5 | * Arduino platform.
6 | *
7 | * This library works with the Adafruit 1.5" color OLED:
8 | * http://www.adafruit.com/products/1431
9 | * and 1.27" color OLED:
10 | * http://www.adafruit.com/products/1673
11 | *
12 | * These displays use SPI to communicate. SPI requires 4 pins (MOSI, SCK,
13 | * select, data/command) and optionally a reset pin. Hardware SPI or
14 | * 'bitbang' software SPI are both supported.
15 | *
16 | * Adafruit invests time and resources providing this open source code,
17 | * please support Adafruit and open-source hardware by purchasing
18 | * products from Adafruit!
19 | *
20 | * This library depends on
21 | * Adafruit_GFX being present on your system. Please make sure you have
22 | * installed the latest version before using this library.
23 | *
24 | * Written by Limor Fried/Ladyada for Adafruit Industries, with
25 | * contributions from the open source community.
26 | *
27 | * BSD license, all text above must be included in any redistribution.
28 | */
29 |
30 | #ifndef _Adafruit_SSD1351_H_
31 | #define _Adafruit_SSD1351_H_
32 |
33 | #include
34 |
35 | // These #defines are DEPRECATED but present for older code compatibility:
36 | #define SSD1351WIDTH 128 ///< DEPRECATED screen width
37 | #define SSD1351HEIGHT 128 ///< DEPRECATED screen height, set to 96 for 1.27"
38 | // (NEW CODE SHOULD IGNORE THIS, USE THE CONSTRUCTORS THAT ACCEPT WIDTH
39 | // AND HEIGHT ARGUMENTS).
40 |
41 | #define SSD1351_CMD_SETCOLUMN 0x15 ///< See datasheet
42 | #define SSD1351_CMD_SETROW 0x75 ///< See datasheet
43 | #define SSD1351_CMD_WRITERAM 0x5C ///< See datasheet
44 | #define SSD1351_CMD_READRAM 0x5D ///< Not currently used
45 | #define SSD1351_CMD_SETREMAP 0xA0 ///< See datasheet
46 | #define SSD1351_CMD_STARTLINE 0xA1 ///< See datasheet
47 | #define SSD1351_CMD_DISPLAYOFFSET 0xA2 ///< See datasheet
48 | #define SSD1351_CMD_DISPLAYALLOFF 0xA4 ///< Not currently used
49 | #define SSD1351_CMD_DISPLAYALLON 0xA5 ///< Not currently used
50 | #define SSD1351_CMD_NORMALDISPLAY 0xA6 ///< See datasheet
51 | #define SSD1351_CMD_INVERTDISPLAY 0xA7 ///< See datasheet
52 | #define SSD1351_CMD_FUNCTIONSELECT 0xAB ///< See datasheet
53 | #define SSD1351_CMD_DISPLAYOFF 0xAE ///< See datasheet
54 | #define SSD1351_CMD_DISPLAYON 0xAF ///< See datasheet
55 | #define SSD1351_CMD_PRECHARGE 0xB1 ///< See datasheet
56 | #define SSD1351_CMD_DISPLAYENHANCE 0xB2 ///< Not currently used
57 | #define SSD1351_CMD_CLOCKDIV 0xB3 ///< See datasheet
58 | #define SSD1351_CMD_SETVSL 0xB4 ///< See datasheet
59 | #define SSD1351_CMD_SETGPIO 0xB5 ///< See datasheet
60 | #define SSD1351_CMD_PRECHARGE2 0xB6 ///< See datasheet
61 | #define SSD1351_CMD_SETGRAY 0xB8 ///< Not currently used
62 | #define SSD1351_CMD_USELUT 0xB9 ///< Not currently used
63 | #define SSD1351_CMD_PRECHARGELEVEL 0xBB ///< Not currently used
64 | #define SSD1351_CMD_VCOMH 0xBE ///< See datasheet
65 | #define SSD1351_CMD_CONTRASTABC 0xC1 ///< See datasheet
66 | #define SSD1351_CMD_CONTRASTMASTER 0xC7 ///< See datasheet
67 | #define SSD1351_CMD_MUXRATIO 0xCA ///< See datasheet
68 | #define SSD1351_CMD_COMMANDLOCK 0xFD ///< See datasheet
69 | #define SSD1351_CMD_HORIZSCROLL 0x96 ///< Not currently used
70 | #define SSD1351_CMD_STOPSCROLL 0x9E ///< Not currently used
71 | #define SSD1351_CMD_STARTSCROLL 0x9F ///< Not currently used
72 |
73 | /*!
74 | @brief Class that stores state and functions for interacting with
75 | SSD1351 OLED displays.
76 | */
77 | class Adafruit_SSD1351 : public Adafruit_SPITFT {
78 | public:
79 | // NEW CONSTRUCTORS -- recommended for new projects
80 | // 6-7 args using soft SPI (reset optional)
81 | Adafruit_SSD1351(uint16_t width, uint16_t height, int8_t cs_pin,
82 | int8_t dc_pin, int8_t mosi_pin, int8_t sclk_pin,
83 | int8_t rst_pin = -1);
84 | // 5-6 args using hardware SPI (must specify peripheral) (reset optional)
85 | Adafruit_SSD1351(uint16_t width, uint16_t height, SPIClass *spi,
86 | int8_t cs_pin, int8_t dc_pin, int8_t rst_pin = -1);
87 |
88 | // DEPRECATED CONSTRUCTORS for back compatibility, avoid in new projects
89 | // 4-5 args using soft SPI (reset optional)
90 | Adafruit_SSD1351(int8_t cs_pin, int8_t dc_pin, int8_t mosi_pin,
91 | int8_t sclk_pin, int8_t rst_pin = -1);
92 | // 2-3 args using default hardware SPI peripheral (reset optional)
93 | Adafruit_SSD1351(int8_t cs_pin, int8_t dc_pin, int8_t rst_pin = -1);
94 |
95 | ~Adafruit_SSD1351(void);
96 |
97 | void begin(uint32_t freq = 0), setRotation(uint8_t r),
98 | invertDisplay(boolean i), // Preferred syntax (same as other screens)
99 | invert(boolean i), // For compatibility with old code
100 | enableDisplay(boolean enable),
101 | setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
102 | };
103 |
104 | #endif // _Adafruit_SSD1351_H_
105 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Adafruit-SSD1351-library [](https://github.com/adafruit/Adafruit-SSD1351-library/actions)[](http://adafruit.github.io/Adafruit-SSD1351-library/html/index.html)
2 |
3 | This is a library for the Adafruit SSD1351 OLED display products:
4 |
5 | * http://www.adafruit.com/products/1431
6 | * http://www.adafruit.com/products/1673
7 |
8 | Check out the links above for our tutorials and wiring diagrams. These displays use SPI to communicate, 4 or 5 pins are required to interface (RST is optional).
9 |
10 | Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!
11 |
12 | Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information. All text above must be included in any redistribution.
13 |
14 | To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder Adafruit_SSD1351. Check that the Adafruit_SSD1351 folder contains Adafruit_SSD1351.cpp and Adafruit_SSD1351.
15 |
16 | Place the Adafruit_SSD1351 library folder your arduinosketchfolder/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE
17 |
18 | Also requires the Adafruit_GFX library for Arduino.
19 |
--------------------------------------------------------------------------------
/examples/displayOnOffTest/displayOnOffTest.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * This is an example sketch that shows how to toggle the SSD1331 OLED display
3 | * on and off at runtime to avoid screen burn-in.
4 | *
5 | * The sketch also demonstrates how to erase a previous value by re-drawing the
6 | * older value in the screen background color prior to writing a new value in
7 | * the same location. This avoids the need to call fillScreen() to erase the
8 | * entire screen followed by a complete redraw of screen contents.
9 | *
10 | * Written by Phill Kelley. BSD license.
11 | */
12 |
13 | #include
14 | #include
15 | #include
16 | #include
17 |
18 | #define SerialDebugging true
19 |
20 | // Screen dimensions
21 | #define SCREEN_WIDTH 128
22 | #define SCREEN_HEIGHT 128 // Change this to 96 for 1.27" OLED.
23 |
24 | // The SSD1351 is connected like this (plus VCC plus GND)
25 | const uint8_t OLED_pin_scl_sck = 13;
26 | const uint8_t OLED_pin_sda_mosi = 11;
27 | const uint8_t OLED_pin_cs_ss = 10;
28 | const uint8_t OLED_pin_res_rst = 9;
29 | const uint8_t OLED_pin_dc_rs = 8;
30 |
31 | // connect a push button to ...
32 | const uint8_t Button_pin = 2;
33 |
34 | // SSD1331 color definitions
35 | const uint16_t OLED_Color_Black = 0x0000;
36 | const uint16_t OLED_Color_Blue = 0x001F;
37 | const uint16_t OLED_Color_Red = 0xF800;
38 | const uint16_t OLED_Color_Green = 0x07E0;
39 | const uint16_t OLED_Color_Cyan = 0x07FF;
40 | const uint16_t OLED_Color_Magenta = 0xF81F;
41 | const uint16_t OLED_Color_Yellow = 0xFFE0;
42 | const uint16_t OLED_Color_White = 0xFFFF;
43 |
44 | // The colors we actually want to use
45 | uint16_t OLED_Text_Color = OLED_Color_Black;
46 | uint16_t OLED_Backround_Color = OLED_Color_Blue;
47 |
48 | // declare the display
49 | Adafruit_SSD1351 oled =
50 | Adafruit_SSD1351(
51 | SCREEN_WIDTH,
52 | SCREEN_HEIGHT,
53 | &SPI,
54 | OLED_pin_cs_ss,
55 | OLED_pin_dc_rs,
56 | OLED_pin_res_rst
57 | );
58 |
59 | // assume the display is off until configured in setup()
60 | bool isDisplayVisible = false;
61 |
62 | // declare size of working string buffers. Basic strlen("d hh:mm:ss") = 10
63 | const size_t MaxString = 16;
64 |
65 | // the string being displayed on the SSD1331 (initially empty)
66 | char oldTimeString[MaxString] = { 0 };
67 |
68 | // the interrupt service routine affects this
69 | volatile bool isButtonPressed = false;
70 |
71 |
72 | // interrupt service routine
73 | void senseButtonPressed() {
74 | if (!isButtonPressed) {
75 | isButtonPressed = true;
76 | }
77 | }
78 |
79 |
80 | void displayUpTime() {
81 |
82 | // calculate seconds, truncated to the nearest whole second
83 | unsigned long upSeconds = millis() / 1000;
84 |
85 | // calculate days, truncated to nearest whole day
86 | unsigned long days = upSeconds / 86400;
87 |
88 | // the remaining hhmmss are
89 | upSeconds = upSeconds % 86400;
90 |
91 | // calculate hours, truncated to the nearest whole hour
92 | unsigned long hours = upSeconds / 3600;
93 |
94 | // the remaining mmss are
95 | upSeconds = upSeconds % 3600;
96 |
97 | // calculate minutes, truncated to the nearest whole minute
98 | unsigned long minutes = upSeconds / 60;
99 |
100 | // the remaining ss are
101 | upSeconds = upSeconds % 60;
102 |
103 | // allocate a buffer
104 | char newTimeString[MaxString] = { 0 };
105 |
106 | // construct the string representation
107 | sprintf(
108 | newTimeString,
109 | "%lu %02lu:%02lu:%02lu",
110 | days, hours, minutes, upSeconds
111 | );
112 |
113 | // has the time string changed since the last oled update?
114 | if (strcmp(newTimeString,oldTimeString) != 0) {
115 |
116 | // yes! home the cursor
117 | oled.setCursor(0,0);
118 |
119 | // change the text color to the background color
120 | oled.setTextColor(OLED_Backround_Color);
121 |
122 | // redraw the old value to erase
123 | oled.print(oldTimeString);
124 |
125 | // home the cursor
126 | oled.setCursor(0,0);
127 |
128 | // change the text color to foreground color
129 | oled.setTextColor(OLED_Text_Color);
130 |
131 | // draw the new time value
132 | oled.print(newTimeString);
133 |
134 | // and remember the new value
135 | strcpy(oldTimeString,newTimeString);
136 |
137 | }
138 |
139 | }
140 |
141 |
142 | void setup() {
143 |
144 | // button press pulls pin LOW so configure HIGH
145 | pinMode(Button_pin,INPUT_PULLUP);
146 |
147 | // use an interrupt to sense when the button is pressed
148 | attachInterrupt(digitalPinToInterrupt(Button_pin), senseButtonPressed, FALLING);
149 |
150 | #if (SerialDebugging)
151 | Serial.begin(115200); while (!Serial); Serial.println();
152 | #endif
153 |
154 | // settling time
155 | delay(250);
156 |
157 | // ignore any power-on-reboot garbage
158 | isButtonPressed = false;
159 |
160 | // initialise the SSD1331
161 | oled.begin();
162 | oled.setFont();
163 | oled.fillScreen(OLED_Backround_Color);
164 | oled.setTextColor(OLED_Text_Color);
165 | oled.setTextSize(1);
166 |
167 | // the display is now on
168 | isDisplayVisible = true;
169 |
170 | }
171 |
172 |
173 | void loop() {
174 |
175 | // unconditional display, regardless of whether display is visible
176 | displayUpTime();
177 |
178 | // has the button been pressed?
179 | if (isButtonPressed) {
180 |
181 | // yes! toggle display visibility
182 | isDisplayVisible = !isDisplayVisible;
183 |
184 | // apply
185 | oled.enableDisplay(isDisplayVisible);
186 |
187 | #if (SerialDebugging)
188 | Serial.print("button pressed @ ");
189 | Serial.print(millis());
190 | Serial.print(", display is now ");
191 | Serial.println((isDisplayVisible ? "ON" : "OFF"));
192 | #endif
193 |
194 | // confirm button handled
195 | isButtonPressed = false;
196 |
197 | }
198 |
199 | // no need to be in too much of a hurry
200 | delay(100);
201 |
202 | }
203 |
--------------------------------------------------------------------------------
/examples/test/test.ino:
--------------------------------------------------------------------------------
1 | /***************************************************
2 | This is a example sketch demonstrating graphic drawing
3 | capabilities of the SSD1351 library for the 1.5"
4 | and 1.27" 16-bit Color OLEDs with SSD1351 driver chip
5 |
6 | Pick one up today in the adafruit shop!
7 | ------> http://www.adafruit.com/products/1431
8 | ------> http://www.adafruit.com/products/1673
9 |
10 | If you're using a 1.27" OLED, change SCREEN_HEIGHT to 96 instead of 128.
11 |
12 | These displays use SPI to communicate, 4 or 5 pins are required to
13 | interface
14 | Adafruit invests time and resources providing this open source code,
15 | please support Adafruit and open-source hardware by purchasing
16 | products from Adafruit!
17 |
18 | Written by Limor Fried/Ladyada for Adafruit Industries.
19 | BSD license, all text above must be included in any redistribution
20 |
21 | The Adafruit GFX Graphics core library is also required
22 | https://github.com/adafruit/Adafruit-GFX-Library
23 | Be sure to install it!
24 | ****************************************************/
25 |
26 | // Screen dimensions
27 | #define SCREEN_WIDTH 128
28 | #define SCREEN_HEIGHT 128 // Change this to 96 for 1.27" OLED.
29 |
30 | // You can use any (4 or) 5 pins
31 | #define SCLK_PIN 2
32 | #define MOSI_PIN 3
33 | #define DC_PIN 4
34 | #define CS_PIN 5
35 | #define RST_PIN 6
36 |
37 | // Color definitions
38 | #define BLACK 0x0000
39 | #define BLUE 0x001F
40 | #define RED 0xF800
41 | #define GREEN 0x07E0
42 | #define CYAN 0x07FF
43 | #define MAGENTA 0xF81F
44 | #define YELLOW 0xFFE0
45 | #define WHITE 0xFFFF
46 |
47 | #include
48 | #include
49 | #include
50 |
51 | // Option 1: use any pins but a little slower
52 | Adafruit_SSD1351 tft = Adafruit_SSD1351(SCREEN_WIDTH, SCREEN_HEIGHT, CS_PIN, DC_PIN, MOSI_PIN, SCLK_PIN, RST_PIN);
53 |
54 | // Option 2: must use the hardware SPI pins
55 | // (for UNO thats sclk = 13 and sid = 11) and pin 10 must be
56 | // an output. This is much faster - also required if you want
57 | // to use the microSD card (see the image drawing example)
58 | //Adafruit_SSD1351 tft = Adafruit_SSD1351(SCREEN_WIDTH, SCREEN_HEIGHT, &SPI, CS_PIN, DC_PIN, RST_PIN);
59 |
60 | float p = 3.1415926;
61 |
62 | void setup(void) {
63 | Serial.begin(9600);
64 | Serial.print("hello!");
65 | tft.begin();
66 |
67 | Serial.println("init");
68 |
69 | // You can optionally rotate the display by running the line below.
70 | // Note that a value of 0 means no rotation, 1 means 90 clockwise,
71 | // 2 means 180 degrees clockwise, and 3 means 270 degrees clockwise.
72 | //tft.setRotation(1);
73 | // NOTE: The test pattern at the start will NOT be rotated! The code
74 | // for rendering the test pattern talks directly to the display and
75 | // ignores any rotation.
76 |
77 | uint16_t time = millis();
78 | tft.fillRect(0, 0, 128, 128, BLACK);
79 | time = millis() - time;
80 |
81 | Serial.println(time, DEC);
82 | delay(500);
83 |
84 | lcdTestPattern();
85 | delay(500);
86 |
87 | tft.invert(true);
88 | delay(100);
89 | tft.invert(false);
90 | delay(100);
91 |
92 | tft.fillScreen(BLACK);
93 | testdrawtext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur adipiscing ante sed nibh tincidunt feugiat. Maecenas enim massa, fringilla sed malesuada et, malesuada sit amet turpis. Sed porttitor neque ut ante pretium vitae malesuada nunc bibendum. Nullam aliquet ultrices massa eu hendrerit. Ut sed nisi lorem. In vestibulum purus a tortor imperdiet posuere. ", WHITE);
94 | delay(500);
95 |
96 | // tft print function!
97 | tftPrintTest();
98 | delay(500);
99 |
100 | //a single pixel
101 | tft.drawPixel(tft.width()/2, tft.height()/2, GREEN);
102 | delay(500);
103 |
104 | // line draw test
105 | testlines(YELLOW);
106 | delay(500);
107 |
108 | // optimized lines
109 | testfastlines(RED, BLUE);
110 | delay(500);
111 |
112 |
113 | testdrawrects(GREEN);
114 | delay(1000);
115 |
116 | testfillrects(YELLOW, MAGENTA);
117 | delay(1000);
118 |
119 | tft.fillScreen(BLACK);
120 | testfillcircles(10, BLUE);
121 | testdrawcircles(10, WHITE);
122 | delay(1000);
123 |
124 | testroundrects();
125 | delay(500);
126 |
127 | testtriangles();
128 | delay(500);
129 |
130 | Serial.println("done");
131 | delay(1000);
132 | }
133 |
134 | void loop() {
135 | }
136 |
137 | void testlines(uint16_t color) {
138 | tft.fillScreen(BLACK);
139 | for (uint16_t x=0; x < tft.width()-1; x+=6) {
140 | tft.drawLine(0, 0, x, tft.height()-1, color);
141 | }
142 | for (uint16_t y=0; y < tft.height()-1; y+=6) {
143 | tft.drawLine(0, 0, tft.width()-1, y, color);
144 | }
145 |
146 | tft.fillScreen(BLACK);
147 | for (uint16_t x=0; x < tft.width()-1; x+=6) {
148 | tft.drawLine(tft.width()-1, 0, x, tft.height()-1, color);
149 | }
150 | for (uint16_t y=0; y < tft.height()-1; y+=6) {
151 | tft.drawLine(tft.width()-1, 0, 0, y, color);
152 | }
153 |
154 | tft.fillScreen(BLACK);
155 | for (uint16_t x=0; x < tft.width()-1; x+=6) {
156 | tft.drawLine(0, tft.height()-1, x, 0, color);
157 | }
158 | for (uint16_t y=0; y < tft.height()-1; y+=6) {
159 | tft.drawLine(0, tft.height()-1, tft.width()-1, y, color);
160 | }
161 |
162 | tft.fillScreen(BLACK);
163 | for (uint16_t x=0; x < tft.width()-1; x+=6) {
164 | tft.drawLine(tft.width()-1, tft.height()-1, x, 0, color);
165 | }
166 | for (uint16_t y=0; y < tft.height()-1; y+=6) {
167 | tft.drawLine(tft.width()-1, tft.height()-1, 0, y, color);
168 | }
169 |
170 | }
171 |
172 | void testdrawtext(char *text, uint16_t color) {
173 | tft.setCursor(0,0);
174 | tft.setTextColor(color);
175 | tft.print(text);
176 | }
177 |
178 | void testfastlines(uint16_t color1, uint16_t color2) {
179 | tft.fillScreen(BLACK);
180 | for (uint16_t y=0; y < tft.height()-1; y+=5) {
181 | tft.drawFastHLine(0, y, tft.width()-1, color1);
182 | }
183 | for (uint16_t x=0; x < tft.width()-1; x+=5) {
184 | tft.drawFastVLine(x, 0, tft.height()-1, color2);
185 | }
186 | }
187 |
188 | void testdrawrects(uint16_t color) {
189 | tft.fillScreen(BLACK);
190 | for (uint16_t x=0; x < tft.height()-1; x+=6) {
191 | tft.drawRect((tft.width()-1)/2 -x/2, (tft.height()-1)/2 -x/2 , x, x, color);
192 | }
193 | }
194 |
195 | void testfillrects(uint16_t color1, uint16_t color2) {
196 | tft.fillScreen(BLACK);
197 | for (uint16_t x=tft.height()-1; x > 6; x-=6) {
198 | tft.fillRect((tft.width()-1)/2 -x/2, (tft.height()-1)/2 -x/2 , x, x, color1);
199 | tft.drawRect((tft.width()-1)/2 -x/2, (tft.height()-1)/2 -x/2 , x, x, color2);
200 | }
201 | }
202 |
203 | void testfillcircles(uint8_t radius, uint16_t color) {
204 | for (uint8_t x=radius; x < tft.width()-1; x+=radius*2) {
205 | for (uint8_t y=radius; y < tft.height()-1; y+=radius*2) {
206 | tft.fillCircle(x, y, radius, color);
207 | }
208 | }
209 | }
210 |
211 | void testdrawcircles(uint8_t radius, uint16_t color) {
212 | for (uint8_t x=0; x < tft.width()-1+radius; x+=radius*2) {
213 | for (uint8_t y=0; y < tft.height()-1+radius; y+=radius*2) {
214 | tft.drawCircle(x, y, radius, color);
215 | }
216 | }
217 | }
218 |
219 | void testtriangles() {
220 | tft.fillScreen(BLACK);
221 | int color = 0xF800;
222 | int t;
223 | int w = tft.width()/2;
224 | int x = tft.height();
225 | int y = 0;
226 | int z = tft.width();
227 | for(t = 0 ; t <= 15; t+=1) {
228 | tft.drawTriangle(w, y, y, x, z, x, color);
229 | x-=4;
230 | y+=4;
231 | z-=4;
232 | color+=100;
233 | }
234 | }
235 |
236 | void testroundrects() {
237 | tft.fillScreen(BLACK);
238 | int color = 100;
239 |
240 | int x = 0;
241 | int y = 0;
242 | int w = tft.width();
243 | int h = tft.height();
244 | for(int i = 0 ; i <= 24; i++) {
245 | tft.drawRoundRect(x, y, w, h, 5, color);
246 | x+=2;
247 | y+=3;
248 | w-=4;
249 | h-=6;
250 | color+=1100;
251 | Serial.println(i);
252 | }
253 | }
254 |
255 | void tftPrintTest() {
256 | tft.fillScreen(BLACK);
257 | tft.setCursor(0, 5);
258 | tft.setTextColor(RED);
259 | tft.setTextSize(1);
260 | tft.println("Hello World!");
261 | tft.setTextColor(YELLOW);
262 | tft.setTextSize(2);
263 | tft.println("Hello World!");
264 | tft.setTextColor(BLUE);
265 | tft.setTextSize(3);
266 | tft.print(1234.567);
267 | delay(1500);
268 | tft.setCursor(0, 5);
269 | tft.fillScreen(BLACK);
270 | tft.setTextColor(WHITE);
271 | tft.setTextSize(0);
272 | tft.println("Hello World!");
273 | tft.setTextSize(1);
274 | tft.setTextColor(GREEN);
275 | tft.print(p, 6);
276 | tft.println(" Want pi?");
277 | tft.println(" ");
278 | tft.print(8675309, HEX); // print 8,675,309 out in HEX!
279 | tft.println(" Print HEX!");
280 | tft.println(" ");
281 | tft.setTextColor(WHITE);
282 | tft.println("Sketch has been");
283 | tft.println("running for: ");
284 | tft.setTextColor(MAGENTA);
285 | tft.print(millis() / 1000);
286 | tft.setTextColor(WHITE);
287 | tft.print(" seconds.");
288 | }
289 |
290 | void mediabuttons() {
291 | // play
292 | tft.fillScreen(BLACK);
293 | tft.fillRoundRect(25, 10, 78, 60, 8, WHITE);
294 | tft.fillTriangle(42, 20, 42, 60, 90, 40, RED);
295 | delay(500);
296 | // pause
297 | tft.fillRoundRect(25, 90, 78, 60, 8, WHITE);
298 | tft.fillRoundRect(39, 98, 20, 45, 5, GREEN);
299 | tft.fillRoundRect(69, 98, 20, 45, 5, GREEN);
300 | delay(500);
301 | // play color
302 | tft.fillTriangle(42, 20, 42, 60, 90, 40, BLUE);
303 | delay(50);
304 | // pause color
305 | tft.fillRoundRect(39, 98, 20, 45, 5, RED);
306 | tft.fillRoundRect(69, 98, 20, 45, 5, RED);
307 | // play color
308 | tft.fillTriangle(42, 20, 42, 60, 90, 40, GREEN);
309 | }
310 |
311 | /**************************************************************************/
312 | /*!
313 | @brief Renders a simple test pattern on the screen
314 | */
315 | /**************************************************************************/
316 | void lcdTestPattern(void)
317 | {
318 | static const uint16_t PROGMEM colors[] =
319 | { RED, YELLOW, GREEN, CYAN, BLUE, MAGENTA, BLACK, WHITE };
320 |
321 | for(uint8_t c=0; c<8; c++) {
322 | tft.fillRect(0, tft.height() * c / 8, tft.width(), tft.height() / 8,
323 | pgm_read_word(&colors[c]));
324 | }
325 | }
326 |
--------------------------------------------------------------------------------
/library.properties:
--------------------------------------------------------------------------------
1 | name=Adafruit SSD1351 library
2 | version=1.3.2
3 | author=Adafruit
4 | maintainer=Adafruit
5 | sentence=Adafruit library for the 1.27" and 1.5" color OLEDs in the shop
6 | paragraph=Adafruit library for the 1.27" and 1.5" color OLEDs in the shop
7 | category=Display
8 | url=https://github.com/adafruit/Adafruit-SSD1351-library
9 | architectures=*
10 | depends=Adafruit ILI9341, Adafruit GFX Library, Adafruit BusIO
11 |
--------------------------------------------------------------------------------
/license.txt:
--------------------------------------------------------------------------------
1 | Software License Agreement (BSD License)
2 |
3 | Copyright (c) 2012, Adafruit Industries
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 | 1. Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 | 2. Redistributions in binary form must reproduce the above copyright
11 | notice, this list of conditions and the following disclaimer in the
12 | documentation and/or other materials provided with the distribution.
13 | 3. Neither the name of the copyright holders nor the
14 | names of its contributors may be used to endorse or promote products
15 | derived from this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
18 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 |
--------------------------------------------------------------------------------