Added support for OLED display 72x40px

* Small OLED display with ssd1306 driver and resolution 72x40px must be
  added into list of supported displays. Also some shift in video ram must
  be added.

Signed-off-by: Tomas Zahradnik <tomas.zahradnik@centrum.cz>
This commit is contained in:
Tomas Zahradnik 2022-09-19 09:46:30 +02:00
parent 74674fa043
commit 98dda967e8
2 changed files with 12 additions and 2 deletions

View File

@ -570,6 +570,13 @@ boolean Adafruit_SSD1306::begin(uint8_t vcs, uint8_t addr, boolean reset,
SSD1306_SETCONTRAST }; // 0x81
ssd1306_commandList(init4d, sizeof(init4d));
ssd1306_command1((vccstate == SSD1306_EXTERNALVCC) ? 0x9F : 0xCF);
} else if((WIDTH == 72) && (HEIGHT == 40)) {
static const uint8_t PROGMEM init4d[] = {
SSD1306_SETCOMPINS, // 0xDA
0x12,
SSD1306_SETCONTRAST }; // 0x81
ssd1306_commandList(init4d, sizeof(init4d));
ssd1306_command1((vccstate == SSD1306_EXTERNALVCC) ? 0x9F : 0xCF);
} else {
// Other screen varieties -- TBD
}
@ -931,6 +938,9 @@ void Adafruit_SSD1306::display(void) {
if ((64 == WIDTH) && (48 == HEIGHT)) { // for 64x48, we need to shift by 32 in both directions
col_start += 32;
col_end += 32;
} else if ((72 == WIDTH) && (40 == HEIGHT)) { // for 72x40, we need to shift by 27 in both directions
col_start += 27;
col_end += 27;
}
TRANSACTION_START

View File

@ -64,10 +64,10 @@ void SSD1306InitDriver(void) {
if (XDSP_02 == Settings->display_model) {
I2cSetActiveFound(Settings->display_address[0], "SSD1306");
if ((Settings->display_width != 64) && (Settings->display_width != 96) && (Settings->display_width != 128)) {
if ((Settings->display_width != 72) && (Settings->display_width != 64) && (Settings->display_width != 96) && (Settings->display_width != 128)) {
Settings->display_width = 128;
}
if ((Settings->display_height != 16) && (Settings->display_height != 32) && (Settings->display_height != 48) && (Settings->display_height != 64)) {
if ((Settings->display_height != 40) && (Settings->display_height != 16) && (Settings->display_height != 32) && (Settings->display_height != 48) && (Settings->display_height != 64)) {
Settings->display_height = 64;
}