ESPHome 2026.5.1
Loading...
Searching...
No Matches
pcd_8544.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::pcd8544 {
8
10 public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
11 spi::DATA_RATE_8MHZ> {
12 public:
13 const uint8_t PCD8544_POWERDOWN = 0x04;
14 const uint8_t PCD8544_ENTRYMODE = 0x02;
15 const uint8_t PCD8544_EXTENDEDINSTRUCTION = 0x01;
16
17 const uint8_t PCD8544_DISPLAYBLANK = 0x0;
18 const uint8_t PCD8544_DISPLAYNORMAL = 0x4;
19 const uint8_t PCD8544_DISPLAYALLON = 0x1;
20 const uint8_t PCD8544_DISPLAYINVERTED = 0x5;
21
22 const uint8_t PCD8544_FUNCTIONSET = 0x20;
23 const uint8_t PCD8544_DISPLAYCONTROL = 0x08;
24 const uint8_t PCD8544_SETYADDR = 0x40;
25 const uint8_t PCD8544_SETXADDR = 0x80;
26
27 const uint8_t PCD8544_SETTEMP = 0x04;
28 const uint8_t PCD8544_SETBIAS = 0x10;
29 const uint8_t PCD8544_SETVOP = 0x80;
30 uint8_t contrast_;
31
32 void set_dc_pin(GPIOPin *dc_pin) { this->dc_pin_ = dc_pin; }
34 void set_contrast(uint8_t contrast) { this->contrast_ = contrast; }
35 float get_setup_priority() const override { return setup_priority::PROCESSOR; }
36
37 void command(uint8_t value);
38 void data(uint8_t value);
39
40 void initialize();
41 void dump_config() override;
42 void HOT display();
43
44 void update() override;
45
46 void fill(Color color) override;
47
48 void setup() override {
49 this->setup_pins_();
50 this->initialize();
51 }
52
54
55 protected:
56 void draw_absolute_pixel_internal(int x, int y, Color color) override;
57
58 void setup_pins_();
59
60 void init_reset_();
61
62 size_t get_buffer_length_();
63
64 void start_command_();
65 void end_command_();
66 void start_data_();
67 void end_data_();
68
69 int get_width_internal() override;
70 int get_height_internal() override;
71
74};
75
76} // namespace esphome::pcd8544
const uint8_t PCD8544_EXTENDEDINSTRUCTION
Definition pcd_8544.h:15
int get_width_internal() override
Definition pcd_8544.cpp:57
const uint8_t PCD8544_SETYADDR
Definition pcd_8544.h:24
void data(uint8_t value)
void set_dc_pin(GPIOPin *dc_pin)
Definition pcd_8544.h:32
const uint8_t PCD8544_POWERDOWN
Definition pcd_8544.h:13
const uint8_t PCD8544_SETVOP
Definition pcd_8544.h:29
void set_reset_pin(GPIOPin *reset)
Definition pcd_8544.h:33
int get_height_internal() override
Definition pcd_8544.cpp:58
void set_contrast(uint8_t contrast)
Definition pcd_8544.h:34
const uint8_t PCD8544_FUNCTIONSET
Definition pcd_8544.h:22
void setup() override
Definition pcd_8544.h:48
display::DisplayType get_display_type() override
Definition pcd_8544.h:53
void draw_absolute_pixel_internal(int x, int y, Color color) override
Definition pcd_8544.cpp:86
const uint8_t PCD8544_DISPLAYBLANK
Definition pcd_8544.h:17
const uint8_t PCD8544_SETXADDR
Definition pcd_8544.h:25
void update() override
Definition pcd_8544.cpp:113
const uint8_t PCD8544_SETTEMP
Definition pcd_8544.h:27
const uint8_t PCD8544_SETBIAS
Definition pcd_8544.h:28
const uint8_t PCD8544_DISPLAYALLON
Definition pcd_8544.h:19
void command(uint8_t value)
Definition pcd_8544.cpp:107
void fill(Color color) override
Definition pcd_8544.cpp:118
const uint8_t PCD8544_DISPLAYINVERTED
Definition pcd_8544.h:20
float get_setup_priority() const override
Definition pcd_8544.h:35
const uint8_t PCD8544_DISPLAYNORMAL
Definition pcd_8544.h:18
const uint8_t PCD8544_ENTRYMODE
Definition pcd_8544.h:14
const uint8_t PCD8544_DISPLAYCONTROL
Definition pcd_8544.h:23
void dump_config() override
Definition pcd_8544.cpp:100
The SPIDevice is what components using the SPI will create.
Definition spi.h:429
uint16_t reset
Definition ina226.h:5
constexpr float PROCESSOR
For components that use data from sensors like displays.
Definition component.h:45
uint16_t x
Definition tt21100.cpp:5
uint16_t y
Definition tt21100.cpp:6