Skip to content
This repository has been archived by the owner on Dec 16, 2018. It is now read-only.

Commit

Permalink
Fix the ssd1331 driver
Browse files Browse the repository at this point in the history
  • Loading branch information
deshipu committed Mar 8, 2017
1 parent 499c3cf commit 44d2368
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions ssd1331.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
class SSD1331(DisplaySPI):
"""
>>>
from machine import Pin, HSPI
from machine import Pin, SPI
import ssd1331
#spi = SPI(mosi=Pin(13), sck=Pin(14), polarity=1, phase=1)
spi = HSPI(polarity=1, phase=1)
display = ssd1331.SSD1331(spi, dc=Pin(2), cs=Pin(15), rst=Pin(16))
spi = SPI(1, polarity=1, phase=1)
display = ssd1331.SSD1331(spi, dc=Pin(12), cs=Pin(15), rst=Pin(16))
display.fill(0x7521)
display.pixel(32, 32, 0)
"""
Expand Down Expand Up @@ -79,3 +79,15 @@ class SSD1331(DisplaySPI):

def __init__(self, spi, dc, cs, rst=None, width=96, height=64):
super().__init__(spi, dc, cs, rst, width, height)

def _write(self, command=None, data=None):
if command is None:
self.dc.high()
else:
self.dc.low()
self.cs.low()
if command is not None:
self.spi.write(bytearray([command]))
if data is not None:
self.spi.write(data)
self.cs.high()

0 comments on commit 44d2368

Please sign in to comment.