ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
st7920.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::st7920 {
8
9class ST7920;
10
12
14 public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
15 spi::DATA_RATE_200KHZ> {
16 public:
17 void set_writer(st7920_writer_t &&writer) { this->writer_local_ = writer; }
18 void set_height(uint16_t height) { this->height_ = height; }
19 void set_width(uint16_t width) { this->width_ = width; }
20
21 // ========== INTERNAL METHODS ==========
22 // (In most use cases you won't need these)
23 void setup() override;
24 void dump_config() override;
25 float get_setup_priority() const override;
26 void update() override;
27 void fill(Color color) override;
28 void write_display_data();
29
31
32 protected:
33 void draw_absolute_pixel_internal(int x, int y, Color color) override;
34 int get_height_internal() override;
35 int get_width_internal() override;
36 size_t get_buffer_length_();
37 void display_init_();
38 void command_(uint8_t value);
39 void data_(uint8_t value);
40 void send_(uint8_t type, uint8_t value);
41 void goto_xy_(uint16_t x, uint16_t y);
44
45 int16_t width_ = 128, height_ = 64;
47};
48
49} // namespace esphome::st7920
The SPIDevice is what components using the SPI will create.
Definition spi.h:429
display::DisplayType get_display_type() override
Definition st7920.h:30
void send_(uint8_t type, uint8_t value)
Definition st7920.cpp:52
void dump_config() override
Definition st7920.cpp:105
void draw_absolute_pixel_internal(int x, int y, Color color) override
Definition st7920.cpp:131
void command_(uint8_t value)
Definition st7920.cpp:40
void set_writer(st7920_writer_t &&writer)
Definition st7920.h:17
st7920_writer_t writer_local_
Definition st7920.h:46
void goto_xy_(uint16_t x, uint16_t y)
Definition st7920.cpp:58
int get_height_internal() override
Definition st7920.cpp:125
void set_width(uint16_t width)
Definition st7920.h:19
float get_setup_priority() const override
Definition st7920.cpp:114
void fill(Color color) override
Definition st7920.cpp:94
void setup() override
Definition st7920.cpp:33
void update() override
Definition st7920.cpp:116
void data_(uint8_t value)
Definition st7920.cpp:46
void set_height(uint16_t height)
Definition st7920.h:18
size_t get_buffer_length_()
Definition st7920.cpp:127
int get_width_internal() override
Definition st7920.cpp:123
uint16_t type
uint16_t x
Definition tt21100.cpp:5
uint16_t y
Definition tt21100.cpp:6