Skip to content

Commit

Permalink
Version 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinlyonsrepo committed Feb 11, 2024
1 parent 1145030 commit d1e0baf
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 25 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
2. C++, g++ (Debian 12.2.0)
3. Raspbian , Debian 12 bookworm OS, , 64 bit.
4. kernel : aarch64 Linux 6.1.0-rpi7-rpi-v8
5. [bcm2835 Library 1.71 dependency](http://www.airspayce.com/mikem/bcm2835/). Provides low level I2C bus, delays and GPIO control.
5. [bcm2835 Library 1.74 dependency](http://www.airspayce.com/mikem/bcm2835/). Provides low level I2C bus, delays and GPIO control.


## Installation
Expand All @@ -57,14 +57,14 @@
* Run following command to download from github.

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

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

```sh
cd SSD1306_OLED_RPI-1.6
cd SSD1306_OLED_RPI-1.6.1
make
sudo make install
```
Expand Down Expand Up @@ -108,10 +108,8 @@ Manufacturers diagram showing connections.

### API Documentation

The API (application programming interface) documentation is at link hosted on github pages and generated by Doxygen software.
Lots of information on the software.

[ API URL Link](https://gavinlyonsrepo.github.io/misc/software_docs/SSD1306_OLED_RPI/index.html)
The Software is commented for "doxygen". If users uses "doxygen" software
an application programming interface document can be generated.

### I2C

Expand Down Expand Up @@ -198,3 +196,8 @@ variables in examples files.
| 128x64 | Yes | Yes |
| 128x32 | Yes | Yes |
| ???x16 | Yes | NO |


## See Also

[Combined Display library 'Display_Lib_RPI'](https://github.com/gavinlyonsrepo/Display_Lib_RPI)
8 changes: 8 additions & 0 deletions examples/src/OLED_FUNCTIONS/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,17 @@ void Test()
myOLED.OLEDclearBuffer();
myOLED.setCursor(5,5 );
myOLED.print("rotate 90");
myOLED.setCursor(5,110);
myOLED.print("bottom");
myOLED.OLEDupdate();
bcm2835_delay(3000);

myOLED.setRotation(OLED_Degrees_180);
myOLED.OLEDclearBuffer();
myOLED.setCursor(5,5 );
myOLED.print("rotate 180");
myOLED.setCursor(5,50);
myOLED.print("bottom");
myOLED.OLEDupdate();
bcm2835_delay(3000);

Expand All @@ -176,13 +180,17 @@ void Test()
myOLED.OLEDclearBuffer();
myOLED.setCursor(5,5 );
myOLED.print("rotate 270");
myOLED.setCursor(5,110);
myOLED.print("bottom");
myOLED.OLEDupdate();
bcm2835_delay(3000);

myOLED.setRotation(OLED_Degrees_0); //default normal
myOLED.OLEDclearBuffer();
myOLED.setCursor(5,5 );
myOLED.print("rotate 0");
myOLED.setCursor(5,50);
myOLED.print("bottom");
myOLED.OLEDupdate();
bcm2835_delay(3000);

Expand Down
9 changes: 4 additions & 5 deletions extras/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

* version 1.0.0 May 2021
* first release.
* Version 1.1 June 2021
* packaged library files as a dynamic C++ install-able system level library complete with makefile.
* version 1.2 July 2021
* Added Large Numerical fonts (7&8) and changed print class functionality so print class works with them.
* version 1.3 Jan 2023
* Added Fonts, tiny and homespun.
* Added "Drawtext" method
Expand All @@ -22,7 +18,10 @@
* Refactored I2C bus control to give user more control and visibility.
* Changed CCFLAGS in root directory Makefile to allow for Compilation on 64-bit systems. See Pull request number 2 on github
* Fixed bug in "println" method for String objects.
* version 1.6 Feb 2024
* version 1.6 Jan 2024
* Added Fonts 11 and 12
* Added Error enum OLED_return_codes_e to text and bitmap methods.
* Added User ability to change I2C error delay and retry attempts.
* version 1.6.1 Feb 2024
* minor update, modified the screen boundary check in 'drawPixel' method
so 90 and 270 degree screen rotation works fully for entire rotated screen area.
10 changes: 4 additions & 6 deletions include/SSD1306_OLED.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,11 @@ class SSD1306 : public SSD1306_graphics {
uint8_t _I2C_ErrorRetryNum = 3; /**< In event of I2C error number of retry attempts*/
uint8_t _I2C_ErrorFlag = 0x00; /**< In event of I2C error holds bcm2835 I2C reason code 0x00 = success*/

uint16_t _LibraryVersionNum = 160; /**< Library version number */
uint16_t _LibraryVersionNum = 161; /**< Library version number */

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

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

Expand Down
11 changes: 4 additions & 7 deletions src/SSD1306_OLED.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ SSD1306::SSD1306(int16_t oledwidth, int16_t oledheight) :SSD1306_graphics(oledwi
_OLED_HEIGHT = oledheight;
_OLED_WIDTH = oledwidth;
_OLED_PAGE_NUM = (_OLED_HEIGHT/8);
bufferWidth = _OLED_WIDTH;
bufferHeight = _OLED_HEIGHT;
}

/*!
Expand Down Expand Up @@ -369,8 +367,7 @@ void SSD1306::I2C_Write_Byte(uint8_t value, uint8_t cmd)
*/
void SSD1306::OLEDupdate()
{
uint8_t x = 0; uint8_t y = 0; uint8_t w = this->bufferWidth; uint8_t h = this->bufferHeight;
//OLEDBufferScreen( x, y, w, h, (uint8_t*) this->OLEDbuffer); TODO
uint8_t x = 0; uint8_t y = 0; uint8_t w = this->_OLED_WIDTH; uint8_t h = this->_OLED_HEIGHT;
OLEDBufferScreen( x, y, w, h, this->OLEDbuffer);
}

Expand All @@ -379,7 +376,7 @@ void SSD1306::OLEDupdate()
*/
void SSD1306::OLEDclearBuffer()
{
memset( this->OLEDbuffer, 0x00, (this->bufferWidth * (this->bufferHeight /8)));
memset( this->OLEDbuffer, 0x00, (this->_OLED_WIDTH * (this->_OLED_HEIGHT /8)));
}

/*!
Expand Down Expand Up @@ -434,7 +431,7 @@ void SSD1306::OLEDBufferScreen(int16_t x, int16_t y, uint8_t w, uint8_t h, uint8
void SSD1306::drawPixel(int16_t x, int16_t y, uint8_t color)
{

if ((x < 0) || (x >= this->bufferWidth) || (y < 0) || (y >= this->bufferHeight)) {
if ((x < 0) || (x >= this->_width) || (y < 0) || (y >= this->_height)) {
return;
}
int16_t temp;
Expand All @@ -455,7 +452,7 @@ void SSD1306::drawPixel(int16_t x, int16_t y, uint8_t color)
y = HEIGHT - 1 - temp;
break;
}
uint16_t tc = (bufferWidth * (y /8)) + x;
uint16_t tc = (_OLED_WIDTH * (y /8)) + x;
switch (color)
{
case WHITE: this->OLEDbuffer[tc] |= (1 << (y & 7)); break;
Expand Down

0 comments on commit d1e0baf

Please sign in to comment.