mirror of
https://github.com/esphome/esphome.git
synced 2024-09-02 00:20:30 +02:00
Add 7.5inch v2 waveshare (#1077)
* Added 7.5inchV2 * Added 7.5inV2 * Added 7.5inch_V2 * fixed Display function * Inverted bytecode Added ~() to invert the bytecode and make the screen look black text on white background * Hoping to keep Travis happy with blank lines * more travis hacking * travis happy? * wow * gfhj
This commit is contained in:
parent
e41ea42074
commit
c8998941a5
|
@ -16,6 +16,7 @@ WaveshareEPaper2P9InB = waveshare_epaper_ns.class_('WaveshareEPaper2P9InB', Wave
|
|||
WaveshareEPaper4P2In = waveshare_epaper_ns.class_('WaveshareEPaper4P2In', WaveshareEPaper)
|
||||
WaveshareEPaper5P8In = waveshare_epaper_ns.class_('WaveshareEPaper5P8In', WaveshareEPaper)
|
||||
WaveshareEPaper7P5In = waveshare_epaper_ns.class_('WaveshareEPaper7P5In', WaveshareEPaper)
|
||||
WaveshareEPaper7P5InV2 = waveshare_epaper_ns.class_('WaveshareEPaper7P5InV2', WaveshareEPaper)
|
||||
|
||||
WaveshareEPaperTypeAModel = waveshare_epaper_ns.enum('WaveshareEPaperTypeAModel')
|
||||
WaveshareEPaperTypeBModel = waveshare_epaper_ns.enum('WaveshareEPaperTypeBModel')
|
||||
|
@ -31,6 +32,7 @@ MODELS = {
|
|||
'4.20in': ('b', WaveshareEPaper4P2In),
|
||||
'5.83in': ('b', WaveshareEPaper5P8In),
|
||||
'7.50in': ('b', WaveshareEPaper7P5In),
|
||||
'7.50inV2': ('b', WaveshareEPaper7P5InV2),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -751,63 +751,51 @@ void WaveshareEPaper5P8In::dump_config() {
|
|||
LOG_PIN(" Busy Pin: ", this->busy_pin_);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
}
|
||||
|
||||
void WaveshareEPaper7P5In::initialize() {
|
||||
// COMMAND POWER SETTING
|
||||
this->command(0x01);
|
||||
this->data(0x37);
|
||||
this->data(0x00);
|
||||
|
||||
// COMMAND PANEL SETTING
|
||||
this->command(0x00);
|
||||
this->data(0xCF);
|
||||
this->data(0x0B);
|
||||
|
||||
// COMMAND BOOSTER SOFT START
|
||||
this->command(0x06);
|
||||
this->data(0xC7);
|
||||
this->data(0xCC);
|
||||
this->data(0x28);
|
||||
|
||||
// COMMAND POWER ON
|
||||
this->command(0x04);
|
||||
this->wait_until_idle_();
|
||||
delay(10);
|
||||
|
||||
// COMMAND PLL CONTROL
|
||||
this->command(0x30);
|
||||
this->data(0x3C);
|
||||
|
||||
// COMMAND TEMPERATURE SENSOR CALIBRATION
|
||||
this->command(0x41);
|
||||
this->data(0x00);
|
||||
|
||||
// COMMAND VCOM AND DATA INTERVAL SETTING
|
||||
this->command(0x50);
|
||||
this->data(0x77);
|
||||
|
||||
// COMMAND TCON SETTING
|
||||
this->command(0x60);
|
||||
this->data(0x22);
|
||||
|
||||
// COMMAND RESOLUTION SETTING
|
||||
this->command(0x61);
|
||||
this->data(0x02);
|
||||
this->data(0x80);
|
||||
this->data(0x01);
|
||||
this->data(0x80);
|
||||
|
||||
// COMMAND VCM DC SETTING REGISTER
|
||||
this->command(0x82);
|
||||
this->data(0x1E);
|
||||
|
||||
this->command(0xE5);
|
||||
this->data(0x03);
|
||||
}
|
||||
void HOT WaveshareEPaper7P5In::display() {
|
||||
// COMMAND DATA START TRANSMISSION 1
|
||||
this->command(0x10);
|
||||
|
||||
this->start_data_();
|
||||
for (size_t i = 0; i < this->get_buffer_length_(); i++) {
|
||||
uint8_t temp1 = this->buffer_[i];
|
||||
|
@ -817,7 +805,6 @@ void HOT WaveshareEPaper7P5In::display() {
|
|||
temp2 = 0x03;
|
||||
else
|
||||
temp2 = 0x00;
|
||||
|
||||
temp2 <<= 4;
|
||||
temp1 <<= 1;
|
||||
j++;
|
||||
|
@ -828,11 +815,9 @@ void HOT WaveshareEPaper7P5In::display() {
|
|||
temp1 <<= 1;
|
||||
this->write_byte(temp2);
|
||||
}
|
||||
|
||||
App.feed_wdt();
|
||||
}
|
||||
this->end_data_();
|
||||
|
||||
// COMMAND DISPLAY REFRESH
|
||||
this->command(0x12);
|
||||
}
|
||||
|
@ -846,6 +831,62 @@ void WaveshareEPaper7P5In::dump_config() {
|
|||
LOG_PIN(" Busy Pin: ", this->busy_pin_);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
}
|
||||
void WaveshareEPaper7P5InV2::initialize() {
|
||||
// COMMAND POWER SETTING
|
||||
this->command(0x01);
|
||||
this->data(0x07);
|
||||
this->data(0x07);
|
||||
this->data(0x3f);
|
||||
this->data(0x3f);
|
||||
this->command(0x04);
|
||||
|
||||
delay(100); // NOLINT
|
||||
this->wait_until_idle_();
|
||||
// COMMAND PANEL SETTING
|
||||
this->command(0x00);
|
||||
this->data(0x1F);
|
||||
|
||||
// COMMAND RESOLUTION SETTING
|
||||
this->command(0x61);
|
||||
this->data(0x03);
|
||||
this->data(0x20);
|
||||
this->data(0x01);
|
||||
this->data(0xE0);
|
||||
// COMMAND ...?
|
||||
this->command(0x15);
|
||||
this->data(0x00);
|
||||
// COMMAND VCOM AND DATA INTERVAL SETTING
|
||||
this->command(0x50);
|
||||
this->data(0x10);
|
||||
this->data(0x07);
|
||||
// COMMAND TCON SETTING
|
||||
this->command(0x60);
|
||||
this->data(0x22);
|
||||
}
|
||||
void HOT WaveshareEPaper7P5InV2::display() {
|
||||
uint32_t buf_len = this->get_buffer_length_();
|
||||
// COMMAND DATA START TRANSMISSION NEW DATA
|
||||
this->command(0x13);
|
||||
delay(2);
|
||||
for (uint32_t i = 0; i < buf_len; i++) {
|
||||
this->data(~(this->buffer_[i]));
|
||||
}
|
||||
|
||||
// COMMAND DISPLAY REFRESH
|
||||
this->command(0x12);
|
||||
delay(100); // NOLINT
|
||||
this->wait_until_idle_();
|
||||
}
|
||||
|
||||
int WaveshareEPaper7P5InV2::get_width_internal() { return 800; }
|
||||
int WaveshareEPaper7P5InV2::get_height_internal() { return 480; }
|
||||
void WaveshareEPaper7P5InV2::dump_config() {
|
||||
LOG_DISPLAY("", "Waveshare E-Paper", this);
|
||||
ESP_LOGCONFIG(TAG, " Model: 7.5inV2");
|
||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
||||
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
||||
LOG_PIN(" Busy Pin: ", this->busy_pin_);
|
||||
LOG_UPDATE_INTERVAL(this);
|
||||
}
|
||||
} // namespace waveshare_epaper
|
||||
} // namespace esphome
|
||||
|
|
|
@ -105,6 +105,7 @@ enum WaveshareEPaperTypeBModel {
|
|||
WAVESHARE_EPAPER_2_7_IN = 0,
|
||||
WAVESHARE_EPAPER_4_2_IN,
|
||||
WAVESHARE_EPAPER_7_5_IN,
|
||||
WAVESHARE_EPAPER_7_5_INV2,
|
||||
};
|
||||
|
||||
class WaveshareEPaper2P7In : public WaveshareEPaper {
|
||||
|
@ -236,5 +237,28 @@ class WaveshareEPaper7P5In : public WaveshareEPaper {
|
|||
int get_height_internal() override;
|
||||
};
|
||||
|
||||
class WaveshareEPaper7P5InV2 : public WaveshareEPaper {
|
||||
public:
|
||||
void initialize() override;
|
||||
|
||||
void display() override;
|
||||
|
||||
void dump_config() override;
|
||||
|
||||
void deep_sleep() override {
|
||||
// COMMAND POWER OFF
|
||||
this->command(0x02);
|
||||
this->wait_until_idle_();
|
||||
// COMMAND DEEP SLEEP
|
||||
this->command(0x07);
|
||||
this->data(0xA5); // check byte
|
||||
}
|
||||
|
||||
protected:
|
||||
int get_width_internal() override;
|
||||
|
||||
int get_height_internal() override;
|
||||
};
|
||||
|
||||
} // namespace waveshare_epaper
|
||||
} // namespace esphome
|
||||
|
|
Loading…
Reference in New Issue
Block a user