ESPHome  2022.6.2
ssd1322_base.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/hal.h"
6 
7 namespace esphome {
8 namespace ssd1322_base {
9 
12 };
13 
15  public:
16  void setup() override;
17 
18  void display();
19 
20  void update() override;
21 
22  void set_model(SSD1322Model model) { this->model_ = model; }
23  void set_reset_pin(GPIOPin *reset_pin) { this->reset_pin_ = reset_pin; }
24  void init_brightness(float brightness) { this->brightness_ = brightness; }
25  void set_brightness(float brightness);
26  bool is_on();
27  void turn_on();
28  void turn_off();
29 
30  float get_setup_priority() const override { return setup_priority::PROCESSOR; }
31  void fill(Color color) override;
32 
34 
35  protected:
36  virtual void command(uint8_t value) = 0;
37  virtual void data(uint8_t value) = 0;
38  virtual void write_display_data() = 0;
39  void init_reset_();
40 
41  void draw_absolute_pixel_internal(int x, int y, Color color) override;
42 
43  int get_height_internal() override;
44  int get_width_internal() override;
45  size_t get_buffer_length_();
46  const char *model_str_();
47 
49  GPIOPin *reset_pin_{nullptr};
50  bool is_on_{false};
51  float brightness_{1.0};
52 };
53 
54 } // namespace ssd1322_base
55 } // namespace esphome
void set_reset_pin(GPIOPin *reset_pin)
Definition: ssd1322_base.h:23
virtual void data(uint8_t value)=0
This class simplifies creating components that periodically check a state.
Definition: component.h:266
display::DisplayType get_display_type() override
Definition: ssd1322_base.h:33
void init_brightness(float brightness)
Definition: ssd1322_base.h:24
virtual void command(uint8_t value)=0
void draw_absolute_pixel_internal(int x, int y, Color color) override
const float PROCESSOR
For components that use data from sensors like displays.
Definition: component.cpp:19
float get_setup_priority() const override
Definition: ssd1322_base.h:30
virtual void write_display_data()=0
Definition: a4988.cpp:4
void set_brightness(float brightness)
void set_model(SSD1322Model model)
Definition: ssd1322_base.h:22
void fill(Color color) override