Compare commits
No commits in common. "master" and "actionci" have entirely different histories.
6 changed files with 44 additions and 103 deletions
6
.github/workflows/githubci.yml
vendored
6
.github/workflows/githubci.yml
vendored
|
|
@ -7,11 +7,11 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-python@v4
|
||||
- uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
path: ci
|
||||
|
|
|
|||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,5 +1,4 @@
|
|||
# Our handy .gitignore for automation ease
|
||||
Doxyfile*
|
||||
doxygen_sqlite3.db
|
||||
html
|
||||
.DS_Store
|
||||
html
|
||||
|
|
@ -26,12 +26,11 @@
|
|||
*/
|
||||
|
||||
#include "Adafruit_SSD1331.h"
|
||||
#include "pins_arduino.h"
|
||||
#include "wiring_private.h"
|
||||
|
||||
/***********************************/
|
||||
|
||||
#define ssd1331_swap(a, b) \
|
||||
(((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b))) ///< No-temp-var swap operation
|
||||
|
||||
/*!
|
||||
@brief SPI displays set an address window rectangle for blitting pixels
|
||||
@param x Top left corner x coordinate
|
||||
|
|
@ -41,42 +40,41 @@
|
|||
*/
|
||||
void Adafruit_SSD1331::setAddrWindow(uint16_t x, uint16_t y, uint16_t w,
|
||||
uint16_t h) {
|
||||
|
||||
uint8_t x1 = x;
|
||||
uint8_t y1 = y;
|
||||
if (x1 > _width - 1)
|
||||
x1 = _width - 1;
|
||||
if (y1 > _height - 1)
|
||||
y1 = _height - 1;
|
||||
if (x1 > 95)
|
||||
x1 = 95;
|
||||
if (y1 > 63)
|
||||
y1 = 63;
|
||||
|
||||
uint8_t x2 = (x + w - 1);
|
||||
uint8_t y2 = (y + h - 1);
|
||||
if (x2 > _width - 1)
|
||||
x2 = _width - 1;
|
||||
if (y2 > _height - 1)
|
||||
y2 = _height - 1;
|
||||
if (x2 > 95)
|
||||
x2 = 95;
|
||||
if (y2 > 63)
|
||||
y2 = 63;
|
||||
|
||||
if (x1 > x2) {
|
||||
ssd1331_swap(x1, x2);
|
||||
uint8_t t = x2;
|
||||
x2 = x1;
|
||||
x1 = t;
|
||||
}
|
||||
if (y1 > y2) {
|
||||
ssd1331_swap(y1, y2);
|
||||
uint8_t t = y2;
|
||||
y2 = y1;
|
||||
y1 = t;
|
||||
}
|
||||
|
||||
if (rotation & 1) { // Vertical address increment mode
|
||||
ssd1331_swap(x1, y1);
|
||||
ssd1331_swap(x2, y2);
|
||||
}
|
||||
sendCommand(0x15); // Column addr set
|
||||
sendCommand(x1);
|
||||
sendCommand(x2);
|
||||
|
||||
SPI_DC_LOW(); // Command mode
|
||||
sendCommand(0x75); // Column addr set
|
||||
sendCommand(y1);
|
||||
sendCommand(y2);
|
||||
|
||||
spiWrite(SSD1331_CMD_SETCOLUMN); // Column addr set
|
||||
spiWrite(x1);
|
||||
spiWrite(x2);
|
||||
|
||||
spiWrite(SSD1331_CMD_SETROW); // Row addr set
|
||||
spiWrite(y1);
|
||||
spiWrite(y2);
|
||||
SPI_DC_HIGH(); // Exit Command mode
|
||||
startWrite();
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
|
|
@ -92,7 +90,12 @@ void Adafruit_SSD1331::begin(uint32_t freq) {
|
|||
// Initialization Sequence
|
||||
sendCommand(SSD1331_CMD_DISPLAYOFF); // 0xAE
|
||||
sendCommand(SSD1331_CMD_SETREMAP); // 0xA0
|
||||
sendCommand(SSD1331_CMD_STARTLINE); // 0xA1
|
||||
#if defined SSD1331_COLORORDER_RGB
|
||||
sendCommand(0x72); // RGB Color
|
||||
#else
|
||||
sendCommand(0x76); // BGR Color
|
||||
#endif
|
||||
sendCommand(SSD1331_CMD_STARTLINE); // 0xA1
|
||||
sendCommand(0x0);
|
||||
sendCommand(SSD1331_CMD_DISPLAYOFFSET); // 0xA2
|
||||
sendCommand(0x0);
|
||||
|
|
@ -129,7 +132,6 @@ void Adafruit_SSD1331::begin(uint32_t freq) {
|
|||
sendCommand(SSD1331_CMD_DISPLAYON); //--turn on oled panel
|
||||
_width = TFTWIDTH;
|
||||
_height = TFTHEIGHT;
|
||||
setRotation(0);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
|
|
@ -171,9 +173,9 @@ Adafruit_SSD1331::Adafruit_SSD1331(SPIClass *spi, int8_t cs, int8_t dc,
|
|||
int8_t rst)
|
||||
:
|
||||
#if defined(ESP8266)
|
||||
Adafruit_SPITFT(TFTWIDTH, TFTHEIGHT, cs, dc, rst) {
|
||||
Adafruit_SPITFT(TFTWIDTH, TFTWIDTH, cs, dc, rst) {
|
||||
#else
|
||||
Adafruit_SPITFT(TFTWIDTH, TFTHEIGHT, spi, cs, dc, rst) {
|
||||
Adafruit_SPITFT(TFTWIDTH, TFTWIDTH, spi, cs, dc, rst) {
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -186,62 +188,3 @@ Adafruit_SSD1331::Adafruit_SSD1331(SPIClass *spi, int8_t cs, int8_t dc,
|
|||
void Adafruit_SSD1331::enableDisplay(boolean enable) {
|
||||
sendCommand(enable ? SSD1331_CMD_DISPLAYON : SSD1331_CMD_DISPLAYOFF);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Set origin of (0,0) and orientation of OLED display
|
||||
@param r
|
||||
The index for rotation, from 0-3 inclusive
|
||||
@return None (void).
|
||||
@note SSD1331 works differently than most (all?) other SPITFT
|
||||
displays. With certain rotation changes the screen contents
|
||||
may change immediately into a peculiar format (mirrored, not
|
||||
necessarily rotated) (other displays, this only affects new
|
||||
drawing -- rotation combinations can apply to different
|
||||
areas). Therefore, it's recommend to clear the screen
|
||||
(fillScreen(0)) before changing rotation.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void Adafruit_SSD1331::setRotation(uint8_t r) {
|
||||
// madctl bits:
|
||||
// 6,7 Color depth (01 = 64K)
|
||||
// 5 Odd/even split COM (0: disable, 1: enable)
|
||||
// 4 Scan direction (0: top-down, 1: bottom-up)
|
||||
// 3 Left-Right swapping on COM (0: disable, 1: enable)
|
||||
// 2 Color remap (0: A->B->C, 1: C->B->A)
|
||||
// 1 Column remap (0: 0-95, 1: 95-0)
|
||||
// 0 Address increment (0: horizontal, 1: vertical)
|
||||
|
||||
#if defined SSD1331_COLORORDER_RGB
|
||||
uint8_t madctl = 0b01100000; // 64K, enable split, ABC
|
||||
#else
|
||||
uint8_t madctl = 0b01100100; // 64K, enable split, CBA
|
||||
#endif
|
||||
rotation = r & 3; // Clip input to valid range
|
||||
|
||||
switch (rotation) {
|
||||
case 0:
|
||||
madctl |= 0b00010010; // Scan bottom-up, column remap 95-0
|
||||
_width = WIDTH;
|
||||
_height = HEIGHT;
|
||||
break;
|
||||
case 1:
|
||||
madctl |= 0b00000011; // column remap 95-0, vertical
|
||||
_width = HEIGHT;
|
||||
_height = WIDTH;
|
||||
break;
|
||||
case 2:
|
||||
madctl |= 0b00000000; // None
|
||||
_width = WIDTH;
|
||||
_height = HEIGHT;
|
||||
break;
|
||||
case 3:
|
||||
madctl |= 0b00010001; // Scan bottom-up, Vertical
|
||||
_width = HEIGHT;
|
||||
_height = WIDTH;
|
||||
break;
|
||||
}
|
||||
|
||||
sendCommand(SSD1331_CMD_SETREMAP);
|
||||
sendCommand(madctl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@
|
|||
* @file Adafruit_SSD1331.h
|
||||
*/
|
||||
|
||||
#ifndef ADAFRUIT_SSD1331_H
|
||||
#define ADAFRUIT_SSD1331_H
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SPITFT.h>
|
||||
#include <Adafruit_SPITFT_Macros.h>
|
||||
#include <SPI.h>
|
||||
|
||||
/*!
|
||||
* @brief Select one of these defines to set the pixel color order
|
||||
|
|
@ -14,7 +15,7 @@
|
|||
// #define SSD1331_COLORORDER_BGR
|
||||
|
||||
#if defined SSD1331_COLORORDER_RGB && defined SSD1331_COLORORDER_BGR
|
||||
#error "RGB and BGR can not both be defined for SSD1331_COLORORDER."
|
||||
#error "RGB and BGR can not both be defined for SSD1331_COLORODER."
|
||||
#endif
|
||||
|
||||
// Timing Delays
|
||||
|
|
@ -62,7 +63,7 @@ public:
|
|||
|
||||
// commands
|
||||
void begin(uint32_t begin = 8000000);
|
||||
void setRotation(uint8_t r);
|
||||
|
||||
void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
||||
|
||||
void enableDisplay(boolean enable);
|
||||
|
|
@ -72,5 +73,3 @@ public:
|
|||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif // ADAFRUIT_SSD1331_H
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# Adafruit SSD1331 Arduino Library [](https://github.com/adafruit/Adafruit-SSD1331-OLED-Driver-Library-for-Arduino/actions)[](http://adafruit.github.io/Adafruit-SSD1331-OLED-Driver-Library-for-Arduino/html/index.html)
|
||||
# Adafruit SSD1331 Arduino Library [](https://github.com/adafruit/Adafruit_SSD1331/actions)[](http://adafruit.github.io/Adafruit-SSD1331-OLED-Driver-Library-for-Arduino/html/index.html)
|
||||
This is a library for the 0.96" 16-bit Color OLED with SSD1331 driver chip
|
||||
|
||||
Pick one up today in the adafruit shop!
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
name=Adafruit SSD1331 OLED Driver Library for Arduino
|
||||
version=1.3.0
|
||||
version=1.2.0
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
sentence=For 0.96" OLEDs in the Adafruit shop
|
||||
|
|
|
|||
Loading…
Reference in a new issue