Skip to content

Commit 2ba5cb6

Browse files
committed
ESP-IDF example and README update
1 parent 70c29be commit 2ba5cb6

10 files changed

+1983
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
.vscode
2+
.vs
23
.pio
4+
out

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ The init sequence for the SSD1306 was inspired by Adafruit's library for the sam
3131
## mbed-os
3232
This library has been adopted to support the ARM mbed-os environment. A copy of this library is available in mbed-os under the name OLED_SSD1306 by Helmut Tschemernjak. An alternate installation option is to copy the following files into your mbed-os project: OLEDDisplay.cpp OLEDDisplay.h OLEDDisplayFonts.h OLEDDisplayUi.cpp OLEDDisplayUi.h SSD1306I2C.h
3333

34+
## ESP-IDF (Espressif IoT Development Framework)
35+
This library has been adopted to support Espressif IoT Development Framework (ESP-IDF). See [the example](#esp-idf-example) below and in the `examples\ESP-IDF` directory.
36+
3437
## Usage
3538

3639
Check out the examples folder for a few comprehensive demonstrations how to use the library. Also check out the [ESP8266 Weather Station](https://github.com/ThingPulse/esp8266-weather-station) library which uses the OLED library to display beautiful weather information.
@@ -131,6 +134,33 @@ SH1106Spi display(D0, D2, CS); // RES, DC, CS
131134

132135
In case the CS pin is not used (hard wired to ground), pass CS as -1.
133136

137+
138+
### <a name="esp-idf-example"></a>ESP-IDF (Espressif IoT Development Framework) on PlatformIO
139+
140+
`platformIO.ini` example:
141+
```
142+
[env:nodemcu-32s]
143+
platform = espressif32@^6.3.0
144+
board = nodemcu-32s
145+
framework = espidf
146+
lib_deps =
147+
;https://github.com/ThingPulse/esp8266-oled-ssd1306.git@^4.5.0 ; will works only with the new version of the library
148+
;ThingPulse/esp8266-oled-ssd1306^4.5.0 ; will works only with the new version of the library
149+
https://github.com/osmanovv/esp-idf-oled.git#70c29beb4fa42d2b9045d1da110cf5d9b46fa166 ; my fork for testing purpose - remove
150+
```
151+
152+
Then use `SSD1306I2C` implementation in your code:
153+
```C++
154+
#include <SSD1306I2C.h>
155+
156+
static const uint8_t SSD1306_ADDRESS = 0x3C;
157+
static const gpio_num_t SDA = 21;
158+
static const gpio_num_t SCL = 22;
159+
160+
SSD1306I2C display(SSD1306_ADDRESS, SDA, SCL);
161+
```
162+
163+
134164
## API
135165
136166
### Display Control

examples/ESP-IDF/.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.pio
2+
.vscode/.browse.c_cpp.db*
3+
.vscode/c_cpp_properties.json
4+
.vscode/launch.json
5+
.vscode/ipch

examples/ESP-IDF/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cmake_minimum_required(VERSION 3.16.0)
2+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
3+
project(ESPIDFDemo)

examples/ESP-IDF/platformio.ini

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
; PlatformIO Project Configuration File
2+
;
3+
; Build options: build flags, source filter
4+
; Upload options: custom upload port, speed and extra flags
5+
; Library options: dependencies, extra library storages
6+
; Advanced options: extra scripting
7+
;
8+
; Please visit documentation for the other options and examples
9+
; https://docs.platformio.org/page/projectconf.html
10+
11+
[env:nodemcu-32s]
12+
platform = espressif32@^6.3.0
13+
board = nodemcu-32s
14+
framework = espidf
15+
lib_deps =
16+
;https://github.com/ThingPulse/esp8266-oled-ssd1306.git@^4.5.0 ; will works only with the new version of the library
17+
;ThingPulse/esp8266-oled-ssd1306^4.5.0 ; will works only with the new version of the library
18+
https://github.com/osmanovv/esp-idf-oled.git#70c29beb4fa42d2b9045d1da110cf5d9b46fa166 ; my fork for testing purpose

0 commit comments

Comments
 (0)