ESPHome  2022.6.2
ssd1331_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 ssd1331_base {
9 
11  public:
12  void setup() override;
13 
14  void display();
15 
16  void update() override;
17 
18  void set_reset_pin(GPIOPin *reset_pin) { this->reset_pin_ = reset_pin; }
19  void init_brightness(float brightness) { this->brightness_ = brightness; }
20  void set_brightness(float brightness);
21  bool is_on();
22  void turn_on();
23  void turn_off();
24 
25  float get_setup_priority() const override { return setup_priority::PROCESSOR; }
26  void fill(Color color) override;
27 
29 
30  protected:
31  virtual void command(uint8_t value) = 0;
32  virtual void write_display_data() = 0;
33  void init_reset_();
34 
35  void draw_absolute_pixel_internal(int x, int y, Color color) override;
36 
37  int get_height_internal() override;
38  int get_width_internal() override;
39  size_t get_buffer_length_();
40 
41  GPIOPin *reset_pin_{nullptr};
42  bool is_on_{false};
43  float brightness_{1.0};
44 };
45 
46 } // namespace ssd1331_base
47 } // namespace esphome
void set_brightness(float brightness)
void draw_absolute_pixel_internal(int x, int y, Color color) override
This class simplifies creating components that periodically check a state.
Definition: component.h:266
virtual void command(uint8_t value)=0
virtual void write_display_data()=0
void set_reset_pin(GPIOPin *reset_pin)
Definition: ssd1331_base.h:18
const float PROCESSOR
For components that use data from sensors like displays.
Definition: component.cpp:19
void init_brightness(float brightness)
Definition: ssd1331_base.h:19
display::DisplayType get_display_type() override
Definition: ssd1331_base.h:28
Definition: a4988.cpp:4
void fill(Color color) override
float get_setup_priority() const override
Definition: ssd1331_base.h:25