mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 21:44:55 +01:00
Add SH1107_128x64 to the ssd1306 component (#2967)
This commit is contained in:
parent
9124d9d6e6
commit
8ad06fb9ea
3 changed files with 18 additions and 3 deletions
|
@ -31,6 +31,7 @@ MODELS = {
|
|||
"SH1106_128X64": SSD1306Model.SH1106_MODEL_128_64,
|
||||
"SH1106_96X16": SSD1306Model.SH1106_MODEL_96_16,
|
||||
"SH1106_64X48": SSD1306Model.SH1106_MODEL_64_48,
|
||||
"SH1107_128X64": SSD1306Model.SH1107_MODEL_128_64,
|
||||
"SSD1305_128X32": SSD1306Model.SSD1305_MODEL_128_32,
|
||||
"SSD1305_128X64": SSD1306Model.SSD1305_MODEL_128_64,
|
||||
}
|
||||
|
@ -61,8 +62,8 @@ SSD1306_SCHEMA = display.FULL_DISPLAY_SCHEMA.extend(
|
|||
cv.Optional(CONF_EXTERNAL_VCC): cv.boolean,
|
||||
cv.Optional(CONF_FLIP_X, default=True): cv.boolean,
|
||||
cv.Optional(CONF_FLIP_Y, default=True): cv.boolean,
|
||||
cv.Optional(CONF_OFFSET_X, default=0): cv.int_range(min=0, max=15),
|
||||
cv.Optional(CONF_OFFSET_Y, default=0): cv.int_range(min=0, max=15),
|
||||
cv.Optional(CONF_OFFSET_X, default=0): cv.int_range(min=-32, max=32),
|
||||
cv.Optional(CONF_OFFSET_Y, default=0): cv.int_range(min=-32, max=32),
|
||||
cv.Optional(CONF_INVERT, default=False): cv.boolean,
|
||||
}
|
||||
).extend(cv.polling_component_schema("1s"))
|
||||
|
|
|
@ -96,6 +96,7 @@ void SSD1306::setup() {
|
|||
case SSD1306_MODEL_64_48:
|
||||
case SSD1306_MODEL_64_32:
|
||||
case SH1106_MODEL_64_48:
|
||||
case SH1107_MODEL_128_64:
|
||||
case SSD1305_MODEL_128_32:
|
||||
case SSD1305_MODEL_128_64:
|
||||
this->command(0x12);
|
||||
|
@ -111,7 +112,14 @@ void SSD1306::setup() {
|
|||
|
||||
// Set V_COM (0xDB)
|
||||
this->command(SSD1306_COMMAND_SET_VCOM_DETECT);
|
||||
this->command(0x00);
|
||||
switch (this->model_) {
|
||||
case SH1107_MODEL_128_64:
|
||||
this->command(0x35);
|
||||
break;
|
||||
default:
|
||||
this->command(0x00);
|
||||
break;
|
||||
}
|
||||
|
||||
// Display output follow RAM (0xA4)
|
||||
this->command(SSD1306_COMMAND_DISPLAY_ALL_ON_RESUME);
|
||||
|
@ -198,6 +206,8 @@ void SSD1306::turn_off() {
|
|||
}
|
||||
int SSD1306::get_height_internal() {
|
||||
switch (this->model_) {
|
||||
case SH1107_MODEL_128_64:
|
||||
return 128;
|
||||
case SSD1306_MODEL_128_32:
|
||||
case SSD1306_MODEL_64_32:
|
||||
case SH1106_MODEL_128_32:
|
||||
|
@ -232,6 +242,7 @@ int SSD1306::get_width_internal() {
|
|||
case SSD1306_MODEL_64_48:
|
||||
case SSD1306_MODEL_64_32:
|
||||
case SH1106_MODEL_64_48:
|
||||
case SH1107_MODEL_128_64:
|
||||
return 64;
|
||||
default:
|
||||
return 0;
|
||||
|
@ -289,6 +300,8 @@ const char *SSD1306::model_str_() {
|
|||
return "SH1106 96x16";
|
||||
case SH1106_MODEL_64_48:
|
||||
return "SH1106 64x48";
|
||||
case SH1107_MODEL_128_64:
|
||||
return "SH1107 128x64";
|
||||
case SSD1305_MODEL_128_32:
|
||||
return "SSD1305 128x32";
|
||||
case SSD1305_MODEL_128_64:
|
||||
|
|
|
@ -17,6 +17,7 @@ enum SSD1306Model {
|
|||
SH1106_MODEL_128_64,
|
||||
SH1106_MODEL_96_16,
|
||||
SH1106_MODEL_64_48,
|
||||
SH1107_MODEL_128_64,
|
||||
SSD1305_MODEL_128_32,
|
||||
SSD1305_MODEL_128_64,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue