Add QP support for smaller OLED displays and SSD1306 (#22358)

master
David Hoelscher 2023-12-06 07:06:58 -06:00 committed by GitHub
parent 8ba46dcf61
commit 18630b741e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 15 deletions

View File

@ -19,18 +19,20 @@ The QMK CLI can be used to convert from normal images such as PNG files or anima
Supported devices:
| Display Panel | Panel Type | Size | Comms Transport | Driver |
|---------------|--------------------|------------------|-----------------|------------------------------------------|
| GC9A01 | RGB LCD (circular) | 240x240 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += gc9a01_spi` |
| ILI9163 | RGB LCD | 128x128 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += ili9163_spi` |
| ILI9341 | RGB LCD | 240x320 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += ili9341_spi` |
| ILI9488 | RGB LCD | 320x480 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += ili9488_spi` |
| SSD1351 | RGB OLED | 128x128 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += ssd1351_spi` |
| ST7735 | RGB LCD | 132x162, 80x160 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += st7735_spi` |
| ST7789 | RGB LCD | 240x320, 240x240 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += st7789_spi` |
| SH1106 (SPI) | Monochrome OLED | 128x64 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += sh1106_spi` |
| SH1106 (I2C) | Monochrome OLED | 128x64 | I2C | `QUANTUM_PAINTER_DRIVERS += sh1106_i2c` |
| Surface | Virtual | User-defined | None | `QUANTUM_PAINTER_DRIVERS += surface` |
| Display Panel | Panel Type | Size | Comms Transport | Driver |
|----------------|--------------------|------------------|-----------------|------------------------------------------|
| GC9A01 | RGB LCD (circular) | 240x240 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += gc9a01_spi` |
| ILI9163 | RGB LCD | 128x128 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += ili9163_spi` |
| ILI9341 | RGB LCD | 240x320 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += ili9341_spi` |
| ILI9488 | RGB LCD | 320x480 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += ili9488_spi` |
| SSD1351 | RGB OLED | 128x128 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += ssd1351_spi` |
| ST7735 | RGB LCD | 132x162, 80x160 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += st7735_spi` |
| ST7789 | RGB LCD | 240x320, 240x240 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += st7789_spi` |
| SH1106 (SPI) | Monochrome OLED | 128x64 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += sh1106_spi` |
| SH1106 (I2C) | Monochrome OLED | 128x64 | I2C | `QUANTUM_PAINTER_DRIVERS += sh1106_i2c` |
| SSD1306 (SPI) | Monochrome OLED | 128x64 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS += sh1106_spi` |
| SSD1306 (I2C) | Monochrome OLED | 128x32 | I2C | `QUANTUM_PAINTER_DRIVERS += sh1106_i2c` |
| Surface | Virtual | User-defined | None | `QUANTUM_PAINTER_DRIVERS += surface` |
## Quantum Painter Configuration :id=quantum-painter-config
@ -433,6 +435,10 @@ The maximum number of displays of each type can be configured by changing the fo
Native color format mono2 is compatible with SH1106
#### ** SSD1306 **
SSD1306 and SH1106 are almost entirely identical, to the point of being indisinguishable by Quantum Painter. Enable SH1106 support in Quantum Painter and create SH1106 devices in firmware to perform drawing operations on SSD1306 displays.
<!-- tabs:end -->
### ** Surface **

View File

@ -44,7 +44,7 @@ __attribute__((weak)) bool qp_sh1106_init(painter_device_t device, painter_rotat
}
// clang-format off
const uint8_t sh1106_init_sequence[] = {
uint8_t sh1106_init_sequence[] = {
// Command, Delay, N, Data[N]
SH1106_SET_MUX_RATIO, 0, 1, 0x3F,
SH1106_DISPLAY_OFFSET, 0, 1, 0x00,
@ -61,6 +61,16 @@ __attribute__((weak)) bool qp_sh1106_init(painter_device_t device, painter_rotat
};
// clang-format on
// If the display height is anything other than the default 64 pixels, change SH1106_SET_MUX_RATIO data byte to the correct value
if (driver->oled.base.panel_height != 64) {
sh1106_init_sequence[3] = driver->oled.base.panel_height - 1;
}
// For 128x32 or 96x16 displays, change SH1106_COM_PADS_HW_CFG data byte from alternative (0x12) to sequential (0x02) configuration
if (driver->oled.base.panel_height <= 32) {
sh1106_init_sequence[20] = 0x02;
}
qp_comms_bulk_command_sequence(device, sh1106_init_sequence, sizeof(sh1106_init_sequence));
return true;
}
@ -203,4 +213,4 @@ painter_device_t qp_sh1106_make_i2c_device(uint16_t panel_width, uint16_t panel_
return NULL;
}
#endif // QUANTUM_PAINTER_SH1106_SPI_ENABLE
#endif // QUANTUM_PAINTER_SH1106_I2C_ENABLE

View File

@ -16,7 +16,7 @@
#define SH1106_COM_PADS_HW_CFG 0xDA
#define SH1106_SET_CONTRAST 0x81
#define SH1106_SET_PRECHARGE_PERIOD 0xD9
#define SH1106_VCOM_DETECT 0xDB
#define SH1106_VCOM_DESELECT_LEVEL 0xDB
#define SH1106_ALL_ON_RESUME 0xA4
#define SH1106_NON_INVERTING_DISPLAY 0xA6
#define SH1106_DEACTIVATE_SCROLL 0x2E