First init.
This commit is contained in:
177
libraries/Adafruit_SH110X/Adafruit_SH1106G.cpp
Normal file
177
libraries/Adafruit_SH110X/Adafruit_SH1106G.cpp
Normal file
@@ -0,0 +1,177 @@
|
||||
/*!
|
||||
* @file Adafruit_SH1106G.cpp
|
||||
*
|
||||
*/
|
||||
|
||||
#include "Adafruit_SH110X.h"
|
||||
#include "splash.h"
|
||||
|
||||
// CONSTRUCTORS, DESTRUCTOR ------------------------------------------------
|
||||
|
||||
/*!
|
||||
@brief Constructor for I2C-interfaced SH1106G displays.
|
||||
@param w
|
||||
Display width in pixels
|
||||
@param h
|
||||
Display height in pixels
|
||||
@param twi
|
||||
Pointer to an existing TwoWire instance (e.g. &Wire, the
|
||||
microcontroller's primary I2C bus).
|
||||
@param rst_pin
|
||||
Reset pin (using Arduino pin numbering), or -1 if not used
|
||||
(some displays might be wired to share the microcontroller's
|
||||
reset pin).
|
||||
@param clkDuring
|
||||
Speed (in Hz) for Wire transmissions in SH110X library calls.
|
||||
Defaults to 400000 (400 KHz), a known 'safe' value for most
|
||||
microcontrollers, and meets the SH110X datasheet spec.
|
||||
Some systems can operate I2C faster (800 KHz for ESP32, 1 MHz
|
||||
for many other 32-bit MCUs), and some (perhaps not all)
|
||||
SH110X's can work with this -- so it's optionally be specified
|
||||
here and is not a default behavior. (Ignored if using pre-1.5.7
|
||||
Arduino software, which operates I2C at a fixed 100 KHz.)
|
||||
@param clkAfter
|
||||
Speed (in Hz) for Wire transmissions following SH110X library
|
||||
calls. Defaults to 100000 (100 KHz), the default Arduino Wire
|
||||
speed. This is done rather than leaving it at the 'during' speed
|
||||
because other devices on the I2C bus might not be compatible
|
||||
with the faster rate. (Ignored if using pre-1.5.7 Arduino
|
||||
software, which operates I2C at a fixed 100 KHz.)
|
||||
@note Call the object's begin() function before use -- buffer
|
||||
allocation is performed there!
|
||||
*/
|
||||
Adafruit_SH1106G::Adafruit_SH1106G(uint16_t w, uint16_t h, TwoWire *twi,
|
||||
int8_t rst_pin, uint32_t clkDuring,
|
||||
uint32_t clkAfter)
|
||||
: Adafruit_SH110X(w, h, twi, rst_pin, clkDuring, clkAfter) {}
|
||||
|
||||
/*!
|
||||
@brief Constructor for SPI SH1106G displays, using software (bitbang)
|
||||
SPI.
|
||||
@param w
|
||||
Display width in pixels
|
||||
@param h
|
||||
Display height in pixels
|
||||
@param mosi_pin
|
||||
MOSI (master out, slave in) pin (using Arduino pin numbering).
|
||||
This transfers serial data from microcontroller to display.
|
||||
@param sclk_pin
|
||||
SCLK (serial clock) pin (using Arduino pin numbering).
|
||||
This clocks each bit from MOSI.
|
||||
@param dc_pin
|
||||
Data/command pin (using Arduino pin numbering), selects whether
|
||||
display is receiving commands (low) or data (high).
|
||||
@param rst_pin
|
||||
Reset pin (using Arduino pin numbering), or -1 if not used
|
||||
(some displays might be wired to share the microcontroller's
|
||||
reset pin).
|
||||
@param cs_pin
|
||||
Chip-select pin (using Arduino pin numbering) for sharing the
|
||||
bus with other devices. Active low.
|
||||
@note Call the object's begin() function before use -- buffer
|
||||
allocation is performed there!
|
||||
*/
|
||||
Adafruit_SH1106G::Adafruit_SH1106G(uint16_t w, uint16_t h, int8_t mosi_pin,
|
||||
int8_t sclk_pin, int8_t dc_pin,
|
||||
int8_t rst_pin, int8_t cs_pin)
|
||||
: Adafruit_SH110X(w, h, mosi_pin, sclk_pin, dc_pin, rst_pin, cs_pin) {}
|
||||
|
||||
/*!
|
||||
@brief Constructor for SPI SH1106G displays, using native hardware SPI.
|
||||
@param w
|
||||
Display width in pixels
|
||||
@param h
|
||||
Display height in pixels
|
||||
@param spi
|
||||
Pointer to an existing SPIClass instance (e.g. &SPI, the
|
||||
microcontroller's primary SPI bus).
|
||||
@param dc_pin
|
||||
Data/command pin (using Arduino pin numbering), selects whether
|
||||
display is receiving commands (low) or data (high).
|
||||
@param rst_pin
|
||||
Reset pin (using Arduino pin numbering), or -1 if not used
|
||||
(some displays might be wired to share the microcontroller's
|
||||
reset pin).
|
||||
@param cs_pin
|
||||
Chip-select pin (using Arduino pin numbering) for sharing the
|
||||
bus with other devices. Active low.
|
||||
@param bitrate
|
||||
SPI clock rate for transfers to this display. Default if
|
||||
unspecified is 8000000UL (8 MHz).
|
||||
@note Call the object's begin() function before use -- buffer
|
||||
allocation is performed there!
|
||||
*/
|
||||
Adafruit_SH1106G::Adafruit_SH1106G(uint16_t w, uint16_t h, SPIClass *spi,
|
||||
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin,
|
||||
uint32_t bitrate)
|
||||
: Adafruit_SH110X(w, h, spi, dc_pin, rst_pin, cs_pin, bitrate) {}
|
||||
|
||||
/*!
|
||||
@brief Destructor for Adafruit_SH1106G object.
|
||||
*/
|
||||
Adafruit_SH1106G::~Adafruit_SH1106G(void) {}
|
||||
|
||||
/*!
|
||||
@brief Allocate RAM for image buffer, initialize peripherals and pins.
|
||||
@param addr
|
||||
I2C address of corresponding SH110X display (or pass 0 to use
|
||||
default of 0x3C for 128x32 display, 0x3D for all others).
|
||||
SPI displays (hardware or software) do not use addresses, but
|
||||
this argument is still required (pass 0 or any value really,
|
||||
it will simply be ignored). Default if unspecified is 0.
|
||||
@param reset
|
||||
If true, and if the reset pin passed to the constructor is
|
||||
valid, a hard reset will be performed before initializing the
|
||||
display. If using multiple SH110X displays on the same bus, and
|
||||
if they all share the same reset pin, you should only pass true
|
||||
on the first display being initialized, false on all others,
|
||||
else the already-initialized displays would be reset. Default if
|
||||
unspecified is true.
|
||||
@return true on successful allocation/init, false otherwise.
|
||||
Well-behaved code should check the return value before
|
||||
proceeding.
|
||||
@note MUST call this function before any drawing or updates!
|
||||
*/
|
||||
bool Adafruit_SH1106G::begin(uint8_t addr, bool reset) {
|
||||
|
||||
Adafruit_GrayOLED::_init(addr, reset);
|
||||
|
||||
_page_start_offset =
|
||||
2; // the SH1106 display we have found requires a small offset into memory
|
||||
|
||||
#ifndef SH110X_NO_SPLASH
|
||||
drawBitmap((WIDTH - splash2_width) / 2, (HEIGHT - splash2_height) / 2,
|
||||
splash2_data, splash2_width, splash2_height, 1);
|
||||
#endif
|
||||
|
||||
// Init sequence, make sure its under 32 bytes, or split into multiples!
|
||||
// clang-format off
|
||||
static const uint8_t init[] = {
|
||||
SH110X_DISPLAYOFF, // 0xAE
|
||||
SH110X_SETDISPLAYCLOCKDIV, 0x80, // 0xD5, 0x80,
|
||||
SH110X_SETMULTIPLEX, 0x3F, // 0xA8, 0x3F,
|
||||
SH110X_SETDISPLAYOFFSET, 0x00, // 0xD3, 0x00,
|
||||
SH110X_SETSTARTLINE, // 0x40
|
||||
SH110X_DCDC, 0x8B, // DC/DC on
|
||||
SH110X_SEGREMAP + 1, // 0xA1
|
||||
SH110X_COMSCANDEC, // 0xC8
|
||||
SH110X_SETCOMPINS, 0x12, // 0xDA, 0x12,
|
||||
SH110X_SETCONTRAST, 0xFF, // 0x81, 0xFF
|
||||
SH110X_SETPRECHARGE, 0x1F, // 0xD9, 0x1F,
|
||||
SH110X_SETVCOMDETECT, 0x40, // 0xDB, 0x40,
|
||||
0x33, // Set VPP to 9V
|
||||
SH110X_NORMALDISPLAY,
|
||||
SH110X_MEMORYMODE, 0x10, // 0x20, 0x00
|
||||
SH110X_DISPLAYALLON_RESUME,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
if (!oled_commandList(init, sizeof(init))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
delay(100); // 100ms delay recommended
|
||||
oled_command(SH110X_DISPLAYON); // 0xaf
|
||||
|
||||
return true; // Success
|
||||
}
|
||||
195
libraries/Adafruit_SH110X/Adafruit_SH1107.cpp
Normal file
195
libraries/Adafruit_SH110X/Adafruit_SH1107.cpp
Normal file
@@ -0,0 +1,195 @@
|
||||
/*!
|
||||
* @file Adafruit_SH1107.cpp
|
||||
*
|
||||
*/
|
||||
|
||||
#include "Adafruit_SH110X.h"
|
||||
#include "splash.h"
|
||||
|
||||
// CONSTRUCTORS, DESTRUCTOR ------------------------------------------------
|
||||
|
||||
/*!
|
||||
@brief Constructor for I2C-interfaced SH1107 displays.
|
||||
@param w
|
||||
Display width in pixels
|
||||
@param h
|
||||
Display height in pixels
|
||||
@param twi
|
||||
Pointer to an existing TwoWire instance (e.g. &Wire, the
|
||||
microcontroller's primary I2C bus).
|
||||
@param rst_pin
|
||||
Reset pin (using Arduino pin numbering), or -1 if not used
|
||||
(some displays might be wired to share the microcontroller's
|
||||
reset pin).
|
||||
@param clkDuring
|
||||
Speed (in Hz) for Wire transmissions in SH110X library calls.
|
||||
Defaults to 400000 (400 KHz), a known 'safe' value for most
|
||||
microcontrollers, and meets the SH110X datasheet spec.
|
||||
Some systems can operate I2C faster (800 KHz for ESP32, 1 MHz
|
||||
for many other 32-bit MCUs), and some (perhaps not all)
|
||||
SH110X's can work with this -- so it's optionally be specified
|
||||
here and is not a default behavior. (Ignored if using pre-1.5.7
|
||||
Arduino software, which operates I2C at a fixed 100 KHz.)
|
||||
@param clkAfter
|
||||
Speed (in Hz) for Wire transmissions following SH110X library
|
||||
calls. Defaults to 100000 (100 KHz), the default Arduino Wire
|
||||
speed. This is done rather than leaving it at the 'during' speed
|
||||
because other devices on the I2C bus might not be compatible
|
||||
with the faster rate. (Ignored if using pre-1.5.7 Arduino
|
||||
software, which operates I2C at a fixed 100 KHz.)
|
||||
@note Call the object's begin() function before use -- buffer
|
||||
allocation is performed there!
|
||||
*/
|
||||
Adafruit_SH1107::Adafruit_SH1107(uint16_t w, uint16_t h, TwoWire *twi,
|
||||
int8_t rst_pin, uint32_t clkDuring,
|
||||
uint32_t clkAfter)
|
||||
: Adafruit_SH110X(w, h, twi, rst_pin, clkDuring, clkAfter) {}
|
||||
|
||||
/*!
|
||||
@brief Constructor for SPI SH1107 displays, using software (bitbang)
|
||||
SPI.
|
||||
@param w
|
||||
Display width in pixels
|
||||
@param h
|
||||
Display height in pixels
|
||||
@param mosi_pin
|
||||
MOSI (master out, slave in) pin (using Arduino pin numbering).
|
||||
This transfers serial data from microcontroller to display.
|
||||
@param sclk_pin
|
||||
SCLK (serial clock) pin (using Arduino pin numbering).
|
||||
This clocks each bit from MOSI.
|
||||
@param dc_pin
|
||||
Data/command pin (using Arduino pin numbering), selects whether
|
||||
display is receiving commands (low) or data (high).
|
||||
@param rst_pin
|
||||
Reset pin (using Arduino pin numbering), or -1 if not used
|
||||
(some displays might be wired to share the microcontroller's
|
||||
reset pin).
|
||||
@param cs_pin
|
||||
Chip-select pin (using Arduino pin numbering) for sharing the
|
||||
bus with other devices. Active low.
|
||||
@note Call the object's begin() function before use -- buffer
|
||||
allocation is performed there!
|
||||
*/
|
||||
Adafruit_SH1107::Adafruit_SH1107(uint16_t w, uint16_t h, int8_t mosi_pin,
|
||||
int8_t sclk_pin, int8_t dc_pin, int8_t rst_pin,
|
||||
int8_t cs_pin)
|
||||
: Adafruit_SH110X(w, h, mosi_pin, sclk_pin, dc_pin, rst_pin, cs_pin) {}
|
||||
|
||||
/*!
|
||||
@brief Constructor for SPI SH1107 displays, using native hardware SPI.
|
||||
@param w
|
||||
Display width in pixels
|
||||
@param h
|
||||
Display height in pixels
|
||||
@param spi
|
||||
Pointer to an existing SPIClass instance (e.g. &SPI, the
|
||||
microcontroller's primary SPI bus).
|
||||
@param dc_pin
|
||||
Data/command pin (using Arduino pin numbering), selects whether
|
||||
display is receiving commands (low) or data (high).
|
||||
@param rst_pin
|
||||
Reset pin (using Arduino pin numbering), or -1 if not used
|
||||
(some displays might be wired to share the microcontroller's
|
||||
reset pin).
|
||||
@param cs_pin
|
||||
Chip-select pin (using Arduino pin numbering) for sharing the
|
||||
bus with other devices. Active low.
|
||||
@param bitrate
|
||||
SPI clock rate for transfers to this display. Default if
|
||||
unspecified is 8000000UL (8 MHz).
|
||||
@note Call the object's begin() function before use -- buffer
|
||||
allocation is performed there!
|
||||
*/
|
||||
Adafruit_SH1107::Adafruit_SH1107(uint16_t w, uint16_t h, SPIClass *spi,
|
||||
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin,
|
||||
uint32_t bitrate)
|
||||
: Adafruit_SH110X(w, h, spi, dc_pin, rst_pin, cs_pin, bitrate) {}
|
||||
|
||||
/*!
|
||||
@brief Destructor for Adafruit_SH1107 object.
|
||||
*/
|
||||
Adafruit_SH1107::~Adafruit_SH1107(void) {}
|
||||
|
||||
/*!
|
||||
@brief Allocate RAM for image buffer, initialize peripherals and pins.
|
||||
@param addr
|
||||
I2C address of corresponding SH110X display (or pass 0 to use
|
||||
default of 0x3C for 128x32 display, 0x3D for all others).
|
||||
SPI displays (hardware or software) do not use addresses, but
|
||||
this argument is still required (pass 0 or any value really,
|
||||
it will simply be ignored). Default if unspecified is 0.
|
||||
@param reset
|
||||
If true, and if the reset pin passed to the constructor is
|
||||
valid, a hard reset will be performed before initializing the
|
||||
display. If using multiple SH110X displays on the same bus, and
|
||||
if they all share the same reset pin, you should only pass true
|
||||
on the first display being initialized, false on all others,
|
||||
else the already-initialized displays would be reset. Default if
|
||||
unspecified is true.
|
||||
@return true on successful allocation/init, false otherwise.
|
||||
Well-behaved code should check the return value before
|
||||
proceeding.
|
||||
@note MUST call this function before any drawing or updates!
|
||||
*/
|
||||
bool Adafruit_SH1107::begin(uint8_t addr, bool reset) {
|
||||
|
||||
Adafruit_GrayOLED::_init(addr, reset);
|
||||
|
||||
setContrast(0x2F);
|
||||
|
||||
#ifndef SH110X_NO_SPLASH
|
||||
// the featherwing with 128x64 oled is 'rotated' so to make the splash right,
|
||||
// rotate!
|
||||
if (WIDTH == 64 && HEIGHT == 128) {
|
||||
setRotation(1);
|
||||
drawBitmap((HEIGHT - splash2_width) / 2, (WIDTH - splash2_height) / 2,
|
||||
splash2_data, splash2_width, splash2_height, 1);
|
||||
setRotation(0);
|
||||
}
|
||||
if (WIDTH == 128 && HEIGHT == 128) {
|
||||
drawBitmap((HEIGHT - splash2_width) / 2, (WIDTH - splash2_height) / 2,
|
||||
splash2_data, splash2_width, splash2_height, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Init sequence, make sure its under 32 bytes, or split into multiples!
|
||||
// clang-format off
|
||||
static const uint8_t init[] = {
|
||||
SH110X_DISPLAYOFF, // 0xAE
|
||||
SH110X_SETDISPLAYCLOCKDIV, 0x51, // 0xd5, 0x51,
|
||||
SH110X_MEMORYMODE, // 0x20
|
||||
SH110X_SETCONTRAST, 0x4F, // 0x81, 0x4F
|
||||
SH110X_DCDC, 0x8A, // 0xAD, 0x8A
|
||||
SH110X_SEGREMAP, // 0xA0
|
||||
SH110X_COMSCANINC, // 0xC0
|
||||
SH110X_SETDISPSTARTLINE, 0x0, // 0xDC 0x00
|
||||
SH110X_SETDISPLAYOFFSET, 0x60, // 0xd3, 0x60,
|
||||
SH110X_SETPRECHARGE, 0x22, // 0xd9, 0x22,
|
||||
SH110X_SETVCOMDETECT, 0x35, // 0xdb, 0x35,
|
||||
SH110X_SETMULTIPLEX, 0x3F, // 0xa8, 0x3f,
|
||||
// SH110X_SETPAGEADDR, // 0xb0
|
||||
// SH110X_SETCOMPINS, 0x12, // 0xda, 0x12,
|
||||
SH110X_DISPLAYALLON_RESUME, // 0xa4
|
||||
SH110X_NORMALDISPLAY, // 0xa6
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
if (!oled_commandList(init, sizeof(init))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (WIDTH == 128 && HEIGHT == 128) {
|
||||
static const uint8_t init_128x128[] = {
|
||||
SH110X_SETDISPLAYOFFSET, 0x00, SH110X_SETMULTIPLEX, 0x7F, // 0xa8, 0x3f,
|
||||
};
|
||||
if (!oled_commandList(init_128x128, sizeof(init_128x128))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
delay(100); // 100ms delay recommended
|
||||
oled_command(SH110X_DISPLAYON); // 0xaf
|
||||
|
||||
return true; // Success
|
||||
}
|
||||
250
libraries/Adafruit_SH110X/Adafruit_SH110X.cpp
Normal file
250
libraries/Adafruit_SH110X/Adafruit_SH110X.cpp
Normal file
@@ -0,0 +1,250 @@
|
||||
/*!
|
||||
* @file Adafruit_SH110X.cpp
|
||||
*
|
||||
* @mainpage Arduino library for monochrome OLEDs based on SH110X drivers.
|
||||
*
|
||||
* @section intro_sec Introduction
|
||||
*
|
||||
* This is documentation for Adafruit's SH110X library for monochrome
|
||||
* OLED displays: http://www.adafruit.com/category/63_98
|
||||
*
|
||||
* These displays use I2C or SPI to communicate. I2C requires 2 pins
|
||||
* (SCL+SDA) and optionally a RESET pin. SPI requires 4 pins (MOSI, SCK,
|
||||
* select, data/command) and optionally a reset pin. Hardware SPI or
|
||||
* 'bitbang' software SPI are both supported.
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* @section dependencies Dependencies
|
||||
*
|
||||
* This library depends on <a
|
||||
* href="https://github.com/adafruit/Adafruit-GFX-Library"> Adafruit_GFX</a>
|
||||
* being present on your system. Please make sure you have installed the latest
|
||||
* version before using this library.
|
||||
*
|
||||
* @section author Author
|
||||
*
|
||||
* Written by Limor Fried/Ladyada for Adafruit Industries, with
|
||||
* contributions from the open source community.
|
||||
*
|
||||
* @section license License
|
||||
*
|
||||
* BSD license, all text above, and the splash screen included below,
|
||||
* must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "Adafruit_SH110X.h"
|
||||
#include "splash.h"
|
||||
|
||||
// CONSTRUCTORS, DESTRUCTOR ------------------------------------------------
|
||||
|
||||
/*!
|
||||
@brief Constructor for I2C-interfaced SH110X displays.
|
||||
@param w
|
||||
Display width in pixels
|
||||
@param h
|
||||
Display height in pixels
|
||||
@param twi
|
||||
Pointer to an existing TwoWire instance (e.g. &Wire, the
|
||||
microcontroller's primary I2C bus).
|
||||
@param rst_pin
|
||||
Reset pin (using Arduino pin numbering), or -1 if not used
|
||||
(some displays might be wired to share the microcontroller's
|
||||
reset pin).
|
||||
@param clkDuring
|
||||
Speed (in Hz) for Wire transmissions in SH110X library calls.
|
||||
Defaults to 400000 (400 KHz), a known 'safe' value for most
|
||||
microcontrollers, and meets the SH110X datasheet spec.
|
||||
Some systems can operate I2C faster (800 KHz for ESP32, 1 MHz
|
||||
for many other 32-bit MCUs), and some (perhaps not all)
|
||||
SH110X's can work with this -- so it's optionally be specified
|
||||
here and is not a default behavior. (Ignored if using pre-1.5.7
|
||||
Arduino software, which operates I2C at a fixed 100 KHz.)
|
||||
@param clkAfter
|
||||
Speed (in Hz) for Wire transmissions following SH110X library
|
||||
calls. Defaults to 100000 (100 KHz), the default Arduino Wire
|
||||
speed. This is done rather than leaving it at the 'during' speed
|
||||
because other devices on the I2C bus might not be compatible
|
||||
with the faster rate. (Ignored if using pre-1.5.7 Arduino
|
||||
software, which operates I2C at a fixed 100 KHz.)
|
||||
@note Call the object's begin() function before use -- buffer
|
||||
allocation is performed there!
|
||||
*/
|
||||
Adafruit_SH110X::Adafruit_SH110X(uint16_t w, uint16_t h, TwoWire *twi,
|
||||
int8_t rst_pin, uint32_t clkDuring,
|
||||
uint32_t clkAfter)
|
||||
: Adafruit_GrayOLED(1, w, h, twi, rst_pin, clkDuring, clkAfter) {}
|
||||
|
||||
/*!
|
||||
@brief Constructor for SPI SH110X displays, using software (bitbang)
|
||||
SPI.
|
||||
@param w
|
||||
Display width in pixels
|
||||
@param h
|
||||
Display height in pixels
|
||||
@param mosi_pin
|
||||
MOSI (master out, slave in) pin (using Arduino pin numbering).
|
||||
This transfers serial data from microcontroller to display.
|
||||
@param sclk_pin
|
||||
SCLK (serial clock) pin (using Arduino pin numbering).
|
||||
This clocks each bit from MOSI.
|
||||
@param dc_pin
|
||||
Data/command pin (using Arduino pin numbering), selects whether
|
||||
display is receiving commands (low) or data (high).
|
||||
@param rst_pin
|
||||
Reset pin (using Arduino pin numbering), or -1 if not used
|
||||
(some displays might be wired to share the microcontroller's
|
||||
reset pin).
|
||||
@param cs_pin
|
||||
Chip-select pin (using Arduino pin numbering) for sharing the
|
||||
bus with other devices. Active low.
|
||||
@note Call the object's begin() function before use -- buffer
|
||||
allocation is performed there!
|
||||
*/
|
||||
Adafruit_SH110X::Adafruit_SH110X(uint16_t w, uint16_t h, int8_t mosi_pin,
|
||||
int8_t sclk_pin, int8_t dc_pin, int8_t rst_pin,
|
||||
int8_t cs_pin)
|
||||
: Adafruit_GrayOLED(1, w, h, mosi_pin, sclk_pin, dc_pin, rst_pin, cs_pin) {}
|
||||
|
||||
/*!
|
||||
@brief Constructor for SPI SH110X displays, using native hardware SPI.
|
||||
@param w
|
||||
Display width in pixels
|
||||
@param h
|
||||
Display height in pixels
|
||||
@param spi
|
||||
Pointer to an existing SPIClass instance (e.g. &SPI, the
|
||||
microcontroller's primary SPI bus).
|
||||
@param dc_pin
|
||||
Data/command pin (using Arduino pin numbering), selects whether
|
||||
display is receiving commands (low) or data (high).
|
||||
@param rst_pin
|
||||
Reset pin (using Arduino pin numbering), or -1 if not used
|
||||
(some displays might be wired to share the microcontroller's
|
||||
reset pin).
|
||||
@param cs_pin
|
||||
Chip-select pin (using Arduino pin numbering) for sharing the
|
||||
bus with other devices. Active low.
|
||||
@param bitrate
|
||||
SPI clock rate for transfers to this display. Default if
|
||||
unspecified is 8000000UL (8 MHz).
|
||||
@note Call the object's begin() function before use -- buffer
|
||||
allocation is performed there!
|
||||
*/
|
||||
Adafruit_SH110X::Adafruit_SH110X(uint16_t w, uint16_t h, SPIClass *spi,
|
||||
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin,
|
||||
uint32_t bitrate)
|
||||
: Adafruit_GrayOLED(1, w, h, spi, dc_pin, rst_pin, cs_pin, bitrate) {}
|
||||
|
||||
/*!
|
||||
@brief Destructor for Adafruit_SH110X object.
|
||||
*/
|
||||
Adafruit_SH110X::~Adafruit_SH110X(void) {}
|
||||
|
||||
// REFRESH DISPLAY ---------------------------------------------------------
|
||||
|
||||
/*!
|
||||
@brief Push data currently in RAM to SH110X display.
|
||||
@note Drawing operations are not visible until this function is
|
||||
called. Call after each graphics command, or after a whole set
|
||||
of graphics commands, as best needed by one's own application.
|
||||
*/
|
||||
void Adafruit_SH110X::display(void) {
|
||||
// ESP8266 needs a periodic yield() call to avoid watchdog reset.
|
||||
// With the limited size of SH110X displays, and the fast bitrate
|
||||
// being used (1 MHz or more), I think one yield() immediately before
|
||||
// a screen write and one immediately after should cover it. But if
|
||||
// not, if this becomes a problem, yields() might be added in the
|
||||
// 32-byte transfer condition below.
|
||||
yield();
|
||||
|
||||
// uint16_t count = WIDTH * ((HEIGHT + 7) / 8);
|
||||
uint8_t *ptr = buffer;
|
||||
uint8_t dc_byte = 0x40;
|
||||
uint8_t pages = ((HEIGHT + 7) / 8);
|
||||
|
||||
uint8_t bytes_per_page = WIDTH;
|
||||
|
||||
/*
|
||||
Serial.print("Window: (");
|
||||
Serial.print(window_x1);
|
||||
Serial.print(", ");
|
||||
Serial.print(window_y1);
|
||||
Serial.print(" -> (");
|
||||
Serial.print(window_x2);
|
||||
Serial.print(", ");
|
||||
Serial.print(window_y2);
|
||||
Serial.println(")");
|
||||
*/
|
||||
|
||||
uint8_t first_page = window_y1 / 8;
|
||||
// uint8_t last_page = (window_y2 + 7) / 8;
|
||||
uint8_t page_start = min(bytes_per_page, (uint8_t)window_x1);
|
||||
uint8_t page_end = (uint8_t)max((int)0, (int)window_x2);
|
||||
/*
|
||||
Serial.print("Pages: ");
|
||||
Serial.print(first_page);
|
||||
Serial.print(" -> ");
|
||||
Serial.println(last_page);
|
||||
pages = min(pages, last_page);
|
||||
|
||||
Serial.print("Page addr: ");
|
||||
Serial.print(page_start);
|
||||
Serial.print(" -> ");
|
||||
Serial.println(page_end);
|
||||
*/
|
||||
|
||||
for (uint8_t p = first_page; p < pages; p++) {
|
||||
uint8_t bytes_remaining = bytes_per_page;
|
||||
ptr = buffer + (uint16_t)p * (uint16_t)bytes_per_page;
|
||||
// fast forward to dirty rectangle beginning
|
||||
ptr += page_start;
|
||||
bytes_remaining -= page_start;
|
||||
// cut off end of dirty rectangle
|
||||
bytes_remaining -= (WIDTH - 1) - page_end;
|
||||
|
||||
if (i2c_dev) { // I2C
|
||||
uint16_t maxbuff = i2c_dev->maxBufferSize() - 1;
|
||||
|
||||
uint8_t cmd[] = {
|
||||
0x00, (uint8_t)(SH110X_SETPAGEADDR + p),
|
||||
(uint8_t)(0x10 + ((page_start + _page_start_offset) >> 4)),
|
||||
(uint8_t)((page_start + _page_start_offset) & 0xF)};
|
||||
|
||||
// Set high speed clk
|
||||
i2c_dev->setSpeed(i2c_preclk);
|
||||
|
||||
i2c_dev->write(cmd, 4);
|
||||
|
||||
while (bytes_remaining) {
|
||||
uint8_t to_write = min(bytes_remaining, (uint8_t)maxbuff);
|
||||
i2c_dev->write(ptr, to_write, true, &dc_byte, 1);
|
||||
ptr += to_write;
|
||||
bytes_remaining -= to_write;
|
||||
yield();
|
||||
}
|
||||
|
||||
// Set low speed clk
|
||||
i2c_dev->setSpeed(i2c_postclk);
|
||||
|
||||
} else { // SPI
|
||||
uint8_t cmd[] = {
|
||||
(uint8_t)(SH110X_SETPAGEADDR + p),
|
||||
(uint8_t)(0x10 + ((page_start + _page_start_offset) >> 4)),
|
||||
(uint8_t)((page_start + _page_start_offset) & 0xF)};
|
||||
|
||||
digitalWrite(dcPin, LOW);
|
||||
spi_dev->write(cmd, 3);
|
||||
digitalWrite(dcPin, HIGH);
|
||||
spi_dev->write(ptr, bytes_remaining);
|
||||
}
|
||||
}
|
||||
// reset dirty window
|
||||
window_x1 = 1024;
|
||||
window_y1 = 1024;
|
||||
window_x2 = -1;
|
||||
window_y2 = -1;
|
||||
}
|
||||
133
libraries/Adafruit_SH110X/Adafruit_SH110X.h
Normal file
133
libraries/Adafruit_SH110X/Adafruit_SH110X.h
Normal file
@@ -0,0 +1,133 @@
|
||||
/*!
|
||||
* @file Adafruit_SH110X.h
|
||||
*
|
||||
* This is part of for Adafruit's SH110X library for monochrome
|
||||
* OLED displays: http://www.adafruit.com/category/63_98
|
||||
*
|
||||
* These displays use I2C or SPI to communicate. I2C requires 2 pins
|
||||
* (SCL+SDA) and optionally a RESET pin. SPI requires 4 pins (MOSI, SCK,
|
||||
* select, data/command) and optionally a reset pin. Hardware SPI or
|
||||
* 'bitbang' software SPI are both supported.
|
||||
*
|
||||
* Adafruit invests time and resources providing this open source code,
|
||||
* please support Adafruit and open-source hardware by purchasing
|
||||
* products from Adafruit!
|
||||
*
|
||||
* Written by Limor Fried/Ladyada for Adafruit Industries, with
|
||||
* contributions from the open source community.
|
||||
*
|
||||
* BSD license, all text above, and the splash screen header file,
|
||||
* must be included in any redistribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _Adafruit_SH110X_H_
|
||||
#define _Adafruit_SH110X_H_
|
||||
|
||||
#include <Adafruit_GrayOLED.h>
|
||||
|
||||
/// fit into the SH110X_ naming scheme
|
||||
#define SH110X_BLACK 0 ///< Draw 'off' pixels
|
||||
#define SH110X_WHITE 1 ///< Draw 'on' pixels
|
||||
#define SH110X_INVERSE 2 ///< Invert pixels
|
||||
|
||||
// Uncomment to disable Adafruit splash logo
|
||||
//#define SH110X_NO_SPLASH
|
||||
|
||||
#define SH110X_MEMORYMODE 0x20 ///< See datasheet
|
||||
#define SH110X_COLUMNADDR 0x21 ///< See datasheet
|
||||
#define SH110X_PAGEADDR 0x22 ///< See datasheet
|
||||
#define SH110X_SETCONTRAST 0x81 ///< See datasheet
|
||||
#define SH110X_CHARGEPUMP 0x8D ///< See datasheet
|
||||
#define SH110X_SEGREMAP 0xA0 ///< See datasheet
|
||||
#define SH110X_DISPLAYALLON_RESUME 0xA4 ///< See datasheet
|
||||
#define SH110X_DISPLAYALLON 0xA5 ///< Not currently used
|
||||
#define SH110X_NORMALDISPLAY 0xA6 ///< See datasheet
|
||||
#define SH110X_INVERTDISPLAY 0xA7 ///< See datasheet
|
||||
#define SH110X_SETMULTIPLEX 0xA8 ///< See datasheet
|
||||
#define SH110X_DCDC 0xAD ///< See datasheet
|
||||
#define SH110X_DISPLAYOFF 0xAE ///< See datasheet
|
||||
#define SH110X_DISPLAYON 0xAF ///< See datasheet
|
||||
#define SH110X_SETPAGEADDR \
|
||||
0xB0 ///< Specify page address to load display RAM data to page address
|
||||
///< register
|
||||
#define SH110X_COMSCANINC 0xC0 ///< Not currently used
|
||||
#define SH110X_COMSCANDEC 0xC8 ///< See datasheet
|
||||
#define SH110X_SETDISPLAYOFFSET 0xD3 ///< See datasheet
|
||||
#define SH110X_SETDISPLAYCLOCKDIV 0xD5 ///< See datasheet
|
||||
#define SH110X_SETPRECHARGE 0xD9 ///< See datasheet
|
||||
#define SH110X_SETCOMPINS 0xDA ///< See datasheet
|
||||
#define SH110X_SETVCOMDETECT 0xDB ///< See datasheet
|
||||
#define SH110X_SETDISPSTARTLINE \
|
||||
0xDC ///< Specify Column address to determine the initial display line or
|
||||
///< COM0.
|
||||
|
||||
#define SH110X_SETLOWCOLUMN 0x00 ///< Not currently used
|
||||
#define SH110X_SETHIGHCOLUMN 0x10 ///< Not currently used
|
||||
#define SH110X_SETSTARTLINE 0x40 ///< See datasheet
|
||||
|
||||
/*!
|
||||
@brief Class that stores state and functions for interacting with
|
||||
SH110X OLED displays. Not instantiatable - use a subclass!
|
||||
*/
|
||||
class Adafruit_SH110X : public Adafruit_GrayOLED {
|
||||
public:
|
||||
// NEW CONSTRUCTORS -- recommended for new projects
|
||||
Adafruit_SH110X(uint16_t w, uint16_t h, TwoWire *twi = &Wire,
|
||||
int8_t rst_pin = -1, uint32_t preclk = 400000,
|
||||
uint32_t postclk = 100000);
|
||||
Adafruit_SH110X(uint16_t w, uint16_t h, int8_t mosi_pin, int8_t sclk_pin,
|
||||
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);
|
||||
Adafruit_SH110X(uint16_t w, uint16_t h, SPIClass *spi, int8_t dc_pin,
|
||||
int8_t rst_pin, int8_t cs_pin, uint32_t bitrate = 8000000UL);
|
||||
|
||||
virtual ~Adafruit_SH110X(void) = 0;
|
||||
|
||||
void display(void);
|
||||
|
||||
protected:
|
||||
/*! some displays are 'inset' in memory, so we have to skip some memory to
|
||||
* display */
|
||||
uint8_t _page_start_offset = 0;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
/*!
|
||||
@brief Class that stores state and functions for interacting with
|
||||
SH1106G OLED displays.
|
||||
*/
|
||||
class Adafruit_SH1106G : public Adafruit_SH110X {
|
||||
public:
|
||||
Adafruit_SH1106G(uint16_t w, uint16_t h, TwoWire *twi = &Wire,
|
||||
int8_t rst_pin = -1, uint32_t preclk = 400000,
|
||||
uint32_t postclk = 100000);
|
||||
Adafruit_SH1106G(uint16_t w, uint16_t h, int8_t mosi_pin, int8_t sclk_pin,
|
||||
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);
|
||||
Adafruit_SH1106G(uint16_t w, uint16_t h, SPIClass *spi, int8_t dc_pin,
|
||||
int8_t rst_pin, int8_t cs_pin, uint32_t bitrate = 8000000UL);
|
||||
|
||||
~Adafruit_SH1106G(void);
|
||||
|
||||
bool begin(uint8_t i2caddr = 0x3C, bool reset = true);
|
||||
};
|
||||
|
||||
/*!
|
||||
@brief Class that stores state and functions for interacting with
|
||||
SH1107 OLED displays.
|
||||
*/
|
||||
class Adafruit_SH1107 : public Adafruit_SH110X {
|
||||
public:
|
||||
Adafruit_SH1107(uint16_t w, uint16_t h, TwoWire *twi = &Wire,
|
||||
int8_t rst_pin = -1, uint32_t preclk = 400000,
|
||||
uint32_t postclk = 100000);
|
||||
Adafruit_SH1107(uint16_t w, uint16_t h, int8_t mosi_pin, int8_t sclk_pin,
|
||||
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin);
|
||||
Adafruit_SH1107(uint16_t w, uint16_t h, SPIClass *spi, int8_t dc_pin,
|
||||
int8_t rst_pin, int8_t cs_pin, uint32_t bitrate = 8000000UL);
|
||||
|
||||
~Adafruit_SH1107(void);
|
||||
|
||||
bool begin(uint8_t i2caddr = 0x3C, bool reset = true);
|
||||
};
|
||||
#endif // _Adafruit_SH110X_H_
|
||||
19
libraries/Adafruit_SH110X/README.md
Normal file
19
libraries/Adafruit_SH110X/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
[](https://github.com/adafruit/Adafruit_SH110X/actions)
|
||||
|
||||
This is a library for our Monochrome OLEDs based on SH110X drivers
|
||||
|
||||
Pick one up today in the adafruit shop!
|
||||
------> http://www.adafruit.com/category/63_98
|
||||
|
||||
These displays use I2C or SPI to communicate, 2 to 5 pins are required to interface.
|
||||
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
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
|
||||
|
||||
Preferred installation method is to use the Arduino IDE Library Manager. To download the source from Github instead, click "Clone or download" above, then "Download ZIP." After uncompressing, rename the resulting folder Adafruit_SH110X. Check that the Adafruit_SH110X folder contains Adafruit_SH110X.cpp and Adafruit_SH110X.h.
|
||||
|
||||
You will also have to install the **Adafruit GFX library** which provides graphics primitves such as lines, circles, text, etc. This also can be found in the Arduino Library Manager, or you can get the source from https://github.com/adafruit/Adafruit-GFX-Library
|
||||
@@ -0,0 +1,357 @@
|
||||
/*********************************************************************
|
||||
This is an example for our Monochrome OLEDs based on SH110X drivers
|
||||
|
||||
This example is for a 128x64 size display using SPi to communicate
|
||||
5 pins are required to interface
|
||||
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
BSD license, check license.txt for more information
|
||||
All text above, and the splash screen must be included in any redistribution
|
||||
|
||||
SPi SH1106 modified by Rupert Hirst 12/09/21
|
||||
*********************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <SPI.h>
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SH110X.h>
|
||||
|
||||
|
||||
#define OLED_MOSI 10
|
||||
#define OLED_CLK 8
|
||||
#define OLED_DC 7
|
||||
#define OLED_CS 5
|
||||
#define OLED_RST 9
|
||||
|
||||
|
||||
// Create the OLED display
|
||||
Adafruit_SH1106G display = Adafruit_SH1106G(128, 64,OLED_MOSI, OLED_CLK, OLED_DC, OLED_RST, OLED_CS);
|
||||
|
||||
|
||||
#define NUMFLAKES 10
|
||||
#define XPOS 0
|
||||
#define YPOS 1
|
||||
#define DELTAY 2
|
||||
|
||||
|
||||
#define LOGO16_GLCD_HEIGHT 16
|
||||
#define LOGO16_GLCD_WIDTH 16
|
||||
static const unsigned char PROGMEM logo16_glcd_bmp[] =
|
||||
{ B00000000, B11000000,
|
||||
B00000001, B11000000,
|
||||
B00000001, B11000000,
|
||||
B00000011, B11100000,
|
||||
B11110011, B11100000,
|
||||
B11111110, B11111000,
|
||||
B01111110, B11111111,
|
||||
B00110011, B10011111,
|
||||
B00011111, B11111100,
|
||||
B00001101, B01110000,
|
||||
B00011011, B10100000,
|
||||
B00111111, B11100000,
|
||||
B00111111, B11110000,
|
||||
B01111100, B11110000,
|
||||
B01110000, B01110000,
|
||||
B00000000, B00110000
|
||||
};
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
//display.setContrast (0); // dim display
|
||||
|
||||
// Start OLED
|
||||
display.begin(0, true); // we dont use the i2c address but we will reset!
|
||||
|
||||
|
||||
// Show image buffer on the display hardware.
|
||||
// Since the buffer is intialized with an Adafruit splashscreen
|
||||
// internally, this will display the splashscreen.
|
||||
display.display();
|
||||
delay(2000);
|
||||
|
||||
// Clear the buffer.
|
||||
display.clearDisplay();
|
||||
|
||||
// draw a single pixel
|
||||
display.drawPixel(10, 10, SH110X_WHITE);
|
||||
// Show the display buffer on the hardware.
|
||||
// NOTE: You _must_ call display after making any drawing commands
|
||||
// to make them visible on the display hardware!
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
// draw many lines
|
||||
testdrawline();
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
// draw rectangles
|
||||
testdrawrect();
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
// draw multiple rectangles
|
||||
testfillrect();
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
// draw mulitple circles
|
||||
testdrawcircle();
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
// draw a SH110X_WHITE circle, 10 pixel radius
|
||||
display.fillCircle(display.width() / 2, display.height() / 2, 10, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
testdrawroundrect();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
testfillroundrect();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
testdrawtriangle();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
testfilltriangle();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
// draw the first ~12 characters in the font
|
||||
testdrawchar();
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
|
||||
// text display tests
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(SH110X_WHITE);
|
||||
display.setCursor(0, 0);
|
||||
display.println("Failure is always an option");
|
||||
display.setTextColor(SH110X_BLACK, SH110X_WHITE); // 'inverted' text
|
||||
display.println(3.141592);
|
||||
display.setTextSize(2);
|
||||
display.setTextColor(SH110X_WHITE);
|
||||
display.print("0x"); display.println(0xDEADBEEF, HEX);
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
// miniature bitmap display
|
||||
display.drawBitmap(30, 16, logo16_glcd_bmp, 16, 16, 1);
|
||||
display.display();
|
||||
delay(1);
|
||||
|
||||
// invert the display
|
||||
display.invertDisplay(true);
|
||||
delay(1000);
|
||||
display.invertDisplay(false);
|
||||
delay(1000);
|
||||
display.clearDisplay();
|
||||
|
||||
// draw a bitmap icon and 'animate' movement
|
||||
testdrawbitmap(logo16_glcd_bmp, LOGO16_GLCD_HEIGHT, LOGO16_GLCD_WIDTH);
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void testdrawbitmap(const uint8_t *bitmap, uint8_t w, uint8_t h) {
|
||||
uint8_t icons[NUMFLAKES][3];
|
||||
|
||||
// initialize
|
||||
for (uint8_t f = 0; f < NUMFLAKES; f++) {
|
||||
icons[f][XPOS] = random(display.width());
|
||||
icons[f][YPOS] = 0;
|
||||
icons[f][DELTAY] = random(5) + 1;
|
||||
|
||||
Serial.print("x: ");
|
||||
Serial.print(icons[f][XPOS], DEC);
|
||||
Serial.print(" y: ");
|
||||
Serial.print(icons[f][YPOS], DEC);
|
||||
Serial.print(" dy: ");
|
||||
Serial.println(icons[f][DELTAY], DEC);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
// draw each icon
|
||||
for (uint8_t f = 0; f < NUMFLAKES; f++) {
|
||||
display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, SH110X_WHITE);
|
||||
}
|
||||
display.display();
|
||||
delay(200);
|
||||
|
||||
// then erase it + move it
|
||||
for (uint8_t f = 0; f < NUMFLAKES; f++) {
|
||||
display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, SH110X_BLACK);
|
||||
// move it
|
||||
icons[f][YPOS] += icons[f][DELTAY];
|
||||
// if its gone, reinit
|
||||
if (icons[f][YPOS] > display.height()) {
|
||||
icons[f][XPOS] = random(display.width());
|
||||
icons[f][YPOS] = 0;
|
||||
icons[f][DELTAY] = random(5) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void testdrawchar(void) {
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(SH110X_WHITE);
|
||||
display.setCursor(0, 0);
|
||||
|
||||
for (uint8_t i = 0; i < 168; i++) {
|
||||
if (i == '\n') continue;
|
||||
display.write(i);
|
||||
if ((i > 0) && (i % 21 == 0))
|
||||
display.println();
|
||||
}
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
|
||||
void testdrawcircle(void) {
|
||||
for (int16_t i = 0; i < display.height(); i += 2) {
|
||||
display.drawCircle(display.width() / 2, display.height() / 2, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void testfillrect(void) {
|
||||
uint8_t color = 1;
|
||||
for (int16_t i = 0; i < display.height() / 2; i += 3) {
|
||||
// alternate colors
|
||||
display.fillRect(i, i, display.width() - i * 2, display.height() - i * 2, color % 2);
|
||||
display.display();
|
||||
delay(1);
|
||||
color++;
|
||||
}
|
||||
}
|
||||
|
||||
void testdrawtriangle(void) {
|
||||
for (int16_t i = 0; i < min(display.width(), display.height()) / 2; i += 5) {
|
||||
display.drawTriangle(display.width() / 2, display.height() / 2 - i,
|
||||
display.width() / 2 - i, display.height() / 2 + i,
|
||||
display.width() / 2 + i, display.height() / 2 + i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void testfilltriangle(void) {
|
||||
uint8_t color = SH110X_WHITE;
|
||||
for (int16_t i = min(display.width(), display.height()) / 2; i > 0; i -= 5) {
|
||||
display.fillTriangle(display.width() / 2, display.height() / 2 - i,
|
||||
display.width() / 2 - i, display.height() / 2 + i,
|
||||
display.width() / 2 + i, display.height() / 2 + i, SH110X_WHITE);
|
||||
if (color == SH110X_WHITE) color = SH110X_BLACK;
|
||||
else color = SH110X_WHITE;
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void testdrawroundrect(void) {
|
||||
for (int16_t i = 0; i < display.height() / 2 - 2; i += 2) {
|
||||
display.drawRoundRect(i, i, display.width() - 2 * i, display.height() - 2 * i, display.height() / 4, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void testfillroundrect(void) {
|
||||
uint8_t color = SH110X_WHITE;
|
||||
for (int16_t i = 0; i < display.height() / 2 - 2; i += 2) {
|
||||
display.fillRoundRect(i, i, display.width() - 2 * i, display.height() - 2 * i, display.height() / 4, color);
|
||||
if (color == SH110X_WHITE) color = SH110X_BLACK;
|
||||
else color = SH110X_WHITE;
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void testdrawrect(void) {
|
||||
for (int16_t i = 0; i < display.height() / 2; i += 2) {
|
||||
display.drawRect(i, i, display.width() - 2 * i, display.height() - 2 * i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void testdrawline() {
|
||||
for (int16_t i = 0; i < display.width(); i += 4) {
|
||||
display.drawLine(0, 0, i, display.height() - 1, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
for (int16_t i = 0; i < display.height(); i += 4) {
|
||||
display.drawLine(0, 0, display.width() - 1, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
delay(250);
|
||||
|
||||
display.clearDisplay();
|
||||
for (int16_t i = 0; i < display.width(); i += 4) {
|
||||
display.drawLine(0, display.height() - 1, i, 0, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
for (int16_t i = display.height() - 1; i >= 0; i -= 4) {
|
||||
display.drawLine(0, display.height() - 1, display.width() - 1, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
delay(250);
|
||||
|
||||
display.clearDisplay();
|
||||
for (int16_t i = display.width() - 1; i >= 0; i -= 4) {
|
||||
display.drawLine(display.width() - 1, display.height() - 1, i, 0, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
for (int16_t i = display.height() - 1; i >= 0; i -= 4) {
|
||||
display.drawLine(display.width() - 1, display.height() - 1, 0, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
delay(250);
|
||||
|
||||
display.clearDisplay();
|
||||
for (int16_t i = 0; i < display.height(); i += 4) {
|
||||
display.drawLine(display.width() - 1, 0, 0, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
for (int16_t i = 0; i < display.width(); i += 4) {
|
||||
display.drawLine(display.width() - 1, 0, i, display.height() - 1, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
delay(250);
|
||||
}
|
||||
@@ -0,0 +1,356 @@
|
||||
/*********************************************************************
|
||||
This is an example for our Monochrome OLEDs based on SH110X drivers
|
||||
|
||||
This example is for a 128x64 size display using I2C to communicate
|
||||
3 pins are required to interface (2 I2C and one reset)
|
||||
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
BSD license, check license.txt for more information
|
||||
All text above, and the splash screen must be included in any redistribution
|
||||
|
||||
i2c SH1106 modified by Rupert Hirst 12/09/21
|
||||
*********************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <SPI.h>
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SH110X.h>
|
||||
|
||||
/* Uncomment the initialize the I2C address , uncomment only one, If you get a totally blank screen try the other*/
|
||||
#define i2c_Address 0x3c //initialize with the I2C addr 0x3C Typically eBay OLED's
|
||||
//#define i2c_Address 0x3d //initialize with the I2C addr 0x3D Typically Adafruit OLED's
|
||||
|
||||
#define SCREEN_WIDTH 128 // OLED display width, in pixels
|
||||
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
|
||||
#define OLED_RESET -1 // QT-PY / XIAO
|
||||
Adafruit_SH1106G display = Adafruit_SH1106G(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
||||
|
||||
|
||||
#define NUMFLAKES 10
|
||||
#define XPOS 0
|
||||
#define YPOS 1
|
||||
#define DELTAY 2
|
||||
|
||||
|
||||
#define LOGO16_GLCD_HEIGHT 16
|
||||
#define LOGO16_GLCD_WIDTH 16
|
||||
static const unsigned char PROGMEM logo16_glcd_bmp[] =
|
||||
{ B00000000, B11000000,
|
||||
B00000001, B11000000,
|
||||
B00000001, B11000000,
|
||||
B00000011, B11100000,
|
||||
B11110011, B11100000,
|
||||
B11111110, B11111000,
|
||||
B01111110, B11111111,
|
||||
B00110011, B10011111,
|
||||
B00011111, B11111100,
|
||||
B00001101, B01110000,
|
||||
B00011011, B10100000,
|
||||
B00111111, B11100000,
|
||||
B00111111, B11110000,
|
||||
B01111100, B11110000,
|
||||
B01110000, B01110000,
|
||||
B00000000, B00110000
|
||||
};
|
||||
|
||||
|
||||
void setup() {
|
||||
|
||||
Serial.begin(9600);
|
||||
|
||||
// Show image buffer on the display hardware.
|
||||
// Since the buffer is intialized with an Adafruit splashscreen
|
||||
// internally, this will display the splashscreen.
|
||||
|
||||
delay(250); // wait for the OLED to power up
|
||||
display.begin(i2c_Address, true); // Address 0x3C default
|
||||
//display.setContrast (0); // dim display
|
||||
|
||||
display.display();
|
||||
delay(2000);
|
||||
|
||||
// Clear the buffer.
|
||||
display.clearDisplay();
|
||||
|
||||
// draw a single pixel
|
||||
display.drawPixel(10, 10, SH110X_WHITE);
|
||||
// Show the display buffer on the hardware.
|
||||
// NOTE: You _must_ call display after making any drawing commands
|
||||
// to make them visible on the display hardware!
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
// draw many lines
|
||||
testdrawline();
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
// draw rectangles
|
||||
testdrawrect();
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
// draw multiple rectangles
|
||||
testfillrect();
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
// draw mulitple circles
|
||||
testdrawcircle();
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
// draw a SH110X_WHITE circle, 10 pixel radius
|
||||
display.fillCircle(display.width() / 2, display.height() / 2, 10, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
testdrawroundrect();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
testfillroundrect();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
testdrawtriangle();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
testfilltriangle();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
// draw the first ~12 characters in the font
|
||||
testdrawchar();
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
|
||||
|
||||
// text display tests
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(SH110X_WHITE);
|
||||
display.setCursor(0, 0);
|
||||
display.println("Failure is always an option");
|
||||
display.setTextColor(SH110X_BLACK, SH110X_WHITE); // 'inverted' text
|
||||
display.println(3.141592);
|
||||
display.setTextSize(2);
|
||||
display.setTextColor(SH110X_WHITE);
|
||||
display.print("0x"); display.println(0xDEADBEEF, HEX);
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
// miniature bitmap display
|
||||
display.drawBitmap(30, 16, logo16_glcd_bmp, 16, 16, 1);
|
||||
display.display();
|
||||
delay(1);
|
||||
|
||||
// invert the display
|
||||
display.invertDisplay(true);
|
||||
delay(1000);
|
||||
display.invertDisplay(false);
|
||||
delay(1000);
|
||||
display.clearDisplay();
|
||||
|
||||
// draw a bitmap icon and 'animate' movement
|
||||
testdrawbitmap(logo16_glcd_bmp, LOGO16_GLCD_HEIGHT, LOGO16_GLCD_WIDTH);
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void testdrawbitmap(const uint8_t *bitmap, uint8_t w, uint8_t h) {
|
||||
uint8_t icons[NUMFLAKES][3];
|
||||
|
||||
// initialize
|
||||
for (uint8_t f = 0; f < NUMFLAKES; f++) {
|
||||
icons[f][XPOS] = random(display.width());
|
||||
icons[f][YPOS] = 0;
|
||||
icons[f][DELTAY] = random(5) + 1;
|
||||
|
||||
Serial.print("x: ");
|
||||
Serial.print(icons[f][XPOS], DEC);
|
||||
Serial.print(" y: ");
|
||||
Serial.print(icons[f][YPOS], DEC);
|
||||
Serial.print(" dy: ");
|
||||
Serial.println(icons[f][DELTAY], DEC);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
// draw each icon
|
||||
for (uint8_t f = 0; f < NUMFLAKES; f++) {
|
||||
display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, SH110X_WHITE);
|
||||
}
|
||||
display.display();
|
||||
delay(200);
|
||||
|
||||
// then erase it + move it
|
||||
for (uint8_t f = 0; f < NUMFLAKES; f++) {
|
||||
display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, SH110X_BLACK);
|
||||
// move it
|
||||
icons[f][YPOS] += icons[f][DELTAY];
|
||||
// if its gone, reinit
|
||||
if (icons[f][YPOS] > display.height()) {
|
||||
icons[f][XPOS] = random(display.width());
|
||||
icons[f][YPOS] = 0;
|
||||
icons[f][DELTAY] = random(5) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void testdrawchar(void) {
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(SH110X_WHITE);
|
||||
display.setCursor(0, 0);
|
||||
|
||||
for (uint8_t i = 0; i < 168; i++) {
|
||||
if (i == '\n') continue;
|
||||
display.write(i);
|
||||
if ((i > 0) && (i % 21 == 0))
|
||||
display.println();
|
||||
}
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
|
||||
void testdrawcircle(void) {
|
||||
for (int16_t i = 0; i < display.height(); i += 2) {
|
||||
display.drawCircle(display.width() / 2, display.height() / 2, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void testfillrect(void) {
|
||||
uint8_t color = 1;
|
||||
for (int16_t i = 0; i < display.height() / 2; i += 3) {
|
||||
// alternate colors
|
||||
display.fillRect(i, i, display.width() - i * 2, display.height() - i * 2, color % 2);
|
||||
display.display();
|
||||
delay(1);
|
||||
color++;
|
||||
}
|
||||
}
|
||||
|
||||
void testdrawtriangle(void) {
|
||||
for (int16_t i = 0; i < min(display.width(), display.height()) / 2; i += 5) {
|
||||
display.drawTriangle(display.width() / 2, display.height() / 2 - i,
|
||||
display.width() / 2 - i, display.height() / 2 + i,
|
||||
display.width() / 2 + i, display.height() / 2 + i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void testfilltriangle(void) {
|
||||
uint8_t color = SH110X_WHITE;
|
||||
for (int16_t i = min(display.width(), display.height()) / 2; i > 0; i -= 5) {
|
||||
display.fillTriangle(display.width() / 2, display.height() / 2 - i,
|
||||
display.width() / 2 - i, display.height() / 2 + i,
|
||||
display.width() / 2 + i, display.height() / 2 + i, SH110X_WHITE);
|
||||
if (color == SH110X_WHITE) color = SH110X_BLACK;
|
||||
else color = SH110X_WHITE;
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void testdrawroundrect(void) {
|
||||
for (int16_t i = 0; i < display.height() / 2 - 2; i += 2) {
|
||||
display.drawRoundRect(i, i, display.width() - 2 * i, display.height() - 2 * i, display.height() / 4, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void testfillroundrect(void) {
|
||||
uint8_t color = SH110X_WHITE;
|
||||
for (int16_t i = 0; i < display.height() / 2 - 2; i += 2) {
|
||||
display.fillRoundRect(i, i, display.width() - 2 * i, display.height() - 2 * i, display.height() / 4, color);
|
||||
if (color == SH110X_WHITE) color = SH110X_BLACK;
|
||||
else color = SH110X_WHITE;
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void testdrawrect(void) {
|
||||
for (int16_t i = 0; i < display.height() / 2; i += 2) {
|
||||
display.drawRect(i, i, display.width() - 2 * i, display.height() - 2 * i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void testdrawline() {
|
||||
for (int16_t i = 0; i < display.width(); i += 4) {
|
||||
display.drawLine(0, 0, i, display.height() - 1, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
for (int16_t i = 0; i < display.height(); i += 4) {
|
||||
display.drawLine(0, 0, display.width() - 1, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
delay(250);
|
||||
|
||||
display.clearDisplay();
|
||||
for (int16_t i = 0; i < display.width(); i += 4) {
|
||||
display.drawLine(0, display.height() - 1, i, 0, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
for (int16_t i = display.height() - 1; i >= 0; i -= 4) {
|
||||
display.drawLine(0, display.height() - 1, display.width() - 1, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
delay(250);
|
||||
|
||||
display.clearDisplay();
|
||||
for (int16_t i = display.width() - 1; i >= 0; i -= 4) {
|
||||
display.drawLine(display.width() - 1, display.height() - 1, i, 0, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
for (int16_t i = display.height() - 1; i >= 0; i -= 4) {
|
||||
display.drawLine(display.width() - 1, display.height() - 1, 0, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
delay(250);
|
||||
|
||||
display.clearDisplay();
|
||||
for (int16_t i = 0; i < display.height(); i += 4) {
|
||||
display.drawLine(display.width() - 1, 0, 0, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
for (int16_t i = 0; i < display.width(); i += 4) {
|
||||
display.drawLine(display.width() - 1, 0, i, display.height() - 1, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
delay(250);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
#include <SPI.h>
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SH110X.h>
|
||||
|
||||
Adafruit_SH1107 display = Adafruit_SH1107(64, 128, &Wire);
|
||||
|
||||
// OLED FeatherWing buttons map to different pins depending on board:
|
||||
#if defined(ESP8266)
|
||||
#define BUTTON_A 0
|
||||
#define BUTTON_B 16
|
||||
#define BUTTON_C 2
|
||||
#elif defined(ESP32) && !defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2)
|
||||
#define BUTTON_A 15
|
||||
#define BUTTON_B 32
|
||||
#define BUTTON_C 14
|
||||
#elif defined(ARDUINO_STM32_FEATHER)
|
||||
#define BUTTON_A PA15
|
||||
#define BUTTON_B PC7
|
||||
#define BUTTON_C PC5
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define BUTTON_A 4
|
||||
#define BUTTON_B 3
|
||||
#define BUTTON_C 8
|
||||
#elif defined(ARDUINO_NRF52832_FEATHER)
|
||||
#define BUTTON_A 31
|
||||
#define BUTTON_B 30
|
||||
#define BUTTON_C 27
|
||||
#else // 32u4, M0, M4, nrf52840, esp32-s2 and 328p
|
||||
#define BUTTON_A 9
|
||||
#define BUTTON_B 6
|
||||
#define BUTTON_C 5
|
||||
#endif
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
Serial.println("128x64 OLED FeatherWing test");
|
||||
delay(250); // wait for the OLED to power up
|
||||
display.begin(0x3C, true); // Address 0x3C default
|
||||
|
||||
Serial.println("OLED begun");
|
||||
|
||||
// Show image buffer on the display hardware.
|
||||
// Since the buffer is intialized with an Adafruit splashscreen
|
||||
// internally, this will display the splashscreen.
|
||||
display.display();
|
||||
delay(1000);
|
||||
|
||||
// Clear the buffer.
|
||||
display.clearDisplay();
|
||||
display.display();
|
||||
|
||||
display.setRotation(1);
|
||||
Serial.println("Button test");
|
||||
|
||||
pinMode(BUTTON_A, INPUT_PULLUP);
|
||||
pinMode(BUTTON_B, INPUT_PULLUP);
|
||||
pinMode(BUTTON_C, INPUT_PULLUP);
|
||||
|
||||
// text display tests
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(SH110X_WHITE);
|
||||
display.setCursor(0,0);
|
||||
display.print("Connecting to SSID\n'adafruit':");
|
||||
display.print("connected!");
|
||||
display.println("IP: 10.0.1.23");
|
||||
display.println("Sending val #0");
|
||||
display.display(); // actually display all of the above
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if(!digitalRead(BUTTON_A)) display.print("A");
|
||||
if(!digitalRead(BUTTON_B)) display.print("B");
|
||||
if(!digitalRead(BUTTON_C)) display.print("C");
|
||||
delay(10);
|
||||
yield();
|
||||
display.display();
|
||||
}
|
||||
@@ -0,0 +1,374 @@
|
||||
/*********************************************************************
|
||||
This is an example for our Monochrome OLEDs based on SH1107 drivers
|
||||
|
||||
This example is for a 128x128 size display using I2C to communicate
|
||||
|
||||
Adafruit invests time and resources providing this open source code,
|
||||
please support Adafruit and open-source hardware by purchasing
|
||||
products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
BSD license, check license.txt for more information
|
||||
All text above, and the splash screen must be included in any redistribution
|
||||
*********************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <SPI.h>
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SH110X.h>
|
||||
|
||||
#define SCREEN_WIDTH 128 // OLED display width, in pixels
|
||||
#define SCREEN_HEIGHT 128 // OLED display height, in pixels
|
||||
#define OLED_RESET -1 // can set an oled reset pin if desired
|
||||
Adafruit_SH1107 display = Adafruit_SH1107(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET, 1000000, 100000);
|
||||
|
||||
|
||||
#define NUMFLAKES 10
|
||||
#define XPOS 0
|
||||
#define YPOS 1
|
||||
#define DELTAY 2
|
||||
|
||||
|
||||
#define LOGO_HEIGHT 16
|
||||
#define LOGO_WIDTH 16
|
||||
static const unsigned char PROGMEM logo_bmp[] =
|
||||
{ 0b00000000, 0b11000000,
|
||||
0b00000001, 0b11000000,
|
||||
0b00000001, 0b11000000,
|
||||
0b00000011, 0b11100000,
|
||||
0b11110011, 0b11100000,
|
||||
0b11111110, 0b11111000,
|
||||
0b01111110, 0b11111111,
|
||||
0b00110011, 0b10011111,
|
||||
0b00011111, 0b11111100,
|
||||
0b00001101, 0b01110000,
|
||||
0b00011011, 0b10100000,
|
||||
0b00111111, 0b11100000,
|
||||
0b00111111, 0b11110000,
|
||||
0b01111100, 0b11110000,
|
||||
0b01110000, 0b01110000,
|
||||
0b00000000, 0b00110000 };
|
||||
|
||||
|
||||
void setup() {
|
||||
|
||||
Serial.begin(9600);
|
||||
|
||||
delay(250); // wait for the OLED to power up
|
||||
|
||||
// Show image buffer on the display hardware.
|
||||
// Since the buffer is intialized with an Adafruit splashscreen
|
||||
// internally, this will display the splashscreen.
|
||||
|
||||
display.begin(0x3D, true); // Address 0x3D default
|
||||
//display.setContrast (0); // dim display
|
||||
|
||||
display.display();
|
||||
delay(2000);
|
||||
|
||||
// Clear the buffer.
|
||||
display.clearDisplay();
|
||||
|
||||
// draw a single pixel
|
||||
display.drawPixel(10, 10, SH110X_WHITE);
|
||||
// Show the display buffer on the hardware.
|
||||
// NOTE: You _must_ call display after making any drawing commands
|
||||
// to make them visible on the display hardware!
|
||||
display.display();
|
||||
delay(2000);
|
||||
display.clearDisplay();
|
||||
|
||||
testdrawline(); // Draw many lines
|
||||
|
||||
testdrawrect(); // Draw rectangles (outlines)
|
||||
|
||||
testfillrect(); // Draw rectangles (filled)
|
||||
|
||||
testdrawcircle(); // Draw circles (outlines)
|
||||
|
||||
testfillcircle(); // Draw circles (filled)
|
||||
|
||||
testdrawroundrect(); // Draw rounded rectangles (outlines)
|
||||
|
||||
testfillroundrect(); // Draw rounded rectangles (filled)
|
||||
|
||||
testdrawtriangle(); // Draw triangles (outlines)
|
||||
|
||||
testfilltriangle(); // Draw triangles (filled)
|
||||
|
||||
testdrawchar(); // Draw characters of the default font
|
||||
|
||||
testdrawstyles(); // Draw 'stylized' characters
|
||||
|
||||
testdrawbitmap(); // Draw a small bitmap image
|
||||
|
||||
testanimate(logo_bmp, LOGO_WIDTH, LOGO_HEIGHT); // Animate bitmaps
|
||||
}
|
||||
|
||||
void loop() {
|
||||
}
|
||||
|
||||
void testdrawline() {
|
||||
int16_t i;
|
||||
|
||||
display.clearDisplay(); // Clear display buffer
|
||||
|
||||
for(i=0; i<display.width(); i+=4) {
|
||||
display.drawLine(0, 0, i, display.height()-1, SH110X_WHITE);
|
||||
display.display(); // Update screen with each newly-drawn line
|
||||
delay(1);
|
||||
}
|
||||
for(i=0; i<display.height(); i+=4) {
|
||||
display.drawLine(0, 0, display.width()-1, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
delay(250);
|
||||
|
||||
display.clearDisplay();
|
||||
|
||||
for(i=0; i<display.width(); i+=4) {
|
||||
display.drawLine(0, display.height()-1, i, 0, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
for(i=display.height()-1; i>=0; i-=4) {
|
||||
display.drawLine(0, display.height()-1, display.width()-1, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
delay(250);
|
||||
|
||||
display.clearDisplay();
|
||||
|
||||
for(i=display.width()-1; i>=0; i-=4) {
|
||||
display.drawLine(display.width()-1, display.height()-1, i, 0, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
for(i=display.height()-1; i>=0; i-=4) {
|
||||
display.drawLine(display.width()-1, display.height()-1, 0, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
delay(250);
|
||||
|
||||
display.clearDisplay();
|
||||
|
||||
for(i=0; i<display.height(); i+=4) {
|
||||
display.drawLine(display.width()-1, 0, 0, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
for(i=0; i<display.width(); i+=4) {
|
||||
display.drawLine(display.width()-1, 0, i, display.height()-1, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
|
||||
delay(2000); // Pause for 2 seconds
|
||||
}
|
||||
|
||||
void testdrawrect(void) {
|
||||
display.clearDisplay();
|
||||
|
||||
for(int16_t i=0; i<display.height()/2; i+=2) {
|
||||
display.drawRect(i, i, display.width()-2*i, display.height()-2*i, SH110X_WHITE);
|
||||
display.display(); // Update screen with each newly-drawn rectangle
|
||||
delay(1);
|
||||
}
|
||||
|
||||
delay(2000);
|
||||
}
|
||||
|
||||
void testfillrect(void) {
|
||||
display.clearDisplay();
|
||||
|
||||
for(int16_t i=0; i<display.height()/2; i+=3) {
|
||||
// The INVERSE color is used so rectangles alternate white/black
|
||||
display.fillRect(i, i, display.width()-i*2, display.height()-i*2, SH110X_INVERSE);
|
||||
display.display(); // Update screen with each newly-drawn rectangle
|
||||
delay(1);
|
||||
}
|
||||
|
||||
delay(2000);
|
||||
}
|
||||
|
||||
void testdrawcircle(void) {
|
||||
display.clearDisplay();
|
||||
|
||||
for(int16_t i=0; i<max(display.width(),display.height())/2; i+=2) {
|
||||
display.drawCircle(display.width()/2, display.height()/2, i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
|
||||
delay(2000);
|
||||
}
|
||||
|
||||
void testfillcircle(void) {
|
||||
display.clearDisplay();
|
||||
|
||||
for(int16_t i=max(display.width(),display.height())/2; i>0; i-=3) {
|
||||
// The INVERSE color is used so circles alternate white/black
|
||||
display.fillCircle(display.width() / 2, display.height() / 2, i, SH110X_INVERSE);
|
||||
display.display(); // Update screen with each newly-drawn circle
|
||||
delay(1);
|
||||
}
|
||||
|
||||
delay(2000);
|
||||
}
|
||||
|
||||
void testdrawroundrect(void) {
|
||||
display.clearDisplay();
|
||||
|
||||
for(int16_t i=0; i<display.height()/2-2; i+=2) {
|
||||
display.drawRoundRect(i, i, display.width()-2*i, display.height()-2*i,
|
||||
display.height()/4, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
|
||||
delay(2000);
|
||||
}
|
||||
|
||||
void testfillroundrect(void) {
|
||||
display.clearDisplay();
|
||||
|
||||
for(int16_t i=0; i<display.height()/2-2; i+=2) {
|
||||
// The INVERSE color is used so round-rects alternate white/black
|
||||
display.fillRoundRect(i, i, display.width()-2*i, display.height()-2*i,
|
||||
display.height()/4, SH110X_INVERSE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
|
||||
delay(2000);
|
||||
}
|
||||
|
||||
void testdrawtriangle(void) {
|
||||
display.clearDisplay();
|
||||
|
||||
for(int16_t i=0; i<max(display.width(),display.height())/2; i+=5) {
|
||||
display.drawTriangle(
|
||||
display.width()/2 , display.height()/2-i,
|
||||
display.width()/2-i, display.height()/2+i,
|
||||
display.width()/2+i, display.height()/2+i, SH110X_WHITE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
|
||||
delay(2000);
|
||||
}
|
||||
|
||||
void testfilltriangle(void) {
|
||||
display.clearDisplay();
|
||||
|
||||
for(int16_t i=max(display.width(),display.height())/2; i>0; i-=5) {
|
||||
// The INVERSE color is used so triangles alternate white/black
|
||||
display.fillTriangle(
|
||||
display.width()/2 , display.height()/2-i,
|
||||
display.width()/2-i, display.height()/2+i,
|
||||
display.width()/2+i, display.height()/2+i, SH110X_INVERSE);
|
||||
display.display();
|
||||
delay(1);
|
||||
}
|
||||
|
||||
delay(2000);
|
||||
}
|
||||
|
||||
void testdrawchar(void) {
|
||||
display.clearDisplay();
|
||||
|
||||
display.setTextSize(1); // Normal 1:1 pixel scale
|
||||
display.setTextColor(SH110X_WHITE); // Draw white text
|
||||
display.setCursor(0, 0); // Start at top-left corner
|
||||
display.cp437(true); // Use full 256 char 'Code Page 437' font
|
||||
|
||||
// Not all the characters will fit on the display. This is normal.
|
||||
// Library will draw what it can and the rest will be clipped.
|
||||
for(int16_t i=0; i<256; i++) {
|
||||
if(i == '\n') display.write(' ');
|
||||
else display.write(i);
|
||||
}
|
||||
|
||||
display.display();
|
||||
delay(2000);
|
||||
}
|
||||
|
||||
void testdrawstyles(void) {
|
||||
display.clearDisplay();
|
||||
|
||||
display.setTextSize(1); // Normal 1:1 pixel scale
|
||||
display.setTextColor(SH110X_WHITE); // Draw white text
|
||||
display.setCursor(0,0); // Start at top-left corner
|
||||
display.println(F("Hello, world!"));
|
||||
|
||||
display.setTextColor(SH110X_BLACK, SH110X_WHITE); // Draw 'inverse' text
|
||||
display.println(3.141592);
|
||||
|
||||
display.setTextSize(2); // Draw 2X-scale text
|
||||
display.setTextColor(SH110X_WHITE);
|
||||
display.print(F("0x")); display.println(0xDEADBEEF, HEX);
|
||||
|
||||
display.display();
|
||||
delay(2000);
|
||||
}
|
||||
|
||||
void testdrawbitmap(void) {
|
||||
display.clearDisplay();
|
||||
|
||||
display.drawBitmap(
|
||||
(display.width() - LOGO_WIDTH ) / 2,
|
||||
(display.height() - LOGO_HEIGHT) / 2,
|
||||
logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
|
||||
display.display();
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
#define XPOS 0 // Indexes into the 'icons' array in function below
|
||||
#define YPOS 1
|
||||
#define DELTAY 2
|
||||
|
||||
void testanimate(const uint8_t *bitmap, uint8_t w, uint8_t h) {
|
||||
int8_t f, icons[NUMFLAKES][3];
|
||||
|
||||
// Initialize 'snowflake' positions
|
||||
for(f=0; f< NUMFLAKES; f++) {
|
||||
icons[f][XPOS] = random(1 - LOGO_WIDTH, display.width());
|
||||
icons[f][YPOS] = -LOGO_HEIGHT;
|
||||
icons[f][DELTAY] = random(1, 6);
|
||||
Serial.print(F("x: "));
|
||||
Serial.print(icons[f][XPOS], DEC);
|
||||
Serial.print(F(" y: "));
|
||||
Serial.print(icons[f][YPOS], DEC);
|
||||
Serial.print(F(" dy: "));
|
||||
Serial.println(icons[f][DELTAY], DEC);
|
||||
}
|
||||
|
||||
for(;;) { // Loop forever...
|
||||
display.clearDisplay(); // Clear the display buffer
|
||||
|
||||
// Draw each snowflake:
|
||||
for(f=0; f< NUMFLAKES; f++) {
|
||||
display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, SH110X_WHITE);
|
||||
}
|
||||
|
||||
display.display(); // Show the display buffer on the screen
|
||||
delay(200); // Pause for 1/10 second
|
||||
|
||||
// Then update coordinates of each flake...
|
||||
for(f=0; f< NUMFLAKES; f++) {
|
||||
icons[f][YPOS] += icons[f][DELTAY];
|
||||
// If snowflake is off the bottom of the screen...
|
||||
if (icons[f][YPOS] >= display.height()) {
|
||||
// Reinitialize to a random position, just off the top
|
||||
icons[f][XPOS] = random(1 - LOGO_WIDTH, display.width());
|
||||
icons[f][YPOS] = -LOGO_HEIGHT;
|
||||
icons[f][DELTAY] = random(1, 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
10
libraries/Adafruit_SH110X/library.properties
Normal file
10
libraries/Adafruit_SH110X/library.properties
Normal file
@@ -0,0 +1,10 @@
|
||||
name=Adafruit SH110X
|
||||
version=2.1.10
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
sentence=SH110X oled driver library for monochrome displays with SH1107 or SH1106G drivers
|
||||
paragraph=SH110X oled driver library for monochrome displays with SH1107 or SH1106G drivers
|
||||
category=Display
|
||||
url=https://github.com/adafruit/Adafruit_SH110X
|
||||
architectures=*
|
||||
depends=Adafruit GFX Library, Adafruit BusIO
|
||||
26
libraries/Adafruit_SH110X/license.txt
Normal file
26
libraries/Adafruit_SH110X/license.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
Software License Agreement (BSD License)
|
||||
|
||||
Copyright (c) 2012, Adafruit Industries
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
210
libraries/Adafruit_SH110X/splash.h
Normal file
210
libraries/Adafruit_SH110X/splash.h
Normal file
@@ -0,0 +1,210 @@
|
||||
|
||||
#define splash1_width 82
|
||||
#define splash1_height 64
|
||||
|
||||
const uint8_t PROGMEM splash1_data[] = {
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000001,
|
||||
0b10000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000011, 0b10000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000111, 0b11000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000111, 0b11000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00001111, 0b11000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00011111, 0b11100000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00011111,
|
||||
0b11100000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00111111, 0b11100000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00111111, 0b11110000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b01111111, 0b11110000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00011111,
|
||||
0b11111000, 0b01111111, 0b11110000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00111111, 0b11111110,
|
||||
0b01111111, 0b11110000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00111111, 0b11111111, 0b01111111,
|
||||
0b11110000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00011111, 0b11111111, 0b11111011, 0b11100000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00001111, 0b11111111, 0b11111001, 0b11111111, 0b11000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00001111, 0b11111111, 0b11111001, 0b11111111, 0b11111000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000111,
|
||||
0b11111111, 0b11110001, 0b11111111, 0b11111111, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000011, 0b11111100,
|
||||
0b01110011, 0b11111111, 0b11111111, 0b10000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000001, 0b11111110, 0b00111111,
|
||||
0b11111111, 0b11111111, 0b10000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b11111111, 0b00011110, 0b00001111,
|
||||
0b11111111, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b01111111, 0b11111110, 0b00011111, 0b11111100,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00111111, 0b11111111, 0b11111111, 0b11111000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00001111, 0b11011111, 0b11111111, 0b11100000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00011111,
|
||||
0b00011001, 0b11111111, 0b11000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00111111, 0b00111100,
|
||||
0b11111111, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b01111110, 0b01111100, 0b11111000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b01111111, 0b11111110, 0b01111100, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b11111111, 0b11111111, 0b11111100, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b11111111, 0b11111111, 0b11111110, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b11111111,
|
||||
0b11111111, 0b11111110, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000001, 0b11111111, 0b11101111,
|
||||
0b11111110, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000001, 0b11111111, 0b11001111, 0b11111110,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000011, 0b11111111, 0b00000111, 0b11111110, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000011, 0b11111100, 0b00000111, 0b11111110, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000011,
|
||||
0b11110000, 0b00000011, 0b11111110, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000001, 0b10000000,
|
||||
0b00000000, 0b11111110, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b01111110, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00111110,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00001100, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000111,
|
||||
0b10000000, 0b00000000, 0b11111100, 0b00000000, 0b00000000, 0b00000011,
|
||||
0b11000000, 0b00000000, 0b00000000, 0b00000000, 0b00000111, 0b10000000,
|
||||
0b00000001, 0b11111100, 0b00000000, 0b00000000, 0b00000011, 0b11000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000111, 0b10000000, 0b00000001,
|
||||
0b11111100, 0b00000000, 0b00000000, 0b00000011, 0b11000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000111, 0b10000000, 0b00000001, 0b11100000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00011110, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000111, 0b10000000, 0b00000001, 0b11100000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00011110, 0b00000000, 0b01111111, 0b11100011,
|
||||
0b11110111, 0b10011111, 0b11111001, 0b11111101, 0b11100111, 0b01111000,
|
||||
0b01111011, 0b11011111, 0b11000000, 0b11111111, 0b11110111, 0b11111111,
|
||||
0b10111111, 0b11111101, 0b11111101, 0b11111111, 0b01111000, 0b01111011,
|
||||
0b11011111, 0b11000000, 0b11111111, 0b11110111, 0b11111111, 0b10111111,
|
||||
0b11111101, 0b11111101, 0b11111111, 0b01111000, 0b01111011, 0b11011111,
|
||||
0b11000000, 0b11110000, 0b11110111, 0b10000111, 0b10111100, 0b00111101,
|
||||
0b11100001, 0b11111111, 0b01111000, 0b01111011, 0b11011110, 0b00000000,
|
||||
0b11110000, 0b11110111, 0b10000111, 0b10111100, 0b00111101, 0b11100001,
|
||||
0b11110000, 0b01111000, 0b01111011, 0b11011110, 0b00000000, 0b00000000,
|
||||
0b11110111, 0b10000111, 0b10000000, 0b00111101, 0b11100001, 0b11100000,
|
||||
0b01111000, 0b01111011, 0b11011110, 0b00000000, 0b01111111, 0b11110111,
|
||||
0b10000111, 0b10011111, 0b11111101, 0b11100001, 0b11100000, 0b01111000,
|
||||
0b01111011, 0b11011110, 0b00000000, 0b11111111, 0b11110111, 0b10000111,
|
||||
0b10111111, 0b11111101, 0b11100001, 0b11100000, 0b01111000, 0b01111011,
|
||||
0b11011110, 0b00000000, 0b11110000, 0b11110111, 0b10000111, 0b10111100,
|
||||
0b00111101, 0b11100001, 0b11100000, 0b01111000, 0b01111011, 0b11011110,
|
||||
0b00000000, 0b11110000, 0b11110111, 0b10000111, 0b10111100, 0b00111101,
|
||||
0b11100001, 0b11100000, 0b01111000, 0b01111011, 0b11011110, 0b00000000,
|
||||
0b11110000, 0b11110111, 0b10000111, 0b10111100, 0b00111101, 0b11100001,
|
||||
0b11100000, 0b01111000, 0b01111011, 0b11011110, 0b00000000, 0b11111111,
|
||||
0b11110111, 0b11111111, 0b10111111, 0b11111101, 0b11100001, 0b11100000,
|
||||
0b01111111, 0b11111011, 0b11011111, 0b11000000, 0b11111111, 0b11110111,
|
||||
0b11111111, 0b10111111, 0b11111101, 0b11100001, 0b11100000, 0b01111111,
|
||||
0b11111011, 0b11011111, 0b11000000, 0b01111100, 0b11110011, 0b11110011,
|
||||
0b10011111, 0b00111101, 0b11100001, 0b11100000, 0b00111110, 0b01111011,
|
||||
0b11001111, 0b11000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
||||
0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11000000,
|
||||
0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111101, 0b01101000,
|
||||
0b11011011, 0b00010001, 0b00011010, 0b00110001, 0b11000000, 0b11111111,
|
||||
0b11111111, 0b11111111, 0b11111111, 0b11111101, 0b00101011, 0b01011010,
|
||||
0b11111011, 0b01101010, 0b11101111, 0b11000000, 0b11111111, 0b11111111,
|
||||
0b11111111, 0b11111111, 0b11111101, 0b01001011, 0b01011011, 0b00111011,
|
||||
0b00011010, 0b00110011, 0b11000000, 0b11111111, 0b11111111, 0b11111111,
|
||||
0b11111111, 0b11111101, 0b01101011, 0b01011011, 0b11011011, 0b01101010,
|
||||
0b11111101, 0b11000000,
|
||||
};
|
||||
|
||||
#define splash2_width 115
|
||||
#define splash2_height 32
|
||||
|
||||
const uint8_t PROGMEM splash2_data[] = {
|
||||
0b00000000, 0b00000000, 0b01100000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b11100000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000001, 0b11100000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000001, 0b11110000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000011, 0b11110000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000111, 0b11110000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000111, 0b11111000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00001111, 0b11111000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000011, 0b11000000, 0b00000000,
|
||||
0b01111110, 0b00000000, 0b00000000, 0b00000001, 0b11100000, 0b00000000,
|
||||
0b01111111, 0b00001111, 0b11111000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000011, 0b11000000, 0b00000000, 0b11111110, 0b00000000, 0b00000000,
|
||||
0b00000001, 0b11100000, 0b00000000, 0b11111111, 0b11101111, 0b11111000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000011, 0b11000000, 0b00000000,
|
||||
0b11111110, 0b00000000, 0b00000000, 0b00000001, 0b11100000, 0b00000000,
|
||||
0b11111111, 0b11111111, 0b11111000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000011, 0b11000000, 0b00000000, 0b11110000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00001111, 0b00000000, 0b01111111, 0b11111110, 0b01111111,
|
||||
0b11000000, 0b00000000, 0b00000000, 0b00000011, 0b11000000, 0b00000000,
|
||||
0b11110000, 0b00000000, 0b00000000, 0b00000000, 0b00001111, 0b00000000,
|
||||
0b00111111, 0b11111110, 0b01111111, 0b11111000, 0b00111111, 0b11110001,
|
||||
0b11111011, 0b11001111, 0b11111100, 0b11111110, 0b11110011, 0b10111100,
|
||||
0b00111101, 0b11101111, 0b11100000, 0b00011111, 0b11111110, 0b01111111,
|
||||
0b11111111, 0b01111111, 0b11111011, 0b11111111, 0b11011111, 0b11111110,
|
||||
0b11111110, 0b11111111, 0b10111100, 0b00111101, 0b11101111, 0b11100000,
|
||||
0b00011111, 0b11000110, 0b11111111, 0b11111111, 0b01111111, 0b11111011,
|
||||
0b11111111, 0b11011111, 0b11111110, 0b11111110, 0b11111111, 0b10111100,
|
||||
0b00111101, 0b11101111, 0b11100000, 0b00001111, 0b11100011, 0b11000111,
|
||||
0b11111110, 0b01111000, 0b01111011, 0b11000011, 0b11011110, 0b00011110,
|
||||
0b11110000, 0b11111111, 0b10111100, 0b00111101, 0b11101111, 0b00000000,
|
||||
0b00000111, 0b11111111, 0b10000111, 0b11111100, 0b01111000, 0b01111011,
|
||||
0b11000011, 0b11011110, 0b00011110, 0b11110000, 0b11111000, 0b00111100,
|
||||
0b00111101, 0b11101111, 0b00000000, 0b00000001, 0b11111111, 0b11111111,
|
||||
0b11110000, 0b00000000, 0b01111011, 0b11000011, 0b11000000, 0b00011110,
|
||||
0b11110000, 0b11110000, 0b00111100, 0b00111101, 0b11101111, 0b00000000,
|
||||
0b00000001, 0b11110011, 0b01111111, 0b11100000, 0b00111111, 0b11111011,
|
||||
0b11000011, 0b11001111, 0b11111110, 0b11110000, 0b11110000, 0b00111100,
|
||||
0b00111101, 0b11101111, 0b00000000, 0b00000011, 0b11100011, 0b00111111,
|
||||
0b10000000, 0b01111111, 0b11111011, 0b11000011, 0b11011111, 0b11111110,
|
||||
0b11110000, 0b11110000, 0b00111100, 0b00111101, 0b11101111, 0b00000000,
|
||||
0b00000111, 0b11100111, 0b00111100, 0b00000000, 0b01111000, 0b01111011,
|
||||
0b11000011, 0b11011110, 0b00011110, 0b11110000, 0b11110000, 0b00111100,
|
||||
0b00111101, 0b11101111, 0b00000000, 0b00000111, 0b11111111, 0b10111110,
|
||||
0b00000000, 0b01111000, 0b01111011, 0b11000011, 0b11011110, 0b00011110,
|
||||
0b11110000, 0b11110000, 0b00111100, 0b00111101, 0b11101111, 0b00000000,
|
||||
0b00000111, 0b11111111, 0b11111110, 0b00000000, 0b01111000, 0b01111011,
|
||||
0b11000011, 0b11011110, 0b00011110, 0b11110000, 0b11110000, 0b00111100,
|
||||
0b00111101, 0b11101111, 0b00000000, 0b00001111, 0b11111111, 0b11111110,
|
||||
0b00000000, 0b01111111, 0b11111011, 0b11111111, 0b11011111, 0b11111110,
|
||||
0b11110000, 0b11110000, 0b00111111, 0b11111101, 0b11101111, 0b11100000,
|
||||
0b00001111, 0b11111111, 0b11111111, 0b00000000, 0b01111111, 0b11111011,
|
||||
0b11111111, 0b11011111, 0b11111110, 0b11110000, 0b11110000, 0b00111111,
|
||||
0b11111101, 0b11101111, 0b11100000, 0b00001111, 0b11111001, 0b11111111,
|
||||
0b00000000, 0b00111110, 0b01111001, 0b11111001, 0b11001111, 0b10011110,
|
||||
0b11110000, 0b11110000, 0b00011111, 0b00111101, 0b11100111, 0b11100000,
|
||||
0b00011111, 0b11110001, 0b11111111, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00011111, 0b10000000, 0b11111111,
|
||||
0b00000000, 0b01111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
||||
0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11100000,
|
||||
0b00011100, 0b00000000, 0b01111111, 0b00000000, 0b01111111, 0b11111111,
|
||||
0b11111111, 0b11111111, 0b11111110, 0b10110100, 0b01101101, 0b10001000,
|
||||
0b10001101, 0b00011000, 0b11100000, 0b00000000, 0b00000000, 0b00011111,
|
||||
0b00000000, 0b01111111, 0b11111111, 0b11111111, 0b11111111, 0b11111110,
|
||||
0b10010101, 0b10101101, 0b01111101, 0b10110101, 0b01110111, 0b11100000,
|
||||
0b00000000, 0b00000000, 0b00001111, 0b00000000, 0b01111111, 0b11111111,
|
||||
0b11111111, 0b11111111, 0b11111110, 0b10100101, 0b10101101, 0b10011101,
|
||||
0b10001101, 0b00011001, 0b11100000, 0b00000000, 0b00000000, 0b00000110,
|
||||
0b00000000, 0b01111111, 0b11111111, 0b11111111, 0b11111111, 0b11111110,
|
||||
0b10110101, 0b10101101, 0b11101101, 0b10110101, 0b01111110, 0b11100000,
|
||||
};
|
||||
Reference in New Issue
Block a user