Skip to content

Commit d1e0baf

Browse files
Version 1.6.1
1 parent 1145030 commit d1e0baf

File tree

5 files changed

+30
-25
lines changed

5 files changed

+30
-25
lines changed

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
2. C++, g++ (Debian 12.2.0)
4343
3. Raspbian , Debian 12 bookworm OS, , 64 bit.
4444
4. kernel : aarch64 Linux 6.1.0-rpi7-rpi-v8
45-
5. [bcm2835 Library 1.71 dependency](http://www.airspayce.com/mikem/bcm2835/). Provides low level I2C bus, delays and GPIO control.
45+
5. [bcm2835 Library 1.74 dependency](http://www.airspayce.com/mikem/bcm2835/). Provides low level I2C bus, delays and GPIO control.
4646

4747

4848
## Installation
@@ -57,14 +57,14 @@
5757
* Run following command to download from github.
5858

5959
```sh
60-
curl -sL https://github.com/gavinlyonsrepo/SSD1306_OLED_RPI/archive/1.6.tar.gz | tar xz
60+
curl -sL https://github.com/gavinlyonsrepo/SSD1306_OLED_RPI/archive/1.6.1.tar.gz | tar xz
6161
```
6262

6363
3. Run "make" to run the makefile in repo base folder to install library, it will be
6464
installed to usr/lib and usr/include
6565

6666
```sh
67-
cd SSD1306_OLED_RPI-1.6
67+
cd SSD1306_OLED_RPI-1.6.1
6868
make
6969
sudo make install
7070
```
@@ -108,10 +108,8 @@ Manufacturers diagram showing connections.
108108

109109
### API Documentation
110110

111-
The API (application programming interface) documentation is at link hosted on github pages and generated by Doxygen software.
112-
Lots of information on the software.
113-
114-
[ API URL Link](https://gavinlyonsrepo.github.io/misc/software_docs/SSD1306_OLED_RPI/index.html)
111+
The Software is commented for "doxygen". If users uses "doxygen" software
112+
an application programming interface document can be generated.
115113

116114
### I2C
117115

@@ -198,3 +196,8 @@ variables in examples files.
198196
| 128x64 | Yes | Yes |
199197
| 128x32 | Yes | Yes |
200198
| ???x16 | Yes | NO |
199+
200+
201+
## See Also
202+
203+
[Combined Display library 'Display_Lib_RPI'](https://github.com/gavinlyonsrepo/Display_Lib_RPI)

examples/src/OLED_FUNCTIONS/main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,17 @@ void Test()
161161
myOLED.OLEDclearBuffer();
162162
myOLED.setCursor(5,5 );
163163
myOLED.print("rotate 90");
164+
myOLED.setCursor(5,110);
165+
myOLED.print("bottom");
164166
myOLED.OLEDupdate();
165167
bcm2835_delay(3000);
166168

167169
myOLED.setRotation(OLED_Degrees_180);
168170
myOLED.OLEDclearBuffer();
169171
myOLED.setCursor(5,5 );
170172
myOLED.print("rotate 180");
173+
myOLED.setCursor(5,50);
174+
myOLED.print("bottom");
171175
myOLED.OLEDupdate();
172176
bcm2835_delay(3000);
173177

@@ -176,13 +180,17 @@ void Test()
176180
myOLED.OLEDclearBuffer();
177181
myOLED.setCursor(5,5 );
178182
myOLED.print("rotate 270");
183+
myOLED.setCursor(5,110);
184+
myOLED.print("bottom");
179185
myOLED.OLEDupdate();
180186
bcm2835_delay(3000);
181187

182188
myOLED.setRotation(OLED_Degrees_0); //default normal
183189
myOLED.OLEDclearBuffer();
184190
myOLED.setCursor(5,5 );
185191
myOLED.print("rotate 0");
192+
myOLED.setCursor(5,50);
193+
myOLED.print("bottom");
186194
myOLED.OLEDupdate();
187195
bcm2835_delay(3000);
188196

extras/doc/CHANGELOG.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
* version 1.0.0 May 2021
44
* first release.
5-
* Version 1.1 June 2021
6-
* packaged library files as a dynamic C++ install-able system level library complete with makefile.
7-
* version 1.2 July 2021
8-
* Added Large Numerical fonts (7&8) and changed print class functionality so print class works with them.
95
* version 1.3 Jan 2023
106
* Added Fonts, tiny and homespun.
117
* Added "Drawtext" method
@@ -22,7 +18,10 @@
2218
* Refactored I2C bus control to give user more control and visibility.
2319
* Changed CCFLAGS in root directory Makefile to allow for Compilation on 64-bit systems. See Pull request number 2 on github
2420
* Fixed bug in "println" method for String objects.
25-
* version 1.6 Feb 2024
21+
* version 1.6 Jan 2024
2622
* Added Fonts 11 and 12
2723
* Added Error enum OLED_return_codes_e to text and bitmap methods.
2824
* Added User ability to change I2C error delay and retry attempts.
25+
* version 1.6.1 Feb 2024
26+
* minor update, modified the screen boundary check in 'drawPixel' method
27+
so 90 and 270 degree screen rotation works fully for entire rotated screen area.

include/SSD1306_OLED.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,11 @@ class SSD1306 : public SSD1306_graphics {
141141
uint8_t _I2C_ErrorRetryNum = 3; /**< In event of I2C error number of retry attempts*/
142142
uint8_t _I2C_ErrorFlag = 0x00; /**< In event of I2C error holds bcm2835 I2C reason code 0x00 = success*/
143143

144-
uint16_t _LibraryVersionNum = 160; /**< Library version number */
144+
uint16_t _LibraryVersionNum = 161; /**< Library version number */
145145

146-
int16_t _OLED_WIDTH; /**< Width of OLED Screen in pixels */
147-
int16_t _OLED_HEIGHT; /**< Height of OLED Screen in pixels */
148-
int8_t _OLED_PAGE_NUM; /**< Number of byte size pages OLED screen is divided into */
149-
uint8_t bufferWidth ; /**< Width of Screen Buffer */
150-
uint8_t bufferHeight ; /**< Height of Screen Buffer */
146+
uint8_t _OLED_WIDTH=128; /**< Width of OLED Screen in pixels */
147+
uint8_t _OLED_HEIGHT=64; /**< Height of OLED Screen in pixels */
148+
uint8_t _OLED_PAGE_NUM=(_OLED_HEIGHT/8); /**< Number of byte size pages OLED screen is divided into */
151149

152150
uint8_t* OLEDbuffer = nullptr; /**< pointer to buffer which holds screen data */
153151

src/SSD1306_OLED.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ SSD1306::SSD1306(int16_t oledwidth, int16_t oledheight) :SSD1306_graphics(oledwi
1717
_OLED_HEIGHT = oledheight;
1818
_OLED_WIDTH = oledwidth;
1919
_OLED_PAGE_NUM = (_OLED_HEIGHT/8);
20-
bufferWidth = _OLED_WIDTH;
21-
bufferHeight = _OLED_HEIGHT;
2220
}
2321

2422
/*!
@@ -369,8 +367,7 @@ void SSD1306::I2C_Write_Byte(uint8_t value, uint8_t cmd)
369367
*/
370368
void SSD1306::OLEDupdate()
371369
{
372-
uint8_t x = 0; uint8_t y = 0; uint8_t w = this->bufferWidth; uint8_t h = this->bufferHeight;
373-
//OLEDBufferScreen( x, y, w, h, (uint8_t*) this->OLEDbuffer); TODO
370+
uint8_t x = 0; uint8_t y = 0; uint8_t w = this->_OLED_WIDTH; uint8_t h = this->_OLED_HEIGHT;
374371
OLEDBufferScreen( x, y, w, h, this->OLEDbuffer);
375372
}
376373

@@ -379,7 +376,7 @@ void SSD1306::OLEDupdate()
379376
*/
380377
void SSD1306::OLEDclearBuffer()
381378
{
382-
memset( this->OLEDbuffer, 0x00, (this->bufferWidth * (this->bufferHeight /8)));
379+
memset( this->OLEDbuffer, 0x00, (this->_OLED_WIDTH * (this->_OLED_HEIGHT /8)));
383380
}
384381

385382
/*!
@@ -434,7 +431,7 @@ void SSD1306::OLEDBufferScreen(int16_t x, int16_t y, uint8_t w, uint8_t h, uint8
434431
void SSD1306::drawPixel(int16_t x, int16_t y, uint8_t color)
435432
{
436433

437-
if ((x < 0) || (x >= this->bufferWidth) || (y < 0) || (y >= this->bufferHeight)) {
434+
if ((x < 0) || (x >= this->_width) || (y < 0) || (y >= this->_height)) {
438435
return;
439436
}
440437
int16_t temp;
@@ -455,7 +452,7 @@ void SSD1306::drawPixel(int16_t x, int16_t y, uint8_t color)
455452
y = HEIGHT - 1 - temp;
456453
break;
457454
}
458-
uint16_t tc = (bufferWidth * (y /8)) + x;
455+
uint16_t tc = (_OLED_WIDTH * (y /8)) + x;
459456
switch (color)
460457
{
461458
case WHITE: this->OLEDbuffer[tc] |= (1 << (y & 7)); break;

0 commit comments

Comments
 (0)