Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gavinlyonsrepo/ssd1306_oled_pico
SSD1306 OLED controller for the Raspberry PI PICO rp2040 C++ SDK
https://github.com/gavinlyonsrepo/ssd1306_oled_pico
128x64 cplusplus display display-library library oled oled-display oled-display-ssd1306 oled-screens oled-ssd1306 pico pico-sdk raspberry-pi rp2040 rpi rpi-pico sdk ssd1306 ssd1306-oled ssd1306-oled-example
Last synced: 8 days ago
JSON representation
SSD1306 OLED controller for the Raspberry PI PICO rp2040 C++ SDK
- Host: GitHub
- URL: https://github.com/gavinlyonsrepo/ssd1306_oled_pico
- Owner: gavinlyonsrepo
- License: gpl-3.0
- Created: 2023-12-19T21:18:18.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-03-23T11:13:17.000Z (8 months ago)
- Last Synced: 2024-03-23T12:45:01.765Z (8 months ago)
- Topics: 128x64, cplusplus, display, display-library, library, oled, oled-display, oled-display-ssd1306, oled-screens, oled-ssd1306, pico, pico-sdk, raspberry-pi, rp2040, rpi, rpi-pico, sdk, ssd1306, ssd1306-oled, ssd1306-oled-example
- Language: C++
- Homepage: https://gavinlyonsrepo.github.io/
- Size: 1.83 MB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![ OLED ](https://github.com/gavinlyonsrepo/SSD1306_OLED_RPI/blob/main/extras/image/device.jpg)
# SSD1306_OLED_PICO
## Table of contents
* [Overview](#overview)
* [Test](#test)
* [Software](#software)
* [API](#api)
* [I2C](#i2c)
* [Fonts](#fonts)
* [Bitmaps](#bitmaps)
* [Screenshots](#screenshots)## Overview
* Name : SSD1306_OLED_RPI
* Description :0. Library to support the I2C OLED Display Module
driven by the SSD1306 controller for the Raspberry PI PICO rp2040
1. Invert color, rotate, sleep, scroll and contrast control.
2. 10 fonts included, fonts can easily be added or removed.
3. Graphics class included.
4. Bitmaps supported.
5. Can support both I2C ports. IC20 or IC21 selected by user.
6. Tested on 128X64 & 128X32 display size. Should work for 96X16 display size.
7. Polymorphic print class included to print many data types.* Author: Gavin Lyons
* Developed on Toolchain:
1. Raspberry pi PICO RP2040
2. SDK(1.4.0) C++20
3. compiler G++ for arm-none-eabi((15:10.3-2021.07-4)
4. CMAKE(VERSION 3.18) , VScode(1.84.2)
5. Linux Mint 21.2
## TestThere are 9 example files included. User picks the one they want
by editing the CMakeLists.txt :: add_executable(${PROJECT_NAME} section. Comment in one path and one path only.| Filename | File Function | Screen Size |
| ---- | ---- | ---- |
| HELLO | Basic use case | 128x64 |
| HELLO_128_32 | Basic use case | 128x32 |
| BITMAP | Shows use of bitmaps | 128x64 |
| CLOCK_DEMO | A basic clock Demo | 128x64 |
| FUNCTIONS |Test OLED functionality: scroll, rotate etc | 128x64 |
| SPEED_TEST | Frame rate per second test | 128x64 |
| TEXT |Tests Text & fonts | 128x64 |
| GRAPHICS | Tests graphics | 128x64 |
| I2C_TEST | I2C interface testing | 128x64 |## Software
### API
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_PICO/index.html)
### I2C
Hardware I2C.
1. I2C Address is set by default to 0x3C(your module could be different,
user can change argument passed into "OLEDbegin" method).2. Can support both I2C ports. IC20 or IC21 selected by user.
3. I2C Clock rate can be a passed into in the "OLEDbegin" method as a argument in Kilo hertz.
| Frame rate per second example file results | I2C clock rate KiloHetrz |
| --- | --- |
| 5 | 100 |
| 12 | 400 |4. The user must also specify the data and clk lines which are linked to the interface used
In all the examples the I2C is set up for ::
Address 0x3C , Interface I2C1 , Clock speed 100Khz, Data pin GPIO 18, Clock pin GPIO 19 .
### FontsThere are 10 fonts packaged with library. Fonts can be easily added or removed by user.
All the Font data is in file SSD1306_OLED_font.cpp and SSD1306_OLED_font.hppFont data table:
| num | Font pointer name | character size XxY | ASCII range | Size in bytes |
| ------ | ------ | ------ | ------ | ------ |
| 1 | pFontDefault | 6x8 | 0 - 0xFE, Full Extended | 1534 |
| 2 | pFontWide | 9x8 | 0x20 - 0x5A, NO lowercase letters | 535 |
| 3 | pFontPico | 4x6 | 0x20 - 0x7E | 289 |
| 4 | pFontSinclairS | 8x8 | 0x20 - 0x7E | 764 |
| 5 | pFontMega | 16x16 | 0x20 - 0x7E | 3044 |
| 6 | pFontArialBold | 16x16 | 0x20 - 0x7E | 3044 |
| 7 | pFontHallfetica | 16x16 | 0x20 - 0x7E | 3044 |
| 8 | pFontArialRound| 16x24 | 0x20 - 0x7E | 4564 |
| 9 | pFontGroTesk | 16x32 | 0x20 - 0x7A | 5828 |
| 10 | pFontSixteenSeg | 32x48 | 0x2D-0x3A , 0-10 : . / - only | 2692 |Font size in bytes = ((X * (Y/8)) * numberOfCharacters) + (4*ControlByte)
| Font class Function | Notes |
| ------ | ------ |
| writeChar| draws single character |
| writeCharString | draws character array |
| print | Polymorphic print class which will print out many data types |These methods return an error code in event of an error such as, ASCII character outside chosen fonts range, character out of screen bounds and invalid character array pointer object.
**Remove a font**
To remove an unwanted font from project simply comment out or delete.
1. The Font data in SSD1306_OLED_font.cpp file
2. The pointer to font at bottom of SSD1306_OLED_font.cpp file
3. The associated extern pointer declaration in the SSD1306_OLED_font.hpp file**Adding a new font**
1. Add the Font data in SSD1306_OLED_font.cpp file
2. Add a pointer to font at bottom of SSD1306_OLED_font.cpp file
3. Add an associated extern pointer declaration in the SSD1306_OLED_font.hpp fileThe new ASCII font must have following font structure.
First 4 bytes are control bytes followed by vertically addressed font data.```
// An 4 by 8 character size font starting at
// ASCII offset 0x30 in ASCII table with 0x02 characters in font.
// 0 and 1
static const uint8_t FontBinaryExample[] =
{
0x04, 0x08, 0x30, 0x02, // x-size, y-size, offset, total characters
(data),(data),(data),(data) // font data '0'
(data),(data),(data),(data) // font data '1'
}
```Some of the fonts packaged with library came from [URL](http://rinkydinkelectronics.com/).
If you have picture of font like so.![ font ](https://github.com/gavinlyonsrepo/SSD1306_OLED_PICO/blob/main/extra/image/hallfetica_normal.png)
There is a monochrome font maker there at [URL](http://rinkydinkelectronics.com/t_make_font_file_mono.php)
### Bitmaps
OLEDBitmap function will return an error if : The Bitmap is completely off screen , Invalid Bitmap pointer object, bitmap bigger than screen , bitmap bigger/smaller than provided width and height calculation ( This helps prevents buffer overflow). A horizontal addressed Bitmap's width MUST be divisible by 8. eg, for a bitmap with width=88 and height=48. Bitmap excepted size = (88/8) * 48 = 528 bytes.
Bitmaps can be turned to data [here at link]( https://javl.github.io/image2cpp/)
See example file "_BITMAP" for more details.## Screenshots
![ ss ](https://github.com/gavinlyonsrepo/SSD1306_OLED_PICO/blob/main/extra/image/3.jpg)