Skip to content

Commit 7de8922

Browse files
authored
Merge pull request #2 from bluejazzCHN/revert-1-pull/29
Revert "Pull/29"
2 parents 004be6b + 030fa8a commit 7de8922

File tree

3 files changed

+4
-67
lines changed

3 files changed

+4
-67
lines changed

README.rst

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ adafruit_max7219.Matrix8x8 Example
7373
7474
spi = busio.SPI(clk, MOSI=din)
7575
display = matrices.Matrix8x8(spi, cs)
76-
display.rotation(1) #change display direction
7776
while True:
7877
display.brightness(3)
7978
@@ -125,14 +124,3 @@ Documentation
125124
=============
126125

127126
For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.
128-
129-
130-
Additons
131-
=============
132-
133-
1. Add rotation func
134-
135-
.. code-block:: python
136-
137-
matrix = matrices.Matrix8x8(spi, cs)
138-
matrix.rotation(2)

adafruit_max7219/matrices.py

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66
`adafruit_max7219.matrices.Matrix8x8`
77
====================================================
88
"""
9-
import time
109
from micropython import const
1110
from adafruit_max7219 import max7219
1211

13-
1412
__version__ = "0.0.0-auto.0"
1513
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MAX7219.git"
1614

@@ -28,8 +26,8 @@ class Matrix8x8(max7219.MAX7219):
2826
:param ~digitalio.DigitalInOut cs: digital in/out to use as chip select signal
2927
"""
3028

31-
def __init__(self, spi, cs, num=1):
32-
super().__init__(8, 8, spi, cs, num=num)
29+
def __init__(self, spi, cs):
30+
super().__init__(8, 8, spi, cs)
3331

3432
def init_display(self):
3533
for cmd, data in (
@@ -39,7 +37,7 @@ def init_display(self):
3937
(_DECODEMODE, 0),
4038
(_SHUTDOWN, 1),
4139
):
42-
self._write([cmd, data] * self.num)
40+
self.write_cmd(cmd, data)
4341

4442
self.fill(0)
4543
self.show()
@@ -60,20 +58,3 @@ def clear_all(self):
6058
Clears all matrix leds.
6159
"""
6260
self.fill(0)
63-
64-
def display_str(self, data, delay=1):
65-
"""
66-
Display string on led matrix by matrix length
67-
68-
:param str: string that can be of any length.
69-
:param delay: transfer time from one screen to another screen. default value is 1s
70-
71-
"""
72-
i = -1
73-
for char in data:
74-
i += 1
75-
self.fill(0)
76-
self.text(char, 1, 0)
77-
self.show_char_position(i % self.num)
78-
if i % self.num == self.num - 1:
79-
time.sleep(delay)

adafruit_max7219/max7219.py

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@
5252
_DIGIT0 = const(1)
5353
_INTENSITY = const(10)
5454

55-
MAX7219_REG_NOOP = 0x0
56-
5755

5856
class MAX7219:
5957
"""
@@ -68,7 +66,7 @@ class MAX7219:
6866
"""
6967

7068
def __init__(
71-
self, width, height, spi, cs, *, baudrate=8000000, polarity=0, phase=0, num=1
69+
self, width, height, spi, cs, *, baudrate=8000000, polarity=0, phase=0
7270
):
7371

7472
self._chip_select = cs
@@ -83,7 +81,6 @@ def __init__(
8381

8482
self.width = width
8583
self.height = height
86-
self.num = num
8784

8885
self.init_display()
8986

@@ -93,7 +90,6 @@ def init_display(self):
9390
def brightness(self, value):
9491
"""
9592
Controls the brightness of the display.
96-
9793
:param int value: 0->15 dimmest to brightest
9894
"""
9995
if not 0 <= value <= 15:
@@ -112,15 +108,13 @@ def show(self, number=1, t_num=1):
112108
def fill(self, bit_value):
113109
"""
114110
Fill the display buffer.
115-
116111
:param int bit_value: value > 0 set the buffer bit, else clears the buffer bit
117112
"""
118113
self.framebuf.fill(bit_value)
119114

120115
def pixel(self, xpos, ypos, bit_value=None):
121116
"""
122117
Set one buffer bit
123-
124118
:param xpos: x position to set bit
125119
:param ypos: y position to set bit
126120
:param int bit_value: value > 0 sets the buffer bit, else clears the buffer bit
@@ -158,29 +152,3 @@ def rotation(self, direction):
158152
:param direction:set int to change display direction, value 0 (default), 1, 2, 3
159153
"""
160154
self.framebuf.rotation = direction
161-
162-
def _write(self, data):
163-
"""
164-
Send the bytes (which should comprise of alternating command, data values)
165-
over the SPI device.
166-
167-
:param data: command collections
168-
"""
169-
170-
self._chip_select.value = False
171-
with self._spi_device as my_spi_device:
172-
my_spi_device.write(bytes(data))
173-
self._chip_select.value = True
174-
175-
def show_char_position(self, position=0):
176-
"""
177-
write data to the position that is one of multi led matrix
178-
179-
:param position: the position of matrix, value begin 0.
180-
181-
"""
182-
for ypos in range(8):
183-
self._write(
184-
[_DIGIT0 + ypos, self._buffer[ypos]]
185-
+ ([MAX7219_REG_NOOP, 0] * (position))
186-
)

0 commit comments

Comments
 (0)