RASCSI/python/ctrlboard/src/menu/menu_renderer_adafruit_ssd1306.py
dependabot[bot] 52e4a92aec
Bump black from 22.8.0 to 24.3.0 in /python/web (#1444)
* Bump black from 22.8.0 to 24.3.0 in /python/web

Bumps [black](https://github.com/psf/black) from 22.8.0 to 24.3.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/compare/22.8.0...24.3.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* Github CI: Backend web test runner use python 3.9.19

* Reformat python sources with black

* Docker: Bump to python 3.9-slim image for pytest

* Bump pytest version to 8.1.1

* Bump more library versions, and freeze them

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Daniel Markstedt <daniel@mindani.net>
2024-03-22 00:19:13 -07:00

37 lines
984 B
Python

"""Module providing the Adafruit SSD1306 menu renderer class"""
# pylint: disable=import-error
from board import SCL, SDA
import busio
import adafruit_ssd1306
from menu.menu_renderer import MenuRenderer
class MenuRendererAdafruitSSD1306(MenuRenderer):
"""Class implementing a menu renderer using the Adafruit SSD1306 library"""
def display_init(self):
i2c = busio.I2C(SCL, SDA)
self.disp = adafruit_ssd1306.SSD1306_I2C(
self._config.width, self._config.height, i2c, addr=self._config.i2c_address
)
self.disp.rotation = self._config.get_mapped_rotation()
self.disp.fill(0)
self.disp.show()
return self.disp
def update_display_image(self, image):
self.disp.image(self.image)
self.disp.show()
def update_display(self):
self.disp.show()
def display_clear(self):
self.disp.fill(0)
def blank_screen(self):
self.disp.fill(0)
self.disp.show()