Add get_contrast() and get_brightness() to SSD1306 class to get protected variables (#6435)

This commit is contained in:
Ben Kristinsson
2024-03-27 02:13:41 +01:00
committed by GitHub
parent 0948a3c306
commit 58de8a4ee6
2 changed files with 4 additions and 0 deletions
@@ -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_())