ESPHome  2021.10.2
ssd1351_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 ssd1351_base {
9 
13 };
14 
16  public:
17  void setup() override;
18 
19  void display();
20 
21  void update() override;
22 
23  void set_model(SSD1351Model model) { this->model_ = model; }
24  void set_reset_pin(GPIOPin *reset_pin) { this->reset_pin_ = reset_pin; }
25  void init_brightness(float brightness) { this->brightness_ = brightness; }
26  void set_brightness(float brightness);
27  bool is_on();
28  void turn_on();
29  void turn_off();
30 
31  float get_setup_priority() const override { return setup_priority::PROCESSOR; }
32  void fill(Color color) override;
33 
34  protected:
35  virtual void command(uint8_t value) = 0;
36  virtual void data(uint8_t value) = 0;
37  virtual void write_display_data() = 0;
38  void init_reset_();
39 
40  void draw_absolute_pixel_internal(int x, int y, Color color) override;
41 
42  int get_height_internal() override;
43  int get_width_internal() override;
44  size_t get_buffer_length_();
45  const char *model_str_();
46 
48  GPIOPin *reset_pin_{nullptr};
49  bool is_on_{false};
50  float brightness_{1.0};
51 };
52 
53 } // namespace ssd1351_base
54 } // namespace esphome
void set_model(SSD1351Model model)
Definition: ssd1351_base.h:23
void set_brightness(float brightness)
void init_brightness(float brightness)
Definition: ssd1351_base.h:25
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:234
virtual void write_display_data()=0
virtual void data(uint8_t value)=0
void fill(Color color) override
const float PROCESSOR
For components that use data from sensors like displays.
Definition: component.cpp:19
virtual void command(uint8_t value)=0
void set_reset_pin(GPIOPin *reset_pin)
Definition: ssd1351_base.h:24
float get_setup_priority() const override
Definition: ssd1351_base.h:31
Library based on https://github.com/miguelbalboa/rfid and adapted to ESPHome by . ...
Definition: a4988.cpp:4