9 static const char *
const TAG =
"st7920";
12 static const uint8_t LCD_DATA = 0xFA;
13 static const uint8_t LCD_COMMAND = 0xF8;
14 static const uint8_t LCD_CLS = 0x01;
15 static const uint8_t LCD_HOME = 0x02;
16 static const uint8_t LCD_ADDRINC = 0x06;
17 static const uint8_t LCD_DISPLAYON = 0x0C;
18 static const uint8_t LCD_DISPLAYOFF = 0x08;
19 static const uint8_t LCD_CURSORON = 0x0E;
20 static const uint8_t LCD_CURSORBLINK = 0x0F;
21 static const uint8_t LCD_BASIC = 0x30;
22 static const uint8_t LCD_GFXMODE = 0x36;
23 static const uint8_t LCD_EXTEND = 0x34;
24 static const uint8_t LCD_TXTMODE = 0x34;
25 static const uint8_t LCD_STANDBY = 0x01;
26 static const uint8_t LCD_SCROLL = 0x03;
27 static const uint8_t LCD_SCROLLADDR = 0x40;
28 static const uint8_t LCD_ADDR = 0x80;
29 static const uint8_t LCD_LINE0 = 0x80;
30 static const uint8_t LCD_LINE1 = 0x90;
31 static const uint8_t LCD_LINE2 = 0x88;
32 static 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...");
int get_width_internal() override
void draw_absolute_pixel_internal(int x, int y, Color color) override
optional< st7920_writer_t > writer_local_
void spi_setup() override
void fill(Color color) override
int get_height_internal() override
void write_byte(uint8_t data)
void dump_config() override
bool is_on() ESPHOME_ALWAYS_INLINE
void send_(uint8_t type, uint8_t value)
void command_(uint8_t value)
void init_internal_(uint32_t buffer_length)
void goto_xy_(uint16_t x, uint16_t y)
void clear()
Clear the entire screen by filling it with OFF pixels.
const float PROCESSOR
For components that use data from sensors like displays.
Application App
Global storage of Application pointer - only one Application can exist.
float get_setup_priority() const override
void write_display_data()
Implementation of SPI Controller mode.
size_t get_buffer_length_()
void data_(uint8_t value)
void IRAM_ATTR HOT delay(uint32_t ms)