Skip to content

Commit 1fa29a1

Browse files
Merge pull request #106 from H-sw123/master
add esp_oled_ssd1315 oled component
2 parents e7721dd + d28a7f4 commit 1fa29a1

File tree

14 files changed

+1063
-0
lines changed

14 files changed

+1063
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1a2829e9db4e0515bad6ce83368f199dec60519fbba40251d6c8249f5d070ae1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ChangeLog
2+
3+
### Enhancements:
4+
5+
* Adapted by waveshare electronics according to [esp_oled_ssd1315](https://components.espressif.com/components/waveshare/esp_oled_ssd1315)
6+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
idf_component_register(SRCS "esp_oled_ssd1315.c" INCLUDE_DIRS "include" PRIV_REQUIRES "driver" REQUIRES "esp_lcd")
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Waveshare ESP32-S3-LR1121-OLED-0.96 Display Support
2+
3+
[![Component Registry](https://components.espressif.com/components/waveshare/esp_oled_ssd1315/badge.svg)](https://components.espressif.com/components/waveshare/esp_oled_ssd1315)
4+
5+
Waveshare ESP32-S3-LR1121-OLED-0.96 Display used I2C
6+
7+
| OLED controller | Communication interface | Component name | Link to datasheet |
8+
| :------------: |:-----------------------:| :------------: | :---------------------------------------------------------------------------: |
9+
| SSD1315 | I2C | esp_oled_ssd1315 | [PDF](https://files.waveshare.com/upload/f/f0/SSD1315_1.1.pdf) |
10+
11+
## Add to project
12+
13+
Packages from this repository are uploaded to [Espressif's component service](https://components.espressif.com/).
14+
You can add them to your project via `idf.py add-dependancy`, e.g.
15+
```
16+
idf.py add-dependency "waveshare/esp_oled_ssd1315"
17+
```
18+
19+
Alternatively, you can create `idf_component.yml`. More is in [Espressif's documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-component-manager.html).
20+
21+
22+
## Initialization Code
23+
24+
25+
### I2C Interface
26+
27+
```c
28+
ESP_LOGI(TAG, "Initialize I2C bus");
29+
ESP_LOGI(TAG, "I2C Configuration: SDA=GPIO%d, SCL=GPIO%d, Freq=%dHz, Timeout=%dms",
30+
TEST_PIN_NUM_OLED_SDA, TEST_PIN_NUM_OLED_SCL, TEST_OLED_PIXEL_CLOCK_HZ, TEST_DELAY_TIME_MS);
31+
ESP_LOGI(TAG, "Display Configuration: Address=0x%02X",
32+
TEST_OLED_I2C_HW_ADDR);
33+
34+
i2c_master_bus_handle_t i2c_bus_handle = NULL;
35+
i2c_master_bus_config_t bus_config = {
36+
.clk_source = I2C_CLK_SRC_DEFAULT,
37+
.glitch_ignore_cnt = 7,
38+
.i2c_port = TEST_OLED_HOST,
39+
.sda_io_num = TEST_PIN_NUM_OLED_SDA,
40+
.scl_io_num = TEST_PIN_NUM_OLED_SCL,
41+
.flags.enable_internal_pullup = true,
42+
};
43+
44+
/* Create I2C master bus */
45+
ESP_ERROR_CHECK(i2c_new_master_bus(&bus_config, &i2c_bus_handle));
46+
47+
ESP_LOGI(TAG, "Install panel IO");
48+
esp_lcd_panel_io_handle_t io_handle = NULL;
49+
esp_lcd_panel_io_i2c_config_t io_config = {
50+
.dev_addr = TEST_OLED_I2C_HW_ADDR,
51+
.scl_speed_hz = TEST_OLED_PIXEL_CLOCK_HZ,
52+
.control_phase_bytes = 1, // According to SSD1306 datasheet
53+
.lcd_cmd_bits = TEST_OLED_CMD_BITS, // According to SSD1306 datasheet
54+
.lcd_param_bits = TEST_OLED_CMD_BITS, // According to SSD1306 datasheet
55+
.dc_bit_offset = 6, // According to SSD1306 datasheet
56+
57+
};
58+
ESP_ERROR_CHECK(esp_lcd_new_panel_io_i2c(i2c_bus_handle, &io_config, &io_handle));
59+
60+
ESP_LOGI(TAG, "Install SSD1315 panel driver");
61+
esp_lcd_panel_handle_t panel_handle = NULL;
62+
esp_lcd_panel_dev_config_t panel_config = {
63+
.bits_per_pixel = 1,
64+
.reset_gpio_num = TEST_PIN_NUM_OLED_RST,
65+
};
66+
67+
esp_lcd_panel_ssd1315_config_t ssd1315_config = {
68+
.height = TEST_OLED_V_RES,
69+
};
70+
panel_config.vendor_config = &ssd1315_config;
71+
ESP_ERROR_CHECK(esp_lcd_new_panel_ssd1315(io_handle, &panel_config, &panel_handle));
72+
73+
ESP_ERROR_CHECK(esp_lcd_panel_init(panel_handle));
74+
ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle,true));
75+
ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(panel_handle, true));
76+
```
77+
78+
## Notes
79+

0 commit comments

Comments
 (0)