9static const char *
const TAG =
"st7920";
12static const uint8_t LCD_DATA = 0xFA;
13static const uint8_t LCD_COMMAND = 0xF8;
14static const uint8_t LCD_CLS = 0x01;
15static const uint8_t LCD_HOME = 0x02;
16static const uint8_t LCD_ADDRINC = 0x06;
17static const uint8_t LCD_DISPLAYON = 0x0C;
18static const uint8_t LCD_DISPLAYOFF = 0x08;
19static const uint8_t LCD_CURSORON = 0x0E;
20static const uint8_t LCD_CURSORBLINK = 0x0F;
21static const uint8_t LCD_BASIC = 0x30;
22static const uint8_t LCD_GFXMODE = 0x36;
23static const uint8_t LCD_EXTEND = 0x34;
24static const uint8_t LCD_TXTMODE = 0x34;
25static const uint8_t LCD_STANDBY = 0x01;
26static const uint8_t LCD_SCROLL = 0x03;
27static const uint8_t LCD_SCROLLADDR = 0x40;
28static const uint8_t LCD_ADDR = 0x80;
29static const uint8_t LCD_LINE0 = 0x80;
30static const uint8_t LCD_LINE1 = 0x90;
31static const uint8_t LCD_LINE2 = 0x88;
32static const uint8_t LCD_LINE3 = 0x98;
35 ESP_LOGCONFIG(TAG,
"Setting up ST7920...");
44 this->
send_(LCD_COMMAND, value);
50 this->
send_(LCD_DATA, value);
61 if (
y >= 32 &&
y < 64) {
64 }
else if (
y >= 64 &&
y < 64 + 32) {
67 }
else if (
y >= 64 + 32 &&
y < 64 + 64) {
80 for (i = 0; i < 16; i++) {
82 this->
send_(LCD_DATA, b);
84 for (i = 0; i < 16; i++) {
85 b = this->
buffer_[i + (j + 32) * 16];
86 this->
send_(LCD_DATA, b);
96 LOG_DISPLAY(
"",
"ST7920",
this);
97 LOG_PIN(
" CS Pin: ", this->
cs_);
98 ESP_LOGCONFIG(TAG,
" Height: %d", this->
height_);
99 ESP_LOGCONFIG(TAG,
" Width: %d", this->
width_);
125 this->
buffer_[y * width +
x / 8] |= (0x80 >> (
x & 7));
127 this->
buffer_[y * width +
x / 8] &= ~(0x80 >> (
x & 7));
132 ESP_LOGD(TAG,
"Initializing display...");
void feed_wdt(uint32_t time=0)
void init_internal_(uint32_t buffer_length)
void clear()
Clear the entire screen by filling it with OFF pixels.
void spi_setup() override
void write_byte(uint8_t data)
optional< st7920_writer_t > writer_local_
void send_(uint8_t type, uint8_t value)
void dump_config() override
void write_display_data()
void draw_absolute_pixel_internal(int x, int y, Color color) override
void command_(uint8_t value)
void goto_xy_(uint16_t x, uint16_t y)
int get_height_internal() override
float get_setup_priority() const override
void fill(Color color) override
void data_(uint8_t value)
size_t get_buffer_length_()
int get_width_internal() override
const float PROCESSOR
For components that use data from sensors like displays.
Providing packet encoding functions for exchanging data with a remote host.
void IRAM_ATTR HOT delay(uint32_t ms)
Application App
Global storage of Application pointer - only one Application can exist.
bool is_on() ESPHOME_ALWAYS_INLINE