mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-25 23:28:28 +02:00
Add get_contrast() and get_brightness() to SSD1306 class to get protected variables (#6435)
This commit is contained in:
@@ -236,6 +236,7 @@ void SSD1306::set_invert(bool invert) {
|
||||
// Inverse display mode (0xA6, 0xA7)
|
||||
this->command(SSD1306_COMMAND_NORMAL_DISPLAY | this->invert_);
|
||||
}
|
||||
float SSD1306::get_contrast() { return this->contrast_; };
|
||||
void SSD1306::set_contrast(float contrast) {
|
||||
// validation
|
||||
this->contrast_ = clamp(contrast, 0.0F, 1.0F);
|
||||
@@ -243,6 +244,7 @@ void SSD1306::set_contrast(float contrast) {
|
||||
this->command(SSD1306_COMMAND_SET_CONTRAST);
|
||||
this->command(int(SSD1306_MAX_CONTRAST * (this->contrast_)));
|
||||
}
|
||||
float SSD1306::get_brightness() { return this->brightness_; };
|
||||
void SSD1306::set_brightness(float brightness) {
|
||||
// validation
|
||||
if (!this->is_ssd1305_())
|
||||
|
||||
Reference in New Issue
Block a user