ESPHome
2026.1.4
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
void
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
}
21
22
void
EpaperWaveshare::set_window
() {
23
this->
x_low_
&= ~7;
24
this->
x_high_
+= 7;
25
this->
x_high_
&= ~7;
26
uint16_t x_start = this->
x_low_
/ 8;
27
uint16_t x_end = (this->
x_high_
- 1) / 8;
28
this->
cmd_data
(0x44, {(uint8_t) x_start, (uint8_t) (x_end)});
29
this->
cmd_data
(0x4E, {(uint8_t) x_start});
30
this->
cmd_data
(0x45, {(uint8_t) this->
y_low_
, (uint8_t) (this->
y_low_
/ 256), (uint8_t) (this->
y_high_
- 1),
31
(uint8_t) ((this->
y_high_
- 1) / 256)});
32
this->
cmd_data
(0x4F, {(uint8_t) this->
y_low_
, (uint8_t) (this->
y_low_
/ 256)});
33
ESP_LOGV(TAG,
"Set window X: %u-%u, Y: %u-%u"
, this->
x_low_
, this->
x_high_
, this->
y_low_
, this->
y_high_
);
34
}
35
36
void
EpaperWaveshare::refresh_screen
(
bool
partial) {
37
if
(partial) {
38
this->
cmd_data
(0x22, {0x0F});
39
}
else
{
40
this->
cmd_data
(0x22, {0xC7});
41
}
42
this->
command
(0x20);
43
this->
next_delay_
= partial ? 100 : 3000;
44
}
45
46
void
EpaperWaveshare::deep_sleep
() { this->
cmd_data
(0x10, {0x01}); }
47
}
// namespace esphome::epaper_spi
esphome::epaper_spi::EPaperBase::command
void command(uint8_t value)
Definition
epaper_spi.cpp:56
esphome::epaper_spi::EPaperBase::y_high_
uint16_t y_high_
Definition
epaper_spi.h:176
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:171
esphome::epaper_spi::EPaperBase::x_high_
uint16_t x_high_
Definition
epaper_spi.h:176
esphome::epaper_spi::EPaperBase::y_low_
uint16_t y_low_
Definition
epaper_spi.h:176
esphome::epaper_spi::EPaperBase::x_low_
uint16_t x_low_
Definition
epaper_spi.h:176
esphome::epaper_spi::EPaperBase::initialise
virtual void initialise(bool partial)
Definition
epaper_spi.cpp:242
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::refresh_screen
void refresh_screen(bool partial) override
Definition
epaper_waveshare.cpp:36
esphome::epaper_spi::EpaperWaveshare::deep_sleep
void deep_sleep() override
Definition
epaper_waveshare.cpp:46
esphome::epaper_spi::EpaperWaveshare::lut_
const uint8_t * lut_
Definition
epaper_waveshare.h:25
esphome::epaper_spi::EpaperWaveshare::initialise
void initialise(bool partial) override
Definition
epaper_waveshare.cpp:7
esphome::epaper_spi::EpaperWaveshare::set_window
void set_window() override
Definition
epaper_waveshare.cpp:22
epaper_waveshare.h
esphome::epaper_spi
Definition
epaper_spi.cpp:7
Generated by
1.12.0