Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose framebuffer functions #9

Merged
merged 1 commit into from
Jan 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions adafruit_ssd1306.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,18 @@
class _SSD1306:
"""Base class for SSD1306 display driver"""
#pylint: disable-msg=too-many-arguments
#pylint: disable-msg=too-many-instance-attributes
def __init__(self, framebuffer, width, height, external_vcc, reset):
self.framebuf = framebuffer
self.fill = self.framebuf.fill
self.pixel = self.framebuf.pixel
self.line = self.framebuf.line
self.text = self.framebuf.text
self.scroll = self.framebuf.scroll
self.blit = self.framebuf.blit
self.vline = self.framebuf.vline
self.hline = self.framebuf.hline
self.fill_rect = self.framebuf.fill_rect
self.width = width
self.height = height
self.external_vcc = external_vcc
Expand Down Expand Up @@ -126,22 +136,6 @@ def show(self):
self.write_cmd(self.pages - 1)
self.write_framebuf()

def fill(self, value):
"""Fill the display with all ones or zeros."""
self.framebuf.fill(value)

def pixel(self, xpos, ypos, value):
"""Set a pixel to on or off at x,y"""
self.framebuf.pixel(xpos, ypos, value)

def scroll(self, deltax, deltay):
"""Scroll the display content by delta x,y"""
self.framebuf.scroll(deltax, deltay)

def text(self, string, xpos, ypos, col=1):
"""Place text on display"""
self.framebuf.text(string, xpos, ypos, col)

class SSD1306_I2C(_SSD1306):
"""
I2C class for SSD1306
Expand Down