ESPHome  2021.10.2
Public Member Functions | Protected Member Functions | Protected Attributes
esphome::ssd1306_base::SSD1306 Class Referenceabstract

#include <ssd1306_base.h>

Inheritance diagram for esphome::ssd1306_base::SSD1306:
esphome::PollingComponent esphome::display::DisplayBuffer esphome::Component esphome::ssd1306_i2c::I2CSSD1306 esphome::ssd1306_spi::SPISSD1306

Public Member Functions

void setup () override
 
void display ()
 
void update () override
 
void set_model (SSD1306Model model)
 
void set_reset_pin (GPIOPin *reset_pin)
 
void set_external_vcc (bool external_vcc)
 
void init_contrast (float contrast)
 
void set_contrast (float contrast)
 
void init_brightness (float brightness)
 
void set_brightness (float brightness)
 
void init_flip_x (bool flip_x)
 
void init_flip_y (bool flip_y)
 
void init_offset_x (uint8_t offset_x)
 
void init_offset_y (uint8_t offset_y)
 
void init_invert (bool invert)
 
bool is_on ()
 
void turn_on ()
 
void turn_off ()
 
float get_setup_priority () const override
 
void fill (Color color) override
 
- Public Member Functions inherited from esphome::PollingComponent
 PollingComponent ()
 
 PollingComponent (uint32_t update_interval)
 Initialize this polling component with the given update interval in ms. More...
 
virtual void set_update_interval (uint32_t update_interval)
 Manually set the update interval in ms for this polling object. More...
 
void call_setup () override
 
virtual uint32_t get_update_interval () const
 Get the update interval in ms of this sensor. More...
 
- Public Member Functions inherited from esphome::Component
virtual void loop ()
 This method will be called repeatedly. More...
 
virtual void dump_config ()
 
float get_actual_setup_priority () const
 
void set_setup_priority (float priority)
 
virtual float get_loop_priority () const
 priority of loop(). More...
 
void call ()
 
virtual void on_shutdown ()
 
virtual void on_safe_shutdown ()
 
uint32_t get_component_state () const
 
virtual void mark_failed ()
 Mark this component as failed. More...
 
bool is_failed ()
 
virtual bool can_proceed ()
 
bool status_has_warning ()
 
bool status_has_error ()
 
void status_set_warning ()
 
void status_set_error ()
 
void status_clear_warning ()
 
void status_clear_error ()
 
void status_momentary_warning (const std::string &name, uint32_t length=5000)
 
void status_momentary_error (const std::string &name, uint32_t length=5000)
 
bool has_overridden_loop () const
 
void set_component_source (const char *source)
 Set where this component was loaded from for some debug messages. More...
 
const char * get_component_source () const
 Get the integration where this component was declared as a string. More...
 
- Public Member Functions inherited from esphome::display::DisplayBuffer
void clear ()
 Clear the entire screen by filling it with OFF pixels. More...
 
int get_width ()
 Get the width of the image in pixels with rotation applied. More...
 
int get_height ()
 Get the height of the image in pixels with rotation applied. More...
 
void draw_pixel_at (int x, int y, Color color=COLOR_ON)
 Set a single pixel at the specified coordinates to the given color. More...
 
void line (int x1, int y1, int x2, int y2, Color color=COLOR_ON)
 Draw a straight line from the point [x1,y1] to [x2,y2] with the given color. More...
 
void horizontal_line (int x, int y, int width, Color color=COLOR_ON)
 Draw a horizontal line from the point [x,y] to [x+width,y] with the given color. More...
 
void vertical_line (int x, int y, int height, Color color=COLOR_ON)
 Draw a vertical line from the point [x,y] to [x,y+width] with the given color. More...
 
void rectangle (int x1, int y1, int width, int height, Color color=COLOR_ON)
 Draw the outline of a rectangle with the top left point at [x1,y1] and the bottom right point at [x1+width,y1+height]. More...
 
void filled_rectangle (int x1, int y1, int width, int height, Color color=COLOR_ON)
 Fill a rectangle with the top left point at [x1,y1] and the bottom right point at [x1+width,y1+height]. More...
 
void circle (int center_x, int center_xy, int radius, Color color=COLOR_ON)
 Draw the outline of a circle centered around [center_x,center_y] with the radius radius with the given color. More...
 
void filled_circle (int center_x, int center_y, int radius, Color color=COLOR_ON)
 Fill a circle centered around [center_x,center_y] with the radius radius with the given color. More...
 
void print (int x, int y, Font *font, Color color, TextAlign align, const char *text)
 Print text with the anchor point at [x,y] with font. More...
 
void print (int x, int y, Font *font, Color color, const char *text)
 Print text with the top left at [x,y] with font. More...
 
void print (int x, int y, Font *font, TextAlign align, const char *text)
 Print text with the anchor point at [x,y] with font. More...
 
void print (int x, int y, Font *font, const char *text)
 Print text with the top left at [x,y] with font. More...
 
void printf (int x, int y, Font *font, Color color, TextAlign align, const char *format,...) __attribute__((format(printf
 Evaluate the printf-format format and print the result with the anchor point at [x,y] with font. More...
 
void void printf (int x, int y, Font *font, Color color, const char *format,...) __attribute__((format(printf
 Evaluate the printf-format format and print the result with the top left at [x,y] with font. More...
 
void void void printf (int x, int y, Font *font, TextAlign align, const char *format,...) __attribute__((format(printf
 Evaluate the printf-format format and print the result with the anchor point at [x,y] with font. More...
 
void void void void printf (int x, int y, Font *font, const char *format,...) __attribute__((format(printf
 Evaluate the printf-format format and print the result with the top left at [x,y] with font. More...
 
void void void void void strftime (int x, int y, Font *font, Color color, TextAlign align, const char *format, time::ESPTime time) __attribute__((format(strftime
 Evaluate the strftime-format format and print the result with the anchor point at [x,y] with font. More...
 
void void void void void void strftime (int x, int y, Font *font, Color color, const char *format, time::ESPTime time) __attribute__((format(strftime
 Evaluate the strftime-format format and print the result with the top left at [x,y] with font. More...
 
void void void void void void void strftime (int x, int y, Font *font, TextAlign align, const char *format, time::ESPTime time) __attribute__((format(strftime
 Evaluate the strftime-format format and print the result with the anchor point at [x,y] with font. More...
 
void void void void void void void void strftime (int x, int y, Font *font, const char *format, time::ESPTime time) __attribute__((format(strftime
 Evaluate the strftime-format format and print the result with the top left at [x,y] with font. More...
 
void void void void void void void void void image (int x, int y, Image *image, Color color_on=COLOR_ON, Color color_off=COLOR_OFF)
 Draw the image with the top-left corner at [x,y] to the screen. More...
 
void graph (int x, int y, graph::Graph *graph, Color color_on=COLOR_ON)
 Draw the graph with the top-left corner at [x,y] to the screen. More...
 
void legend (int x, int y, graph::Graph *graph, Color color_on=COLOR_ON)
 Draw the legend for graph with the top-left corner at [x,y] to the screen. More...
 
void get_text_bounds (int x, int y, const char *text, Font *font, TextAlign align, int *x1, int *y1, int *width, int *height)
 Get the text bounds of the given string. More...
 
void set_writer (display_writer_t &&writer)
 Internal method to set the display writer lambda. More...
 
void show_page (DisplayPage *page)
 
void show_next_page ()
 
void show_prev_page ()
 
void set_pages (std::vector< DisplayPage *> pages)
 
const DisplayPageget_active_page () const
 
void add_on_page_change_trigger (DisplayOnPageChangeTrigger *t)
 
void set_rotation (DisplayRotation rotation)
 Internal method to set the display rotation with. More...
 

Protected Member Functions

virtual void command (uint8_t value)=0
 
virtual void write_display_data ()=0
 
void init_reset_ ()
 
bool is_sh1106_ () const
 
bool is_ssd1305_ () const
 
void draw_absolute_pixel_internal (int x, int y, Color color) override
 
int get_height_internal () override
 
int get_width_internal () override
 
size_t get_buffer_length_ ()
 
const char * model_str_ ()
 
- Protected Member Functions inherited from esphome::Component
virtual void call_loop ()
 
virtual void call_dump_config ()
 
void set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f)
 Set an interval function with a unique name. More...
 
void set_interval (uint32_t interval, std::function< void()> &&f)
 
bool cancel_interval (const std::string &name)
 Cancel an interval function. More...
 
void set_timeout (uint32_t timeout, std::function< void()> &&f)
 
void set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f)
 Set a timeout function with a unique name. More...
 
bool cancel_timeout (const std::string &name)
 Cancel a timeout function. More...
 
void defer (const std::string &name, std::function< void()> &&f)
 Defer a callback to the next loop() call. More...
 
void defer (std::function< void()> &&f)
 Defer a callback to the next loop() call. More...
 
bool cancel_defer (const std::string &name)
 Cancel a defer callback using the specified name, name must not be empty. More...
 
- Protected Member Functions inherited from esphome::display::DisplayBuffer
void vprintf_ (int x, int y, Font *font, Color color, TextAlign align, const char *format, va_list arg)
 
void init_internal_ (uint32_t buffer_length)
 
void do_update_ ()
 

Protected Attributes

SSD1306Model model_ {SSD1306_MODEL_128_64}
 
GPIOPinreset_pin_ {nullptr}
 
bool external_vcc_ {false}
 
bool is_on_ {false}
 
float contrast_ {1.0}
 
float brightness_ {1.0}
 
bool flip_x_ {true}
 
bool flip_y_ {true}
 
uint8_t offset_x_ {0}
 
uint8_t offset_y_ {0}
 
bool invert_ {false}
 
- Protected Attributes inherited from esphome::PollingComponent
uint32_t update_interval_
 
- Protected Attributes inherited from esphome::Component
uint32_t component_state_ {0x0000}
 State of this component. More...
 
float setup_priority_override_ {NAN}
 
const char * component_source_ = nullptr
 
- Protected Attributes inherited from esphome::display::DisplayBuffer
uint8_t * buffer_ {nullptr}
 
DisplayRotation rotation_ {DISPLAY_ROTATION_0_DEGREES}
 
optional< display_writer_twriter_ {}
 
DisplayPagepage_ {nullptr}
 
DisplayPageprevious_page_ {nullptr}
 
std::vector< DisplayOnPageChangeTrigger * > on_page_change_triggers_
 

Detailed Description

Definition at line 23 of file ssd1306_base.h.

Member Function Documentation

◆ command()

virtual void esphome::ssd1306_base::SSD1306::command ( uint8_t  value)
protectedpure virtual

◆ display()

void esphome::ssd1306_base::SSD1306::display ( )

Definition at line 135 of file ssd1306_base.cpp.

◆ draw_absolute_pixel_internal()

void HOT esphome::ssd1306_base::SSD1306::draw_absolute_pixel_internal ( int  x,
int  y,
Color  color 
)
overrideprotectedvirtual

Implements esphome::display::DisplayBuffer.

Definition at line 239 of file ssd1306_base.cpp.

◆ fill()

void esphome::ssd1306_base::SSD1306::fill ( Color  color)
overridevirtual

Reimplemented from esphome::display::DisplayBuffer.

Definition at line 251 of file ssd1306_base.cpp.

◆ get_buffer_length_()

size_t esphome::ssd1306_base::SSD1306::get_buffer_length_ ( )
protected

Definition at line 236 of file ssd1306_base.cpp.

◆ get_height_internal()

int esphome::ssd1306_base::SSD1306::get_height_internal ( )
overrideprotectedvirtual

Implements esphome::display::DisplayBuffer.

Definition at line 197 of file ssd1306_base.cpp.

◆ get_setup_priority()

float esphome::ssd1306_base::SSD1306::get_setup_priority ( ) const
inlineoverridevirtual

Reimplemented from esphome::Component.

Definition at line 46 of file ssd1306_base.h.

◆ get_width_internal()

int esphome::ssd1306_base::SSD1306::get_width_internal ( )
overrideprotectedvirtual

Implements esphome::display::DisplayBuffer.

Definition at line 217 of file ssd1306_base.cpp.

◆ init_brightness()

void esphome::ssd1306_base::SSD1306::init_brightness ( float  brightness)
inline

Definition at line 36 of file ssd1306_base.h.

◆ init_contrast()

void esphome::ssd1306_base::SSD1306::init_contrast ( float  contrast)
inline

Definition at line 34 of file ssd1306_base.h.

◆ init_flip_x()

void esphome::ssd1306_base::SSD1306::init_flip_x ( bool  flip_x)
inline

Definition at line 38 of file ssd1306_base.h.

◆ init_flip_y()

void esphome::ssd1306_base::SSD1306::init_flip_y ( bool  flip_y)
inline

Definition at line 39 of file ssd1306_base.h.

◆ init_invert()

void esphome::ssd1306_base::SSD1306::init_invert ( bool  invert)
inline

Definition at line 42 of file ssd1306_base.h.

◆ init_offset_x()

void esphome::ssd1306_base::SSD1306::init_offset_x ( uint8_t  offset_x)
inline

Definition at line 40 of file ssd1306_base.h.

◆ init_offset_y()

void esphome::ssd1306_base::SSD1306::init_offset_y ( uint8_t  offset_y)
inline

Definition at line 41 of file ssd1306_base.h.

◆ init_reset_()

void esphome::ssd1306_base::SSD1306::init_reset_ ( )
protected

Definition at line 256 of file ssd1306_base.cpp.

◆ is_on()

bool esphome::ssd1306_base::SSD1306::is_on ( )

Definition at line 188 of file ssd1306_base.cpp.

◆ is_sh1106_()

bool esphome::ssd1306_base::SSD1306::is_sh1106_ ( ) const
protected

Definition at line 161 of file ssd1306_base.cpp.

◆ is_ssd1305_()

bool esphome::ssd1306_base::SSD1306::is_ssd1305_ ( ) const
protected

Definition at line 165 of file ssd1306_base.cpp.

◆ model_str_()

const char * esphome::ssd1306_base::SSD1306::model_str_ ( )
protected

Definition at line 268 of file ssd1306_base.cpp.

◆ set_brightness()

void esphome::ssd1306_base::SSD1306::set_brightness ( float  brightness)

Definition at line 179 of file ssd1306_base.cpp.

◆ set_contrast()

void esphome::ssd1306_base::SSD1306::set_contrast ( float  contrast)

Definition at line 172 of file ssd1306_base.cpp.

◆ set_external_vcc()

void esphome::ssd1306_base::SSD1306::set_external_vcc ( bool  external_vcc)
inline

Definition at line 33 of file ssd1306_base.h.

◆ set_model()

void esphome::ssd1306_base::SSD1306::set_model ( SSD1306Model  model)
inline

Definition at line 31 of file ssd1306_base.h.

◆ set_reset_pin()

void esphome::ssd1306_base::SSD1306::set_reset_pin ( GPIOPin reset_pin)
inline

Definition at line 32 of file ssd1306_base.h.

◆ setup()

void esphome::ssd1306_base::SSD1306::setup ( )
overridevirtual

Reimplemented from esphome::Component.

Reimplemented in esphome::ssd1306_spi::SPISSD1306, and esphome::ssd1306_i2c::I2CSSD1306.

Definition at line 38 of file ssd1306_base.cpp.

◆ turn_off()

void esphome::ssd1306_base::SSD1306::turn_off ( )

Definition at line 193 of file ssd1306_base.cpp.

◆ turn_on()

void esphome::ssd1306_base::SSD1306::turn_on ( )

Definition at line 189 of file ssd1306_base.cpp.

◆ update()

void esphome::ssd1306_base::SSD1306::update ( )
overridevirtual

Implements esphome::PollingComponent.

Definition at line 168 of file ssd1306_base.cpp.

◆ write_display_data()

virtual void esphome::ssd1306_base::SSD1306::write_display_data ( )
protectedpure virtual

Field Documentation

◆ brightness_

float esphome::ssd1306_base::SSD1306::brightness_ {1.0}
protected

Definition at line 69 of file ssd1306_base.h.

◆ contrast_

float esphome::ssd1306_base::SSD1306::contrast_ {1.0}
protected

Definition at line 68 of file ssd1306_base.h.

◆ external_vcc_

bool esphome::ssd1306_base::SSD1306::external_vcc_ {false}
protected

Definition at line 66 of file ssd1306_base.h.

◆ flip_x_

bool esphome::ssd1306_base::SSD1306::flip_x_ {true}
protected

Definition at line 70 of file ssd1306_base.h.

◆ flip_y_

bool esphome::ssd1306_base::SSD1306::flip_y_ {true}
protected

Definition at line 71 of file ssd1306_base.h.

◆ invert_

bool esphome::ssd1306_base::SSD1306::invert_ {false}
protected

Definition at line 74 of file ssd1306_base.h.

◆ is_on_

bool esphome::ssd1306_base::SSD1306::is_on_ {false}
protected

Definition at line 67 of file ssd1306_base.h.

◆ model_

SSD1306Model esphome::ssd1306_base::SSD1306::model_ {SSD1306_MODEL_128_64}
protected

Definition at line 64 of file ssd1306_base.h.

◆ offset_x_

uint8_t esphome::ssd1306_base::SSD1306::offset_x_ {0}
protected

Definition at line 72 of file ssd1306_base.h.

◆ offset_y_

uint8_t esphome::ssd1306_base::SSD1306::offset_y_ {0}
protected

Definition at line 73 of file ssd1306_base.h.

◆ reset_pin_

GPIOPin* esphome::ssd1306_base::SSD1306::reset_pin_ {nullptr}
protected

Definition at line 65 of file ssd1306_base.h.


The documentation for this class was generated from the following files: