ESPHome
2026.3.0-dev
Loading...
Searching...
No Matches
esphome
components
epaper_spi
epaper_waveshare.cpp
Go to the documentation of this file.
1
#include "
epaper_waveshare.h
"
2
3
namespace
esphome::epaper_spi
{
4
5
static
const
char
*
const
TAG =
"epaper_spi.waveshare"
;
6
7
bool
EpaperWaveshare::initialise
(
bool
partial) {
8
EPaperBase::initialise
(partial);
9
if
(partial) {
10
this->
cmd_data
(0x32, this->
partial_lut_
, this->
partial_lut_length_
);
11
this->
cmd_data
(0x3C, {0x80});
12
this->
cmd_data
(0x22, {0xC0});
13
this->
command
(0x20);
14
this->
next_delay_
= 100;
15
}
else
{
16
this->
cmd_data
(0x32, this->
lut_
, this->
lut_length_
);
17
this->
cmd_data
(0x3C, {0x05});
18
}
19
this->
send_red_
=
true
;
20
return
true
;
21
}
22
23
void
EpaperWaveshare::set_window
() {
24
this->
x_low_
&= ~7;
25
this->
x_high_
+= 7;
26
this->
x_high_
&= ~7;
27
uint16_t x_start = this->
x_low_
/ 8;
28
uint16_t x_end = (this->
x_high_
- 1) / 8;
29
this->
cmd_data
(0x44, {(uint8_t) x_start, (uint8_t) (x_end)});
30
this->
cmd_data
(0x4E, {(uint8_t) x_start});
31
this->
cmd_data
(0x45, {(uint8_t) this->
y_low_
, (uint8_t) (this->
y_low_
/ 256), (uint8_t) (this->
y_high_
- 1),
32
(uint8_t) ((this->
y_high_
- 1) / 256)});
33
this->
cmd_data
(0x4F, {(uint8_t) this->
y_low_
, (uint8_t) (this->
y_low_
/ 256)});
34
ESP_LOGV(TAG,
"Set window X: %u-%u, Y: %u-%u"
, this->
x_low_
, this->
x_high_
, this->
y_low_
, this->
y_high_
);
35
}
36
37
void
EpaperWaveshare::refresh_screen
(
bool
partial) {
38
if
(partial) {
39
this->
cmd_data
(0x22, {0x0F});
40
}
else
{
41
this->
cmd_data
(0x22, {0xC7});
42
}
43
this->
command
(0x20);
44
this->
next_delay_
= partial ? 100 : 3000;
45
}
46
47
void
EpaperWaveshare::deep_sleep
() { this->
cmd_data
(0x10, {0x01}); }
48
}
// namespace esphome::epaper_spi
esphome::epaper_spi::EPaperBase::command
void command(uint8_t value)
Definition
epaper_spi.cpp:56
esphome::epaper_spi::EPaperBase::initialise
virtual bool initialise(bool partial)
Definition
epaper_spi.cpp:269
esphome::epaper_spi::EPaperBase::y_high_
uint16_t y_high_
Definition
epaper_spi.h:177
esphome::epaper_spi::EPaperBase::cmd_data
void cmd_data(uint8_t command, const uint8_t *ptr, size_t length)
Definition
epaper_spi.cpp:65
esphome::epaper_spi::EPaperBase::next_delay_
uint16_t next_delay_
Definition
epaper_spi.h:172
esphome::epaper_spi::EPaperBase::x_high_
uint16_t x_high_
Definition
epaper_spi.h:177
esphome::epaper_spi::EPaperBase::y_low_
uint16_t y_low_
Definition
epaper_spi.h:177
esphome::epaper_spi::EPaperBase::x_low_
uint16_t x_low_
Definition
epaper_spi.h:177
esphome::epaper_spi::EPaperMono::send_red_
bool send_red_
Definition
epaper_spi_mono.h:25
esphome::epaper_spi::EpaperWaveshare::partial_lut_
const uint8_t * partial_lut_
Definition
epaper_waveshare.h:27
esphome::epaper_spi::EpaperWaveshare::lut_length_
size_t lut_length_
Definition
epaper_waveshare.h:26
esphome::epaper_spi::EpaperWaveshare::partial_lut_length_
uint16_t partial_lut_length_
Definition
epaper_waveshare.h:28
esphome::epaper_spi::EpaperWaveshare::initialise
bool initialise(bool partial) override
Definition
epaper_waveshare.cpp:7
esphome::epaper_spi::EpaperWaveshare::refresh_screen
void refresh_screen(bool partial) override
Definition
epaper_waveshare.cpp:37
esphome::epaper_spi::EpaperWaveshare::deep_sleep
void deep_sleep() override
Definition
epaper_waveshare.cpp:47
esphome::epaper_spi::EpaperWaveshare::lut_
const uint8_t * lut_
Definition
epaper_waveshare.h:25
esphome::epaper_spi::EpaperWaveshare::set_window
void set_window() override
Definition
epaper_waveshare.cpp:23
epaper_waveshare.h
esphome::epaper_spi
Definition
colorconv.h:14
Generated by
1.12.0