ESPHome 2026.5.0
Loading...
Searching...
No Matches
lcd_display.h
Go to the documentation of this file.
1#pragma once
2
4#include "esphome/core/time.h"
5
6#include <map>
7#include <vector>
8
9namespace esphome::lcd_base {
10
11class LCDDisplay;
12
14 public:
15 void set_dimensions(uint8_t columns, uint8_t rows) {
16 this->columns_ = columns;
17 this->rows_ = rows;
18 }
19
20 void set_user_defined_char(uint8_t pos, const std::vector<uint8_t> &data) { this->user_defined_chars_[pos] = data; }
21
22 void setup() override;
23 float get_setup_priority() const override;
24 void update() override;
25 void display();
27 void clear();
28
30 void print(uint8_t column, uint8_t row, const char *str);
32 void print(uint8_t column, uint8_t row, const std::string &str);
34 void print(const char *str);
36 void print(const std::string &str);
38 void printf(uint8_t column, uint8_t row, const char *format, ...) __attribute__((format(printf, 4, 5)));
40 void printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
41
43 void strftime(uint8_t column, uint8_t row, const char *format, ESPTime time) __attribute__((format(strftime, 4, 0)));
45 void strftime(const char *format, ESPTime time) __attribute__((format(strftime, 2, 0)));
46
48 void loadchar(uint8_t location, uint8_t charmap[]);
49
50 protected:
51 virtual bool is_four_bit_mode() = 0;
52 virtual void write_n_bits(uint8_t value, uint8_t n) = 0;
53 virtual void send(uint8_t value, bool rs) = 0;
54
55 void command_(uint8_t value);
56 virtual void call_writer() = 0;
57
58 uint8_t columns_;
59 uint8_t rows_;
60 uint8_t *buffer_{nullptr};
61 std::map<uint8_t, std::vector<uint8_t> > user_defined_chars_;
62};
63
64} // namespace esphome::lcd_base
This class simplifies creating components that periodically check a state.
Definition component.h:602
void set_user_defined_char(uint8_t pos, const std::vector< uint8_t > &data)
Definition lcd_display.h:20
void void void strftime(uint8_t column, uint8_t row, const char *format, ESPTime time) __attribute__((format(strftime
Evaluate the strftime-format and print the text at the specified column and row.
std::map< uint8_t, std::vector< uint8_t > > user_defined_chars_
Definition lcd_display.h:61
void command_(uint8_t value)
virtual void write_n_bits(uint8_t value, uint8_t n)=0
virtual void send(uint8_t value, bool rs)=0
virtual void call_writer()=0
float get_setup_priority() const override
void void void void void loadchar(uint8_t location, uint8_t charmap[])
Load custom char to given location.
void printf(uint8_t column, uint8_t row, const char *format,...) __attribute__((format(printf
Evaluate the printf-format and print the text at the specified column and row.
virtual bool is_four_bit_mode()=0
void set_dimensions(uint8_t columns, uint8_t rows)
Definition lcd_display.h:15
struct @65::@66 __attribute__
Wake the main loop task from an ISR. ISR-safe.
Definition main_task.h:32
const char int const __FlashStringHelper * format
Definition log.h:74
size_t size_t pos
Definition helpers.h:1038
A more user-friendly version of struct tm from time.h.
Definition time.h:23
std::string print()