mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 16:08:10 +01:00
Support inkplate 5 and 5 V2 (#7448)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
parent
cc53eb42b2
commit
294fe8d970
2 changed files with 32 additions and 2 deletions
|
@ -53,6 +53,8 @@ MODELS = {
|
|||
"inkplate_10": InkplateModel.INKPLATE_10,
|
||||
"inkplate_6_plus": InkplateModel.INKPLATE_6_PLUS,
|
||||
"inkplate_6_v2": InkplateModel.INKPLATE_6_V2,
|
||||
"inkplate_5": InkplateModel.INKPLATE_5,
|
||||
"inkplate_5_v2": InkplateModel.INKPLATE_5_V2,
|
||||
}
|
||||
|
||||
CONFIG_SCHEMA = cv.All(
|
||||
|
|
|
@ -15,6 +15,8 @@ enum InkplateModel : uint8_t {
|
|||
INKPLATE_10 = 1,
|
||||
INKPLATE_6_PLUS = 2,
|
||||
INKPLATE_6_V2 = 3,
|
||||
INKPLATE_5 = 4,
|
||||
INKPLATE_5_V2 = 5,
|
||||
};
|
||||
|
||||
class Inkplate6 : public display::DisplayBuffer, public i2c::I2CDevice {
|
||||
|
@ -29,7 +31,7 @@ class Inkplate6 : public display::DisplayBuffer, public i2c::I2CDevice {
|
|||
const uint8_t pixelMaskLUT[8] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
|
||||
const uint8_t pixelMaskGLUT[2] = {0x0F, 0xF0};
|
||||
|
||||
const uint8_t waveform3BitAll[4][8][9] = {// INKPLATE_6
|
||||
const uint8_t waveform3BitAll[6][8][9] = {// INKPLATE_6
|
||||
{{0, 1, 1, 0, 0, 1, 1, 0, 0},
|
||||
{0, 1, 2, 1, 1, 2, 1, 0, 0},
|
||||
{1, 1, 1, 2, 2, 1, 0, 0, 0},
|
||||
|
@ -64,7 +66,25 @@ class Inkplate6 : public display::DisplayBuffer, public i2c::I2CDevice {
|
|||
{1, 1, 1, 1, 2, 2, 1, 0, 0},
|
||||
{0, 1, 1, 1, 2, 2, 1, 0, 0},
|
||||
{0, 0, 0, 0, 1, 1, 2, 0, 0},
|
||||
{0, 0, 0, 0, 0, 1, 2, 0, 0}}};
|
||||
{0, 0, 0, 0, 0, 1, 2, 0, 0}},
|
||||
// INKPLATE_5
|
||||
{{0, 0, 1, 1, 0, 1, 1, 1, 0},
|
||||
{0, 1, 1, 1, 1, 2, 0, 1, 0},
|
||||
{1, 2, 2, 0, 2, 1, 1, 1, 0},
|
||||
{1, 1, 1, 2, 0, 1, 1, 2, 0},
|
||||
{0, 1, 1, 1, 2, 0, 1, 2, 0},
|
||||
{0, 0, 0, 1, 1, 2, 1, 2, 0},
|
||||
{1, 1, 1, 2, 0, 2, 1, 2, 0},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0}},
|
||||
// INKPLATE_5_V2
|
||||
{{0, 0, 1, 1, 2, 1, 1, 1, 0},
|
||||
{1, 1, 2, 2, 1, 2, 1, 1, 0},
|
||||
{0, 1, 2, 2, 1, 1, 2, 1, 0},
|
||||
{0, 0, 1, 1, 1, 1, 1, 2, 0},
|
||||
{1, 2, 1, 2, 1, 1, 1, 2, 0},
|
||||
{0, 1, 1, 1, 2, 0, 1, 2, 0},
|
||||
{1, 1, 1, 2, 2, 2, 1, 2, 0},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0}}};
|
||||
|
||||
void set_greyscale(bool greyscale) {
|
||||
this->greyscale_ = greyscale;
|
||||
|
@ -146,6 +166,10 @@ class Inkplate6 : public display::DisplayBuffer, public i2c::I2CDevice {
|
|||
return 800;
|
||||
} else if (this->model_ == INKPLATE_10) {
|
||||
return 1200;
|
||||
} else if (this->model_ == INKPLATE_5) {
|
||||
return 960;
|
||||
} else if (this->model_ == INKPLATE_5_V2) {
|
||||
return 1280;
|
||||
} else if (this->model_ == INKPLATE_6_PLUS) {
|
||||
return 1024;
|
||||
}
|
||||
|
@ -155,6 +179,10 @@ class Inkplate6 : public display::DisplayBuffer, public i2c::I2CDevice {
|
|||
int get_height_internal() override {
|
||||
if (this->model_ == INKPLATE_6 || this->model_ == INKPLATE_6_V2) {
|
||||
return 600;
|
||||
} else if (this->model_ == INKPLATE_5) {
|
||||
return 540;
|
||||
} else if (this->model_ == INKPLATE_5_V2) {
|
||||
return 720;
|
||||
} else if (this->model_ == INKPLATE_10) {
|
||||
return 825;
|
||||
} else if (this->model_ == INKPLATE_6_PLUS) {
|
||||
|
|
Loading…
Reference in a new issue