ESPHome 2025.12.0-dev
Loading...
Searching...
No Matches
gpio_lcd_display.h
Go to the documentation of this file.
1#pragma once
2
3#include "esphome/core/hal.h"
6
7namespace esphome {
8namespace lcd_gpio {
9
10class GPIOLCDDisplay;
11
13
15 public:
16 void set_writer(gpio_lcd_writer_t &&writer) { this->writer_ = std::move(writer); }
17 void setup() override;
18 void set_data_pins(GPIOPin *d0, GPIOPin *d1, GPIOPin *d2, GPIOPin *d3) {
19 this->data_pins_[0] = d0;
20 this->data_pins_[1] = d1;
21 this->data_pins_[2] = d2;
22 this->data_pins_[3] = d3;
23 }
24 void set_data_pins(GPIOPin *d0, GPIOPin *d1, GPIOPin *d2, GPIOPin *d3, GPIOPin *d4, GPIOPin *d5, GPIOPin *d6,
25 GPIOPin *d7) {
26 this->data_pins_[0] = d0;
27 this->data_pins_[1] = d1;
28 this->data_pins_[2] = d2;
29 this->data_pins_[3] = d3;
30 this->data_pins_[4] = d4;
31 this->data_pins_[5] = d5;
32 this->data_pins_[6] = d6;
33 this->data_pins_[7] = d7;
34 }
35 void set_enable_pin(GPIOPin *enable) { this->enable_pin_ = enable; }
36 void set_rs_pin(GPIOPin *rs) { this->rs_pin_ = rs; }
37 void set_rw_pin(GPIOPin *rw) { this->rw_pin_ = rw; }
38 void dump_config() override;
39
40 protected:
41 bool is_four_bit_mode() override { return this->data_pins_[4] == nullptr; }
42 void write_n_bits(uint8_t value, uint8_t n) override;
43 void send(uint8_t value, bool rs) override;
44
45 void call_writer() override { this->writer_(*this); }
46
47 GPIOPin *rs_pin_{nullptr};
48 GPIOPin *rw_pin_{nullptr};
50 GPIOPin *data_pins_[8]{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
52};
53
54} // namespace lcd_gpio
55} // namespace esphome
void set_data_pins(GPIOPin *d0, GPIOPin *d1, GPIOPin *d2, GPIOPin *d3)
void send(uint8_t value, bool rs) override
void set_data_pins(GPIOPin *d0, GPIOPin *d1, GPIOPin *d2, GPIOPin *d3, GPIOPin *d4, GPIOPin *d5, GPIOPin *d6, GPIOPin *d7)
void write_n_bits(uint8_t value, uint8_t n) override
void set_enable_pin(GPIOPin *enable)
void set_writer(gpio_lcd_writer_t &&writer)
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7