mirror of
https://github.com/esphome/esphome.git
synced 2025-01-31 10:10:56 +00:00
add flip_x
This commit is contained in:
parent
97efa76200
commit
29eda70a3d
@ -36,6 +36,7 @@ CONF_SPH_PIN = "sph_pin"
|
|||||||
CONF_SPV_PIN = "spv_pin"
|
CONF_SPV_PIN = "spv_pin"
|
||||||
CONF_VCOM_PIN = "vcom_pin"
|
CONF_VCOM_PIN = "vcom_pin"
|
||||||
CONF_FLIP_Y = "flip_y"
|
CONF_FLIP_Y = "flip_y"
|
||||||
|
CONF_FLIP_X = "flip_x"
|
||||||
|
|
||||||
inkplate6_ns = cg.esphome_ns.namespace("inkplate6")
|
inkplate6_ns = cg.esphome_ns.namespace("inkplate6")
|
||||||
Inkplate6 = inkplate6_ns.class_(
|
Inkplate6 = inkplate6_ns.class_(
|
||||||
@ -63,6 +64,7 @@ CONFIG_SCHEMA = cv.All(
|
|||||||
cv.GenerateID(): cv.declare_id(Inkplate6),
|
cv.GenerateID(): cv.declare_id(Inkplate6),
|
||||||
cv.Optional(CONF_GREYSCALE, default=False): cv.boolean,
|
cv.Optional(CONF_GREYSCALE, default=False): cv.boolean,
|
||||||
cv.Optional(CONF_FLIP_Y, default=False): cv.boolean,
|
cv.Optional(CONF_FLIP_Y, default=False): cv.boolean,
|
||||||
|
cv.Optional(CONF_FLIP_X, default=False): cv.boolean,
|
||||||
cv.Optional(CONF_PARTIAL_UPDATING, default=True): cv.boolean,
|
cv.Optional(CONF_PARTIAL_UPDATING, default=True): cv.boolean,
|
||||||
cv.Optional(CONF_FULL_UPDATE_EVERY, default=10): cv.uint32_t,
|
cv.Optional(CONF_FULL_UPDATE_EVERY, default=10): cv.uint32_t,
|
||||||
cv.Optional(CONF_MODEL, default="inkplate_6"): cv.enum(
|
cv.Optional(CONF_MODEL, default="inkplate_6"): cv.enum(
|
||||||
@ -128,6 +130,7 @@ async def to_code(config):
|
|||||||
|
|
||||||
cg.add(var.set_greyscale(config[CONF_GREYSCALE]))
|
cg.add(var.set_greyscale(config[CONF_GREYSCALE]))
|
||||||
cg.add(var.set_flip_y(config[CONF_FLIP_Y]))
|
cg.add(var.set_flip_y(config[CONF_FLIP_Y]))
|
||||||
|
cg.add(var.set_flip_x(config[CONF_FLIP_X]))
|
||||||
cg.add(var.set_partial_updating(config[CONF_PARTIAL_UPDATING]))
|
cg.add(var.set_partial_updating(config[CONF_PARTIAL_UPDATING]))
|
||||||
cg.add(var.set_full_update_every(config[CONF_FULL_UPDATE_EVERY]))
|
cg.add(var.set_full_update_every(config[CONF_FULL_UPDATE_EVERY]))
|
||||||
|
|
||||||
|
@ -159,6 +159,9 @@ void HOT Inkplate6::draw_absolute_pixel_internal(int x, int y, Color color) {
|
|||||||
if (this->flip_y_)
|
if (this->flip_y_)
|
||||||
y = this->get_height_internal() - y - 1;
|
y = this->get_height_internal() - y - 1;
|
||||||
|
|
||||||
|
if (this->flip_x_)
|
||||||
|
x = this->get_width_internal() - x - 1;
|
||||||
|
|
||||||
if (this->greyscale_) {
|
if (this->greyscale_) {
|
||||||
int x1 = x / 2;
|
int x1 = x / 2;
|
||||||
int x_sub = x % 2;
|
int x_sub = x % 2;
|
||||||
|
@ -93,6 +93,7 @@ class Inkplate6 : public display::DisplayBuffer, public i2c::I2CDevice {
|
|||||||
this->initialize_();
|
this->initialize_();
|
||||||
}
|
}
|
||||||
void set_flip_y(bool flip_y) { this->flip_y_ = flip_y; }
|
void set_flip_y(bool flip_y) { this->flip_y_ = flip_y; }
|
||||||
|
void set_flip_x(bool flip_x) { this->flip_x_ = flip_x; }
|
||||||
|
|
||||||
void set_partial_updating(bool partial_updating) { this->partial_updating_ = partial_updating; }
|
void set_partial_updating(bool partial_updating) { this->partial_updating_ = partial_updating; }
|
||||||
void set_full_update_every(uint32_t full_update_every) { this->full_update_every_ = full_update_every; }
|
void set_full_update_every(uint32_t full_update_every) { this->full_update_every_ = full_update_every; }
|
||||||
@ -224,6 +225,7 @@ class Inkplate6 : public display::DisplayBuffer, public i2c::I2CDevice {
|
|||||||
bool block_partial_{true};
|
bool block_partial_{true};
|
||||||
bool greyscale_;
|
bool greyscale_;
|
||||||
bool flip_y_;
|
bool flip_y_;
|
||||||
|
bool flip_x_;
|
||||||
bool partial_updating_;
|
bool partial_updating_;
|
||||||
|
|
||||||
InkplateModel model_;
|
InkplateModel model_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user