[tm1637] Add set_brightness method (#15322)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
1 parent
04a58159d0
commit
ee70a4aa72
2 files changed
+10
No files matched your search
@@ -347,6 +347,13 @@ uint8_t TM1637Display::print(uint8_t start_pos, const char *str) {
|
||||
}
|
||||
return pos - start_pos;
|
||||
}
|
||||
|
||||
void TM1637Display::set_brightness(float brightness) {
|
||||
auto intensity = clamp(brightness, 0.f, 1.f) * 7;
|
||||
this->set_on(intensity > 0);
|
||||
this->set_intensity(intensity);
|
||||
}
|
||||
|
||||
uint8_t TM1637Display::print(const char *str) { return this->print(0, str); }
|
||||
|
||||
void TM1637Display::set_buffer(const uint8_t *data, uint8_t length) {
|
||||
|
||||
Reference in new issue
Block a user