Add QP support for smaller OLED displays and SSD1306 (#22358)
This commit is contained in:
parent
8ba46dcf61
commit
18630b741e
3 changed files with 31 additions and 15 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue