From b7fafc86a58905aaa200add86fd86caa0e748442 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan <37907774+FlantasticDan@users.noreply.github.com> Date: Sat, 25 Sep 2021 08:08:38 +0000 Subject: [PATCH 01/57] Chainable MAX7219 8x8 Matrices --- adafruit_max7219/matrices.py | 76 ++++++++++++++++++++++++++++++++++++ adafruit_max7219/max7219.py | 51 ++++++++++++++++++++++++ 2 files changed, 127 insertions(+) diff --git a/adafruit_max7219/matrices.py b/adafruit_max7219/matrices.py index 955e050..f3912be 100644 --- a/adafruit_max7219/matrices.py +++ b/adafruit_max7219/matrices.py @@ -58,3 +58,79 @@ def clear_all(self): Clears all matrix leds. """ self.fill(0) + + +class CustomMatrix(max7219.ChainableMAX7219): + """ + Driver for a custom 8x8 LED matrix constellation based on daisy chained MAX7219 chips. + + :param object spi: an spi busio or spi bitbangio object + :param ~digitalio.DigitalInOut cs: digital in/out to use as chip select signal + :param int width: the number of pixels wide + :param int height: the number of pixels high + :param int rotation: the number of times to rotate the coordinate system (default 1) + """ + + def __init__(self, spi, cs, width, height, *, rotation=1): + super().__init__(width, height, spi, cs) + + self.y_offset = width // 8 + self.y_index = self._calculate_y_coordinate_offsets() + + self.framebuf.rotation = rotation + + def _calculate_y_coordinate_offsets(self): + y_chunks = [] + for _ in range((self.chain_length * 8) // self.width): + y_chunks.append([]) + for index in range(self.chain_length * 8): + chunk = index % ((self.chain_length * 8) // self.width) + y_chunks[chunk].append(index) + y_index = [] + for chunk in y_chunks: + y_index += chunk + return y_index + + def init_display(self): + for cmd, data in ( + (_SHUTDOWN, 0), + (_DISPLAYTEST, 0), + (_SCANLIMIT, 7), + (_DECODEMODE, 0), + (_SHUTDOWN, 1), + ): + self.write_cmd(cmd, data) + + self.fill(0) + self.show() + + def text(self, strg, xpos, ypos, bit_value=1): + """ + Draw text in the 8x8 matrix. + + :param int xpos: x position of LED in matrix + :param int ypos: y position of LED in matrix + :param string strg: string to place in to display + :param bit_value: > 1 sets the text, otherwise resets + """ + self.framebuf.text(strg, xpos, ypos, bit_value) + + def clear_all(self): + """ + Clears all matrix leds. + """ + self.fill(0) + + def pixel(self, xpos, ypos, bit_value=None): + """ + Set one buffer bit + + :param xpos: x position to set bit + :param ypos: y position to set bit + :param int bit_value: value > 0 sets the buffer bit, else clears the buffer bit + """ + + buffer_y = xpos // 8 + self.y_index[ypos * self.y_offset] + buffer_x = xpos % 8 + + return super().pixel(buffer_x, buffer_y, bit_value=bit_value) diff --git a/adafruit_max7219/max7219.py b/adafruit_max7219/max7219.py index ff30c32..b2d2546 100644 --- a/adafruit_max7219/max7219.py +++ b/adafruit_max7219/max7219.py @@ -133,3 +133,54 @@ def write_cmd(self, cmd, data): self._chip_select.value = False with self._spi_device as my_spi_device: my_spi_device.write(bytearray([cmd, data])) + + +class ChainableMAX7219(MAX7219): + """ + Daisy Chainable MAX2719 - driver for cascading displays based on max719 chip_select + + :param int width: the number of pixels wide + :param int height: the number of pixels high + :param object spi: an spi busio or spi bitbangio object + :param ~digitalio.DigitalInOut chip_select: digital in/out to use as chip select signal + :param baudrate: for SPIDevice baudrate (default 8000000) + :param polarity: for SPIDevice polarity (default 0) + :param phase: for SPIDevice phase (default 0) + """ + + def __init__( + self, width, height, spi, cs, *, baudrate=8000000, polarity=0, phase=0 + ): + self.chain_length = (height // 8) * (width // 8) + + super().__init__( + width, height, spi, cs, baudrate=baudrate, polarity=polarity, phase=phase + ) + self._buffer = bytearray(self.chain_length * 8) + self.framebuf = framebuf.FrameBuffer1(self._buffer, self.chain_length * 8, 8) + + def write_cmd(self, cmd, data): + # pylint: disable=no-member + """Writes a command to spi device.""" + # print('cmd {} data {}'.format(cmd,data)) + self._chip_select.value = False + with self._spi_device as my_spi_device: + for _ in range(self.chain_length): + my_spi_device.write(bytearray([cmd, data])) + + def show(self): + """ + Updates the display. + """ + for ypos in range(8): + self._chip_select.value = False + with self._spi_device as my_spi_device: + for chip in range(self.chain_length): + my_spi_device.write( + bytearray( + [ + _DIGIT0 + ypos, + self._buffer[ypos * self.chain_length + chip], + ] + ) + ) From c826372b0ed8ace63e442649b1f68c7b2acefb3c Mon Sep 17 00:00:00 2001 From: Daniel Flanagan <37907774+FlantasticDan@users.noreply.github.com> Date: Mon, 27 Sep 2021 05:14:43 +0000 Subject: [PATCH 02/57] Fixed Y Coordinate Translation Calculations --- adafruit_max7219/matrices.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/adafruit_max7219/matrices.py b/adafruit_max7219/matrices.py index f3912be..73a2b58 100644 --- a/adafruit_max7219/matrices.py +++ b/adafruit_max7219/matrices.py @@ -81,11 +81,19 @@ def __init__(self, spi, cs, width, height, *, rotation=1): def _calculate_y_coordinate_offsets(self): y_chunks = [] - for _ in range((self.chain_length * 8) // self.width): + for _ in range(self.chain_length // (self.width // 8)): y_chunks.append([]) + chunk = 0 + chunk_size = 0 for index in range(self.chain_length * 8): - chunk = index % ((self.chain_length * 8) // self.width) y_chunks[chunk].append(index) + chunk_size += 1 + if chunk_size >= (self.width // 8): + chunk_size = 0 + chunk += 1 + if chunk >= len(y_chunks): + chunk = 0 + y_index = [] for chunk in y_chunks: y_index += chunk @@ -131,6 +139,5 @@ def pixel(self, xpos, ypos, bit_value=None): """ buffer_y = xpos // 8 + self.y_index[ypos * self.y_offset] - buffer_x = xpos % 8 - + buffer_x = (xpos - ((xpos // 8) * 8)) % 8 return super().pixel(buffer_x, buffer_y, bit_value=bit_value) From 6da9082f8fbb87b7eee6408b0380c9378757c960 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan <37907774+FlantasticDan@users.noreply.github.com> Date: Mon, 4 Oct 2021 23:38:41 +0000 Subject: [PATCH 03/57] Added Type Annotations --- adafruit_max7219/matrices.py | 32 ++++++++++++++++++++------------ adafruit_max7219/max7219.py | 30 +++++++++++++++++++++--------- 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/adafruit_max7219/matrices.py b/adafruit_max7219/matrices.py index d163f93..329d5b4 100644 --- a/adafruit_max7219/matrices.py +++ b/adafruit_max7219/matrices.py @@ -72,14 +72,22 @@ class CustomMatrix(max7219.ChainableMAX7219): """ Driver for a custom 8x8 LED matrix constellation based on daisy chained MAX7219 chips. - :param object spi: an spi busio or spi bitbangio object + :param ~busio.SPI spi: an spi busio or spi bitbangio object :param ~digitalio.DigitalInOut cs: digital in/out to use as chip select signal :param int width: the number of pixels wide :param int height: the number of pixels high :param int rotation: the number of times to rotate the coordinate system (default 1) """ - def __init__(self, spi, cs, width, height, *, rotation=1): + def __init__( + self, + spi: busio.SPI, + cs: digitalio.DigitalInOut, + width: int, + height: int, + *, + rotation: int = 1 + ): super().__init__(width, height, spi, cs) self.y_offset = width // 8 @@ -87,7 +95,7 @@ def __init__(self, spi, cs, width, height, *, rotation=1): self.framebuf.rotation = rotation - def _calculate_y_coordinate_offsets(self): + def _calculate_y_coordinate_offsets(self) -> None: y_chunks = [] for _ in range(self.chain_length // (self.width // 8)): y_chunks.append([]) @@ -107,7 +115,7 @@ def _calculate_y_coordinate_offsets(self): y_index += chunk return y_index - def init_display(self): + def init_display(self) -> None: for cmd, data in ( (_SHUTDOWN, 0), (_DISPLAYTEST, 0), @@ -120,29 +128,29 @@ def init_display(self): self.fill(0) self.show() - def text(self, strg, xpos, ypos, bit_value=1): + def text(self, strg: str, xpos: int, ypos: int, bit_value: int = 1) -> None: """ - Draw text in the 8x8 matrix. + Draw text in the matrix. + :param str strg: string to place in to display :param int xpos: x position of LED in matrix :param int ypos: y position of LED in matrix - :param string strg: string to place in to display - :param bit_value: > 1 sets the text, otherwise resets + :param int bit_value: > 1 sets the text, otherwise resets """ self.framebuf.text(strg, xpos, ypos, bit_value) - def clear_all(self): + def clear_all(self) -> None: """ Clears all matrix leds. """ self.fill(0) - def pixel(self, xpos, ypos, bit_value=None): + def pixel(self, xpos: int, ypos: int, bit_value: int = None) -> None: """ Set one buffer bit - :param xpos: x position to set bit - :param ypos: y position to set bit + :param int xpos: x position to set bit + :param int ypos: y position to set bit :param int bit_value: value > 0 sets the buffer bit, else clears the buffer bit """ diff --git a/adafruit_max7219/max7219.py b/adafruit_max7219/max7219.py index fe80458..a95c8a3 100644 --- a/adafruit_max7219/max7219.py +++ b/adafruit_max7219/max7219.py @@ -165,15 +165,23 @@ class ChainableMAX7219(MAX7219): :param int width: the number of pixels wide :param int height: the number of pixels high - :param object spi: an spi busio or spi bitbangio object + :param ~busio.SPI spi: an spi busio or spi bitbangio object :param ~digitalio.DigitalInOut chip_select: digital in/out to use as chip select signal - :param baudrate: for SPIDevice baudrate (default 8000000) - :param polarity: for SPIDevice polarity (default 0) - :param phase: for SPIDevice phase (default 0) + :param int baudrate: for SPIDevice baudrate (default 8000000) + :param int polarity: for SPIDevice polarity (default 0) + :param int phase: for SPIDevice phase (default 0) """ def __init__( - self, width, height, spi, cs, *, baudrate=8000000, polarity=0, phase=0 + self, + width: int, + height: int, + spi: busio.SPI, + cs: digitalio.DigitalInOut, + *, + baudrate: int = 8000000, + polarity: int = 0, + phase: int = 0 ): self.chain_length = (height // 8) * (width // 8) @@ -183,16 +191,20 @@ def __init__( self._buffer = bytearray(self.chain_length * 8) self.framebuf = framebuf.FrameBuffer1(self._buffer, self.chain_length * 8, 8) - def write_cmd(self, cmd, data): - # pylint: disable=no-member - """Writes a command to spi device.""" + def write_cmd(self, cmd: int, data: int) -> None: + """ + Writes a command to spi device. + + :param int cmd: register address to write data to + :param int data: data to be written to commanded register + """ # print('cmd {} data {}'.format(cmd,data)) self._chip_select.value = False with self._spi_device as my_spi_device: for _ in range(self.chain_length): my_spi_device.write(bytearray([cmd, data])) - def show(self): + def show(self) -> None: """ Updates the display. """ From 68e3928d98a020b3a6f522b526e785edb7c283b9 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan <37907774+FlantasticDan@users.noreply.github.com> Date: Tue, 5 Oct 2021 01:34:08 +0000 Subject: [PATCH 04/57] Remove text implementation on custom matricies --- adafruit_max7219/matrices.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/adafruit_max7219/matrices.py b/adafruit_max7219/matrices.py index 329d5b4..9084d7d 100644 --- a/adafruit_max7219/matrices.py +++ b/adafruit_max7219/matrices.py @@ -128,17 +128,6 @@ def init_display(self) -> None: self.fill(0) self.show() - def text(self, strg: str, xpos: int, ypos: int, bit_value: int = 1) -> None: - """ - Draw text in the matrix. - - :param str strg: string to place in to display - :param int xpos: x position of LED in matrix - :param int ypos: y position of LED in matrix - :param int bit_value: > 1 sets the text, otherwise resets - """ - self.framebuf.text(strg, xpos, ypos, bit_value) - def clear_all(self) -> None: """ Clears all matrix leds. From 3a437bb81806f13e0c232650bc3bcd3e0c4acfd7 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan <37907774+FlantasticDan@users.noreply.github.com> Date: Tue, 5 Oct 2021 07:19:08 +0000 Subject: [PATCH 05/57] Add text and rectangle functions to CustomMatrix --- adafruit_max7219/matrices.py | 102 +++++++++++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 4 deletions(-) diff --git a/adafruit_max7219/matrices.py b/adafruit_max7219/matrices.py index 9084d7d..d36a740 100644 --- a/adafruit_max7219/matrices.py +++ b/adafruit_max7219/matrices.py @@ -7,11 +7,12 @@ ==================================================== """ from micropython import const +from adafruit_framebuf import BitmapFont from adafruit_max7219 import max7219 try: # Used only for typing - import typing # pylint: disable=unused-import + from typing import Tuple import digitalio import busio except ImportError: @@ -94,6 +95,8 @@ def __init__( self.y_index = self._calculate_y_coordinate_offsets() self.framebuf.rotation = rotation + self.framebuf.fill_rect = self._fill_rect + self._font = None def _calculate_y_coordinate_offsets(self) -> None: y_chunks = [] @@ -142,7 +145,98 @@ def pixel(self, xpos: int, ypos: int, bit_value: int = None) -> None: :param int ypos: y position to set bit :param int bit_value: value > 0 sets the buffer bit, else clears the buffer bit """ - - buffer_y = xpos // 8 + self.y_index[ypos * self.y_offset] - buffer_x = (xpos - ((xpos // 8) * 8)) % 8 + buffer_x, buffer_y = self._pixel_coords_to_framebuf_coords(xpos, ypos) return super().pixel(buffer_x, buffer_y, bit_value=bit_value) + + def _pixel_coords_to_framebuf_coords(self, xpos: int, ypos: int) -> Tuple[int]: + """ + Convert matrix pixel coordinates into coordinates in the framebuffer + + :param int xpos: x position + :param int ypos: y position + :return: framebuffer coordinates (x, y) + :rtype: Tuple[int] + """ + return (xpos - ((xpos // 8) * 8)) % 8, xpos // 8 + self.y_index[ + ypos * self.y_offset + ] + + def rect( + self, x: int, y: int, width: int, height: int, color: int, fill: bool = False + ) -> None: + """ + Draw a rectangle at the given position of the given size, color, and fill. + + :param int x: x position + :param int y: y position + :param int width: width of rectangle + :param int height: height of rectangle + :param int color: color of rectangle + :param bool fill: 1 pixel outline or filled rectangle (default: False) + """ + # pylint: disable=too-many-arguments + for row in range(height): + y_pos = row + y + for col in range(width): + x_pos = col + x + if fill: + self.pixel(x_pos, y_pos, color) + elif y_pos in (y, y + height - 1) or x_pos in (x, x + width - 1): + self.pixel(x_pos, y_pos, color) + else: + continue + + def _fill_rect(self, x: int, y: int, width: int, height: int, color: int) -> None: + """ + Draw a filled rectangle at the given position of the given size, color. + + :param int x: x position + :param int y: y position + :param int width: width of rectangle + :param int height: height of rectangle + :param int color: color of rectangle + """ + # pylint: disable=too-many-arguments + return self.rect(x, y, width, height, color, True) + + # Adafruit Circuit Python Framebuf Text Function + # Authors: Kattni Rembor, Melissa LeBlanc-Williams and Tony DiCola, for Adafruit Industries + # License: MIT License (https://opensource.org/licenses/MIT) + def text( + self, + strg: str, + xpos: int, + ypos: int, + color: int = 1, + *, + font_name: str = "font5x8.bin", + size: int = 1 + ) -> None: + """ + Draw text in the matrix. + + :param str strg: string to place in to display + :param int xpos: x position of LED in matrix + :param int ypos: y position of LED in matrix + :param int color: > 1 sets the text, otherwise resets + :param str font_name: path to binary font file (default: "font5x8.bin") + :param int size: size of the font, acts as a multiplier + """ + for chunk in strg.split("\n"): + if not self._font or self._font.font_name != font_name: + # load the font! + self._font = BitmapFont(font_name) + width = self._font.font_width + height = self._font.font_height + for i, char in enumerate(chunk): + char_x = xpos + (i * (width + 1)) * size + if ( + char_x + (width * size) > 0 + and char_x < self.width + and ypos + (height * size) > 0 + and ypos < self.height + ): + self._font.draw_char( + char, char_x, ypos, self.framebuf, color, size=size + ) + ypos += height * size From 71f85b80ba4a0f0b16e7d5a73b2579e79a3b4d22 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan <37907774+FlantasticDan@users.noreply.github.com> Date: Sun, 10 Oct 2021 03:18:33 +0000 Subject: [PATCH 06/57] added scroll function to CustomMatrix --- adafruit_max7219/matrices.py | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/adafruit_max7219/matrices.py b/adafruit_max7219/matrices.py index d36a740..f236739 100644 --- a/adafruit_max7219/matrices.py +++ b/adafruit_max7219/matrices.py @@ -161,6 +161,52 @@ def _pixel_coords_to_framebuf_coords(self, xpos: int, ypos: int) -> Tuple[int]: ypos * self.y_offset ] + def _get_pixel(self, xpos: int, ypos: int) -> int: + """ + Get value of a matrix pixel + + :param int xpos: x position + :param int ypos: y position + :return: value of pixel in matrix + :rtype: int + """ + x, y = self._pixel_coords_to_framebuf_coords(xpos, ypos) + buffer_value = self._buffer[-1 * y - 1] + return ((buffer_value & 2 ** x) >> x) & 1 + + # Adafruit Circuit Python Framebuf Scroll Function + # Authors: Kattni Rembor, Melissa LeBlanc-Williams and Tony DiCola, for Adafruit Industries + # License: MIT License (https://opensource.org/licenses/MIT) + def scroll(self, delta_x: int, delta_y: int) -> None: + """ + Srcolls the display using delta_x, delta_y. + + :param int delta_x: positions to scroll in the x direction + :param int delta_y: positions to scroll in the y direction + """ + if delta_x < 0: + shift_x = 0 + xend = self.width + delta_x + dt_x = 1 + else: + shift_x = self.width - 1 + xend = delta_x - 1 + dt_x = -1 + if delta_y < 0: + y = 0 + yend = self.height + delta_y + dt_y = 1 + else: + y = self.height - 1 + yend = delta_y - 1 + dt_y = -1 + while y != yend: + x = shift_x + while x != xend: + self.pixel(x, y, self._get_pixel(x - delta_x, y - delta_y)) + x += dt_x + y += dt_y + def rect( self, x: int, y: int, width: int, height: int, color: int, fill: bool = False ) -> None: From d0b1def18aeb80029603d26d3c2947b1a6a56bc8 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan <37907774+FlantasticDan@users.noreply.github.com> Date: Sun, 10 Oct 2021 04:33:24 +0000 Subject: [PATCH 07/57] update docs + copyright --- adafruit_max7219/matrices.py | 5 +++ adafruit_max7219/max7219.py | 6 ++- docs/examples.rst | 4 ++ examples/max7219_custommatrixtest.py | 63 ++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 examples/max7219_custommatrixtest.py diff --git a/adafruit_max7219/matrices.py b/adafruit_max7219/matrices.py index f236739..f661b56 100644 --- a/adafruit_max7219/matrices.py +++ b/adafruit_max7219/matrices.py @@ -1,9 +1,11 @@ # SPDX-FileCopyrightText: 2017 Dan Halbert for Adafruit Industries +# SPDX-FileCopyrightText: 2021 Daniel Flanagan # # SPDX-License-Identifier: MIT """ `adafruit_max7219.matrices.Matrix8x8` +`adafruit_max7219.matrices.CustomMatrix` ==================================================== """ from micropython import const @@ -137,6 +139,7 @@ def clear_all(self) -> None: """ self.fill(0) + # pylint: disable=inconsistent-return-statements def pixel(self, xpos: int, ypos: int, bit_value: int = None) -> None: """ Set one buffer bit @@ -145,6 +148,8 @@ def pixel(self, xpos: int, ypos: int, bit_value: int = None) -> None: :param int ypos: y position to set bit :param int bit_value: value > 0 sets the buffer bit, else clears the buffer bit """ + if xpos < 0 or ypos < 0 or xpos >= self.width or ypos >= self.height: + return buffer_x, buffer_y = self._pixel_coords_to_framebuf_coords(xpos, ypos) return super().pixel(buffer_x, buffer_y, bit_value=bit_value) diff --git a/adafruit_max7219/max7219.py b/adafruit_max7219/max7219.py index a95c8a3..c1960c2 100644 --- a/adafruit_max7219/max7219.py +++ b/adafruit_max7219/max7219.py @@ -1,5 +1,6 @@ # SPDX-FileCopyrightText: 2016 Philip R. Moyer for Adafruit Industries # SPDX-FileCopyrightText: 2016 Radomir Dopieralski for Adafruit Industries +# SPDX-FileCopyrightText: 2021 Daniel Flanagan # # SPDX-License-Identifier: MIT @@ -13,6 +14,7 @@ See Also ========= * matrices.Maxtrix8x8 is a class support an 8x8 led matrix display +* matrices.CustomMatrix is a class support a custom sized constellation of 8x8 led matrix displays * bcddigits.BCDDigits is a class that support the 8 digit 7-segment display Beware that most CircuitPython compatible hardware are 3.3v logic level! Make @@ -60,7 +62,7 @@ class MAX7219: """ - MAX2719 - driver for displays based on max719 chip_select + MAX7219 - driver for displays based on max7219 chip_select :param int width: the number of pixels wide :param int height: the number of pixels high @@ -161,7 +163,7 @@ def write_cmd(self, cmd: int, data: int) -> None: class ChainableMAX7219(MAX7219): """ - Daisy Chainable MAX2719 - driver for cascading displays based on max719 chip_select + Daisy Chainable MAX7219 - driver for cascading displays based on max7219 chip_select :param int width: the number of pixels wide :param int height: the number of pixels high diff --git a/docs/examples.rst b/docs/examples.rst index 9d6e998..66ab429 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -10,3 +10,7 @@ Ensure your device works with this simple test. .. literalinclude:: ../examples/max7219_showbcddigits.py :caption: examples/max7219_showbcddigits.py :linenos: + +.. literalinclude:: ../examples/max7219_custommatrixtest.py + :caption: examples/max7219_custommatrixtest.py + :linenos: diff --git a/examples/max7219_custommatrixtest.py b/examples/max7219_custommatrixtest.py new file mode 100644 index 0000000..9b7c7f6 --- /dev/null +++ b/examples/max7219_custommatrixtest.py @@ -0,0 +1,63 @@ +# SPDX-FileCopyrightText: 2021 Daniel Flanagan +# SPDX-License-Identifier: MIT + +import time +from board import TX, RX, A1 +import busio +import digitalio +from adafruit_max7219 import matrices + +mosi = TX +clk = RX +cs = digitalio.DigitalInOut(A1) + +spi = busio.SPI(clk, MOSI=mosi) + +matrix = matrices.CustomMatrix(spi, cs, 32, 8) +while True: + print("Cycle Start") + # all lit up + matrix.fill(True) + matrix.show() + time.sleep(0.5) + + # all off + matrix.fill(False) + matrix.show() + time.sleep(0.5) + + # snake across panel + for y in range(8): + for x in range(32): + if not y % 2: + matrix.pixel(x, y, 1) + else: + matrix.pixel(31 - x, y, 1) + matrix.show() + time.sleep(0.05) + + # show a string one character at a time + adafruit = "Adafruit" + matrix.fill(0) + for i, char in enumerate(adafruit[:3]): + matrix.text(char, i * 6, 0) + matrix.show() + time.sleep(1.0) + matrix.fill(0) + for i, char in enumerate(adafruit[3:]): + matrix.text(char, i * 6, 0) + matrix.show() + time.sleep(1.0) + + # scroll the last character off the display + for i in range(32): + matrix.scroll(-1, 0) + matrix.show() + time.sleep(0.25) + + # scroll a string across the display + for pixel_position in range(len(adafruit) * 8): + matrix.fill(0) + matrix.text(adafruit, -pixel_position, 0) + matrix.show() + time.sleep(0.25) From 75393471c84bbc317b686a3c3341a5848499f929 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan <37907774+FlantasticDan@users.noreply.github.com> Date: Sun, 10 Oct 2021 04:46:58 +0000 Subject: [PATCH 08/57] missed docstring --- adafruit_max7219/max7219.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adafruit_max7219/max7219.py b/adafruit_max7219/max7219.py index c1960c2..a0ebdbb 100644 --- a/adafruit_max7219/max7219.py +++ b/adafruit_max7219/max7219.py @@ -6,6 +6,7 @@ """ `adafruit_max7219.max7219` - MAX7219 LED Matrix/Digit Display Driver +`adafruit_max7219.ChainableMAX7219` - Chained MAX7219 LED Matrix/Digit Display Driver ======================================================================== CircuitPython library to support MAX7219 LED Matrix/Digit Display Driver. This library supports the use of the MAX7219-based display in CircuitPython, From fd61e87449d6e9f369581b7af396f2d56483f107 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan <37907774+FlantasticDan@users.noreply.github.com> Date: Sun, 10 Oct 2021 06:32:38 +0000 Subject: [PATCH 09/57] Fix documentation generation --- adafruit_max7219/matrices.py | 3 +-- adafruit_max7219/max7219.py | 1 - docs/api.rst | 1 + docs/conf.py | 1 + 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/adafruit_max7219/matrices.py b/adafruit_max7219/matrices.py index f661b56..1da6be7 100644 --- a/adafruit_max7219/matrices.py +++ b/adafruit_max7219/matrices.py @@ -4,8 +4,7 @@ # SPDX-License-Identifier: MIT """ -`adafruit_max7219.matrices.Matrix8x8` -`adafruit_max7219.matrices.CustomMatrix` +`adafruit_max7219.matrices` ==================================================== """ from micropython import const diff --git a/adafruit_max7219/max7219.py b/adafruit_max7219/max7219.py index a0ebdbb..c1960c2 100644 --- a/adafruit_max7219/max7219.py +++ b/adafruit_max7219/max7219.py @@ -6,7 +6,6 @@ """ `adafruit_max7219.max7219` - MAX7219 LED Matrix/Digit Display Driver -`adafruit_max7219.ChainableMAX7219` - Chained MAX7219 LED Matrix/Digit Display Driver ======================================================================== CircuitPython library to support MAX7219 LED Matrix/Digit Display Driver. This library supports the use of the MAX7219-based display in CircuitPython, diff --git a/docs/api.rst b/docs/api.rst index 90c64dc..995ba9d 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -3,6 +3,7 @@ .. automodule:: adafruit_max7219.max7219 :members: + :show-inheritance: .. automodule:: adafruit_max7219.matrices :members: diff --git a/docs/conf.py b/docs/conf.py index cc6a713..eb3d29a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,6 +24,7 @@ # digitalio, micropython and busio. List the modules you use. Without it, the # autodoc module docs will fail to generate with a warning. autodoc_mock_imports = ["framebuf"] +autodoc_member_order = "bysource" intersphinx_mapping = { "python": ("https://docs.python.org/3.4", None), From ff50b52e3095673cc5aae6f84e98b09629ac4c9a Mon Sep 17 00:00:00 2001 From: dherrada Date: Tue, 9 Nov 2021 13:31:14 -0500 Subject: [PATCH 10/57] Updated readthedocs file Signed-off-by: dherrada --- .readthedocs.yaml | 15 +++++++++++++++ .readthedocs.yml | 7 ------- 2 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 .readthedocs.yaml delete mode 100644 .readthedocs.yml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..95ec218 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries +# +# SPDX-License-Identifier: Unlicense + +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +python: + version: "3.6" + install: + - requirements: docs/requirements.txt + - requirements: requirements.txt diff --git a/.readthedocs.yml b/.readthedocs.yml deleted file mode 100644 index 49dcab3..0000000 --- a/.readthedocs.yml +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries -# -# SPDX-License-Identifier: Unlicense - -python: - version: 3 -requirements_file: docs/requirements.txt From 2fe760c4867f7fa6063cfde55a726445cae67722 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Tue, 23 Nov 2021 13:04:29 -0600 Subject: [PATCH 11/57] update rtd py version --- .readthedocs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 95ec218..1335112 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,7 @@ version: 2 python: - version: "3.6" + version: "3.7" install: - requirements: docs/requirements.txt - requirements: requirements.txt From 977ae629f657ce7ec6885dbb23fa768403f83f51 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 13 Jan 2022 16:27:30 -0500 Subject: [PATCH 12/57] First part of patch Signed-off-by: dherrada --- .../PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md | 2 +- .github/workflows/build.yml | 6 +++--- .github/workflows/release.yml | 8 ++++---- .readthedocs.yaml | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md b/.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md index 71ef8f8..8de294e 100644 --- a/.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md +++ b/.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md @@ -4,7 +4,7 @@ Thank you for contributing! Before you submit a pull request, please read the following. -Make sure any changes you're submitting are in line with the CircuitPython Design Guide, available here: https://circuitpython.readthedocs.io/en/latest/docs/design_guide.html +Make sure any changes you're submitting are in line with the CircuitPython Design Guide, available here: https://docs.circuitpython.org/en/latest/docs/design_guide.html If your changes are to documentation, please verify that the documentation builds locally by following the steps found here: https://adafru.it/build-docs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ca35544..474520d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,10 +22,10 @@ jobs: awk -F '\/' '{ print tolower($2) }' | tr '_' '-' ) - - name: Set up Python 3.7 - uses: actions/setup-python@v1 + - name: Set up Python 3.x + uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: "3.x" - name: Versions run: | python3 --version diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d0015a..a65e5de 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,10 +24,10 @@ jobs: awk -F '\/' '{ print tolower($2) }' | tr '_' '-' ) - - name: Set up Python 3.6 - uses: actions/setup-python@v1 + - name: Set up Python 3.x + uses: actions/setup-python@v2 with: - python-version: 3.6 + python-version: "3.x" - name: Versions run: | python3 --version @@ -67,7 +67,7 @@ jobs: echo ::set-output name=setup-py::$( find . -wholename './setup.py' ) - name: Set up Python if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: '3.x' - name: Install dependencies diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 1335112..f8b2891 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,7 @@ version: 2 python: - version: "3.7" + version: "3.x" install: - requirements: docs/requirements.txt - requirements: requirements.txt From 8874eefeb41f1f8fa0992722b8ba62decaf0402e Mon Sep 17 00:00:00 2001 From: dherrada Date: Mon, 24 Jan 2022 16:46:17 -0500 Subject: [PATCH 13/57] Updated docs link, updated python docs link, updated setup.py --- README.rst | 4 ++-- docs/conf.py | 6 +++--- docs/index.rst | 2 +- setup.py | 2 -- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 1eb7686..e1a79b4 100644 --- a/README.rst +++ b/README.rst @@ -3,7 +3,7 @@ Introduction ============ .. image :: https://readthedocs.org/projects/adafruit-circuitpython-max7219/badge/?version=latest - :target: https://circuitpython.readthedocs.io/projects/max7219/en/latest/ + :target: https://docs.circuitpython.org/projects/max7219/en/latest/ :alt: Documentation Status .. image :: https://img.shields.io/discord/327254708534116352.svg @@ -116,7 +116,7 @@ adafruit_max7219.BCDDigits Example Documentation ============= -API documentation for this library can be found on `Read the Docs `_. +API documentation for this library can be found on `Read the Docs `_. Contributing ============ diff --git a/docs/conf.py b/docs/conf.py index eb3d29a..94337be 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -27,12 +27,12 @@ autodoc_member_order = "bysource" intersphinx_mapping = { - "python": ("https://docs.python.org/3.4", None), + "python": ("https://docs.python.org/3", None), "BusDevice": ( - "https://circuitpython.readthedocs.io/projects/busdevice/en/latest/", + "https://docs.circuitpython.org/projects/busdevice/en/latest/", None, ), - "CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None), + "CircuitPython": ("https://docs.circuitpython.org/en/latest/", None), } # Add any paths that contain templates here, relative to this directory. diff --git a/docs/index.rst b/docs/index.rst index 1fff48a..0a96095 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -33,7 +33,7 @@ Table of Contents :caption: Other Links Download - CircuitPython Reference Documentation + CircuitPython Reference Documentation CircuitPython Support Forum Discord Chat Adafruit Learning System diff --git a/setup.py b/setup.py index 46d40bc..ef06dbc 100644 --- a/setup.py +++ b/setup.py @@ -45,8 +45,6 @@ "Topic :: System :: Hardware", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", ], # What does your project relate to? keywords="adafruit max7219 LED matrix breakout hardware micropython circuitpython", From 042b936d9b6bc553131607f2e1bac8b9f218f9b5 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Wed, 9 Feb 2022 13:02:09 -0500 Subject: [PATCH 14/57] Consolidate Documentation sections of README --- README.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index e1a79b4..986f692 100644 --- a/README.rst +++ b/README.rst @@ -118,14 +118,11 @@ Documentation API documentation for this library can be found on `Read the Docs `_. +For information on building library documentation, please check out `this guide `_. + Contributing ============ Contributions are welcome! Please read our `Code of Conduct `_ before contributing to help this project stay welcoming. - -Documentation -============= - -For information on building library documentation, please check out `this guide `_. From f961b0e27b75e0ebe7aa82a63689bc4f264f4c37 Mon Sep 17 00:00:00 2001 From: dherrada Date: Mon, 14 Feb 2022 15:35:02 -0500 Subject: [PATCH 15/57] Fixed readthedocs build Signed-off-by: dherrada --- .readthedocs.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index f8b2891..33c2a61 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -8,8 +8,12 @@ # Required version: 2 +build: + os: ubuntu-20.04 + tools: + python: "3" + python: - version: "3.x" install: - requirements: docs/requirements.txt - requirements: requirements.txt From 8c74901f233f6cf6185517c57138b16a362ce308 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Mon, 28 Mar 2022 15:52:04 -0400 Subject: [PATCH 16/57] Update Black to latest. Signed-off-by: Kattni Rembor --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 43d1385..29230db 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ repos: - repo: https://github.com/python/black - rev: 20.8b1 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/fsfe/reuse-tool From 3e49400d9e02217eb88c5474c1acb6f968877961 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Tue, 29 Mar 2022 16:50:56 -0400 Subject: [PATCH 17/57] Reformatted per new black version --- adafruit_max7219/bcddigits.py | 2 +- adafruit_max7219/matrices.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_max7219/bcddigits.py b/adafruit_max7219/bcddigits.py index 19749f5..81ec5ff 100644 --- a/adafruit_max7219/bcddigits.py +++ b/adafruit_max7219/bcddigits.py @@ -46,7 +46,7 @@ def init_display(self) -> None: (_SHUTDOWN, 0), (_DISPLAYTEST, 0), (_SCANLIMIT, 7), - (_DECODEMODE, (2 ** self._ndigits) - 1), + (_DECODEMODE, (2**self._ndigits) - 1), (_SHUTDOWN, 1), ): self.write_cmd(cmd, data) diff --git a/adafruit_max7219/matrices.py b/adafruit_max7219/matrices.py index 1da6be7..faccbd2 100644 --- a/adafruit_max7219/matrices.py +++ b/adafruit_max7219/matrices.py @@ -176,7 +176,7 @@ def _get_pixel(self, xpos: int, ypos: int) -> int: """ x, y = self._pixel_coords_to_framebuf_coords(xpos, ypos) buffer_value = self._buffer[-1 * y - 1] - return ((buffer_value & 2 ** x) >> x) & 1 + return ((buffer_value & 2**x) >> x) & 1 # Adafruit Circuit Python Framebuf Scroll Function # Authors: Kattni Rembor, Melissa LeBlanc-Williams and Tony DiCola, for Adafruit Industries From e4abdcdc433b77a0cd883e153139ebec50ab8ce0 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Fri, 1 Apr 2022 12:58:59 -0400 Subject: [PATCH 18/57] Update examples to more expected pinout --- examples/max7219_custommatrixtest.py | 9 +++++---- examples/max7219_showbcddigits.py | 9 +++++---- examples/max7219_simpletest.py | 9 +++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/examples/max7219_custommatrixtest.py b/examples/max7219_custommatrixtest.py index 9b7c7f6..85f3b4e 100644 --- a/examples/max7219_custommatrixtest.py +++ b/examples/max7219_custommatrixtest.py @@ -2,14 +2,15 @@ # SPDX-License-Identifier: MIT import time -from board import TX, RX, A1 +import board import busio import digitalio from adafruit_max7219 import matrices -mosi = TX -clk = RX -cs = digitalio.DigitalInOut(A1) +# You may need to change the chip select board depending on your wiring +mosi = board.MOSI +clk = board.CLK +cs = digitalio.DigitalInOut(board.D4) spi = busio.SPI(clk, MOSI=mosi) diff --git a/examples/max7219_showbcddigits.py b/examples/max7219_showbcddigits.py index cb84981..d1641d2 100644 --- a/examples/max7219_showbcddigits.py +++ b/examples/max7219_showbcddigits.py @@ -3,14 +3,15 @@ import time import random -from board import TX, RX, A1 +import board import busio import digitalio from adafruit_max7219 import bcddigits -mosi = TX -clk = RX -cs = digitalio.DigitalInOut(A1) +# You may need to change the chip select board depending on your wiring +mosi = board.MOSI +clk = board.CLK +cs = digitalio.DigitalInOut(board.D4) spi = busio.SPI(clk, MOSI=mosi) diff --git a/examples/max7219_simpletest.py b/examples/max7219_simpletest.py index 0d4f5df..ba45070 100644 --- a/examples/max7219_simpletest.py +++ b/examples/max7219_simpletest.py @@ -2,14 +2,15 @@ # SPDX-License-Identifier: MIT import time -from board import TX, RX, A1 +import board import busio import digitalio from adafruit_max7219 import matrices -mosi = TX -clk = RX -cs = digitalio.DigitalInOut(A1) +# You may need to change the chip select board depending on your wiring +mosi = board.MOSI +clk = board.CLK +cs = digitalio.DigitalInOut(board.D4) spi = busio.SPI(clk, MOSI=mosi) From 8a4ff66bc8063ad83c6cb33362cbc30a02dbf48b Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Fri, 1 Apr 2022 14:42:59 -0400 Subject: [PATCH 19/57] Use board.SPI() instead of busio.SPI --- examples/max7219_custommatrixtest.py | 7 ++----- examples/max7219_showbcddigits.py | 6 ++---- examples/max7219_simpletest.py | 7 ++----- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/examples/max7219_custommatrixtest.py b/examples/max7219_custommatrixtest.py index 85f3b4e..786f094 100644 --- a/examples/max7219_custommatrixtest.py +++ b/examples/max7219_custommatrixtest.py @@ -3,17 +3,14 @@ import time import board -import busio import digitalio from adafruit_max7219 import matrices + # You may need to change the chip select board depending on your wiring -mosi = board.MOSI -clk = board.CLK +spi = board.SPI() cs = digitalio.DigitalInOut(board.D4) -spi = busio.SPI(clk, MOSI=mosi) - matrix = matrices.CustomMatrix(spi, cs, 32, 8) while True: print("Cycle Start") diff --git a/examples/max7219_showbcddigits.py b/examples/max7219_showbcddigits.py index d1641d2..87334dc 100644 --- a/examples/max7219_showbcddigits.py +++ b/examples/max7219_showbcddigits.py @@ -8,13 +8,11 @@ import digitalio from adafruit_max7219 import bcddigits + # You may need to change the chip select board depending on your wiring -mosi = board.MOSI -clk = board.CLK +spi = board.SPI() cs = digitalio.DigitalInOut(board.D4) -spi = busio.SPI(clk, MOSI=mosi) - leds = bcddigits.BCDDigits(spi, cs, nDigits=8) while True: # clear display and dim 0 diff --git a/examples/max7219_simpletest.py b/examples/max7219_simpletest.py index ba45070..d444755 100644 --- a/examples/max7219_simpletest.py +++ b/examples/max7219_simpletest.py @@ -3,17 +3,14 @@ import time import board -import busio import digitalio from adafruit_max7219 import matrices + # You may need to change the chip select board depending on your wiring -mosi = board.MOSI -clk = board.CLK +spi = board.SPI() cs = digitalio.DigitalInOut(board.D4) -spi = busio.SPI(clk, MOSI=mosi) - matrix = matrices.Matrix8x8(spi, cs) while True: print("Cycle start") From 2f58be88bf53a1f0450dd959965a8329300dbf1d Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Fri, 1 Apr 2022 14:47:33 -0400 Subject: [PATCH 20/57] Remove unused busio import --- examples/max7219_showbcddigits.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/max7219_showbcddigits.py b/examples/max7219_showbcddigits.py index 87334dc..13d01f8 100644 --- a/examples/max7219_showbcddigits.py +++ b/examples/max7219_showbcddigits.py @@ -4,7 +4,6 @@ import time import random import board -import busio import digitalio from adafruit_max7219 import bcddigits From 5008eb987f3a9ab24eaf8095fd00b4847d793d25 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Fri, 1 Apr 2022 15:30:39 -0400 Subject: [PATCH 21/57] Update comment to reference pin instead of board --- examples/max7219_custommatrixtest.py | 2 +- examples/max7219_showbcddigits.py | 2 +- examples/max7219_simpletest.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/max7219_custommatrixtest.py b/examples/max7219_custommatrixtest.py index 786f094..2a390f2 100644 --- a/examples/max7219_custommatrixtest.py +++ b/examples/max7219_custommatrixtest.py @@ -7,7 +7,7 @@ from adafruit_max7219 import matrices -# You may need to change the chip select board depending on your wiring +# You may need to change the chip select pin depending on your wiring spi = board.SPI() cs = digitalio.DigitalInOut(board.D4) diff --git a/examples/max7219_showbcddigits.py b/examples/max7219_showbcddigits.py index 13d01f8..b7979aa 100644 --- a/examples/max7219_showbcddigits.py +++ b/examples/max7219_showbcddigits.py @@ -8,7 +8,7 @@ from adafruit_max7219 import bcddigits -# You may need to change the chip select board depending on your wiring +# You may need to change the chip select pin depending on your wiring spi = board.SPI() cs = digitalio.DigitalInOut(board.D4) diff --git a/examples/max7219_simpletest.py b/examples/max7219_simpletest.py index d444755..251967e 100644 --- a/examples/max7219_simpletest.py +++ b/examples/max7219_simpletest.py @@ -7,7 +7,7 @@ from adafruit_max7219 import matrices -# You may need to change the chip select board depending on your wiring +# You may need to change the chip select pin depending on your wiring spi = board.SPI() cs = digitalio.DigitalInOut(board.D4) From c3849b9c5e8cbcc9660d53b2bbb9d04e20f289cb Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Fri, 1 Apr 2022 15:30:54 -0400 Subject: [PATCH 22/57] Simplify README examples section --- README.rst | 57 +----------------------------------------------------- 1 file changed, 1 insertion(+), 56 deletions(-) diff --git a/README.rst b/README.rst index 986f692..031bedd 100644 --- a/README.rst +++ b/README.rst @@ -56,62 +56,7 @@ To install in a virtual environment in your current project: Usage Example ============= -adafruit_max7219.Matrix8x8 Example ----------------------------------- - -.. code-block:: python - - from adafruit_max7219 import matrices - from board import TX, RX, A2 - import busio - import digitalio - import time - - clk = RX - din = TX - cs = digitalio.DigitalInOut(A2) - - spi = busio.SPI(clk, MOSI=din) - display = matrices.Matrix8x8(spi, cs) - while True: - display.brightness(3) - - display.fill(1) - display.pixel(3, 3) - display.pixel(3, 4) - display.pixel(4, 3) - display.pixel(4, 4) - display.show() - time.sleep(3.0) - - display.clear_all() - s = 'Hello, World!' - for c in range(len(s)*8): - display.fill(0) - display.text(s,-c,0) - display.show() - time.sleep(0.25) - - -adafruit_max7219.BCDDigits Example ----------------------------------- - -.. code-block:: python - - from adafruit_max7219 import bcddigits - from board import TX, RX, A2 - import bitbangio - import digitalio - - clk = RX - din = TX - cs = digitalio.DigitalInOut(A2) - - spi = bitbangio.SPI(clk, MOSI=din) - display = bcddigits.BCDDigits(spi, cs, nDigits=8) - display.clear_all() - display.show_str(0,'{:9.2f}'.format(-1234.56)) - display.show() +See the ``examples/`` folder example uses of this library. Documentation ============= From 24c1e4219b13d5b8378ed4bd426994107a7ce29a Mon Sep 17 00:00:00 2001 From: evaherrada Date: Thu, 21 Apr 2022 15:00:27 -0400 Subject: [PATCH 23/57] Updated gitignore Signed-off-by: evaherrada --- .gitignore | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 9647e71..544ec4a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,47 @@ -# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries +# SPDX-FileCopyrightText: 2022 Kattni Rembor, written for Adafruit Industries # -# SPDX-License-Identifier: Unlicense +# SPDX-License-Identifier: MIT +# Do not include files and directories created by your personal work environment, such as the IDE +# you use, except for those already listed here. Pull requests including changes to this file will +# not be accepted. + +# This .gitignore file contains rules for files generated by working with CircuitPython libraries, +# including building Sphinx, testing with pip, and creating a virual environment, as well as the +# MacOS and IDE-specific files generated by using MacOS in general, or the PyCharm or VSCode IDEs. + +# If you find that there are files being generated on your machine that should not be included in +# your git commit, you should create a .gitignore_global file on your computer to include the +# files created by your personal setup. To do so, follow the two steps below. + +# First, create a file called .gitignore_global somewhere convenient for you, and add rules for +# the files you want to exclude from git commits. + +# Second, configure Git to use the exclude file for all Git repositories by running the +# following via commandline, replacing "path/to/your/" with the actual path to your newly created +# .gitignore_global file: +# git config --global core.excludesfile path/to/your/.gitignore_global + +# CircuitPython-specific files *.mpy -.idea + +# Python-specific files __pycache__ -_build *.pyc + +# Sphinx build-specific files +_build + +# This file results from running `pip -e install .` in a local repository +*.egg-info + +# Virtual environment-specific files .env -bundles + +# MacOS-specific files *.DS_Store -.eggs -dist -**/*.egg-info + +# IDE-specific files +.idea +.vscode +*~ From c70c777c00143c7615b19c5c0f7cc80321f9b032 Mon Sep 17 00:00:00 2001 From: evaherrada Date: Fri, 22 Apr 2022 15:58:56 -0400 Subject: [PATCH 24/57] Patch: Replaced discord badge image --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 031bedd..80d1de6 100644 --- a/README.rst +++ b/README.rst @@ -6,7 +6,7 @@ Introduction :target: https://docs.circuitpython.org/projects/max7219/en/latest/ :alt: Documentation Status -.. image :: https://img.shields.io/discord/327254708534116352.svg +.. image:: https://github.com/adafruit/Adafruit_CircuitPython_Bundle/blob/main/badges/adafruit_discord.svg :target: https://adafru.it/discord :alt: Discord From 366bee48a0605809ffa29d53adcbca60eb08dc61 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sun, 24 Apr 2022 13:54:10 -0500 Subject: [PATCH 25/57] change discord badge --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 80d1de6..05bf341 100644 --- a/README.rst +++ b/README.rst @@ -6,7 +6,7 @@ Introduction :target: https://docs.circuitpython.org/projects/max7219/en/latest/ :alt: Documentation Status -.. image:: https://github.com/adafruit/Adafruit_CircuitPython_Bundle/blob/main/badges/adafruit_discord.svg +.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg :target: https://adafru.it/discord :alt: Discord From 3c18d787ef58099d0d4ad6bdc6ae47a2ebc3e512 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Sun, 15 May 2022 12:20:31 -0400 Subject: [PATCH 26/57] Patch .pre-commit-config.yaml --- .pre-commit-config.yaml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 29230db..0a91a11 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,40 +3,40 @@ # SPDX-License-Identifier: Unlicense repos: -- repo: https://github.com/python/black + - repo: https://github.com/python/black rev: 22.3.0 hooks: - - id: black -- repo: https://github.com/fsfe/reuse-tool - rev: v0.12.1 + - id: black + - repo: https://github.com/fsfe/reuse-tool + rev: v0.14.0 hooks: - - id: reuse -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + - id: reuse + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.2.0 hooks: - - id: check-yaml - - id: end-of-file-fixer - - id: trailing-whitespace -- repo: https://github.com/pycqa/pylint + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - repo: https://github.com/pycqa/pylint rev: v2.11.1 hooks: - - id: pylint + - id: pylint name: pylint (library code) types: [python] args: - --disable=consider-using-f-string,duplicate-code exclude: "^(docs/|examples/|tests/|setup.py$)" - - id: pylint + - id: pylint name: pylint (example code) description: Run pylint rules on "examples/*.py" files types: [python] files: "^examples/" args: - - --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code - - id: pylint + - --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code + - id: pylint name: pylint (test code) description: Run pylint rules on "tests/*.py" files types: [python] files: "^tests/" args: - - --disable=missing-docstring,consider-using-f-string,duplicate-code + - --disable=missing-docstring,consider-using-f-string,duplicate-code From 60afd935ef62ff6549476aa97d802b2c118520d2 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Sun, 22 May 2022 00:18:55 -0400 Subject: [PATCH 27/57] Increase min lines similarity Signed-off-by: Alec Delaney --- .pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index cfd1c41..f006a4a 100644 --- a/.pylintrc +++ b/.pylintrc @@ -252,7 +252,7 @@ ignore-docstrings=yes ignore-imports=yes # Minimum lines number of a similarity. -min-similarity-lines=4 +min-similarity-lines=12 [BASIC] From 1d9bd8e99d6aab18abfbcdc290df93364381e742 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Sun, 22 May 2022 00:18:23 -0400 Subject: [PATCH 28/57] Switch to inclusive terminology Signed-off-by: Alec Delaney --- .pylintrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pylintrc b/.pylintrc index f006a4a..f772971 100644 --- a/.pylintrc +++ b/.pylintrc @@ -9,11 +9,11 @@ # run arbitrary code extension-pkg-whitelist= -# Add files or directories to the blacklist. They should be base names, not +# Add files or directories to the ignore-list. They should be base names, not # paths. ignore=CVS -# Add files or directories matching the regex patterns to the blacklist. The +# Add files or directories matching the regex patterns to the ignore-list. The # regex matches against base names, not paths. ignore-patterns= From bc894e212a6bedebe492dc8d76305020c7e7f9bf Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Mon, 30 May 2022 14:25:04 -0400 Subject: [PATCH 29/57] Set language to "en" for documentation Signed-off-by: Alec Delaney --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 94337be..705716d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -62,7 +62,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. From b751b4e6eb5e8599254639aefaa3df42b8fc50be Mon Sep 17 00:00:00 2001 From: evaherrada Date: Tue, 7 Jun 2022 15:34:37 -0400 Subject: [PATCH 30/57] Added cp.org link to index.rst --- docs/index.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 0a96095..2005853 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -32,7 +32,8 @@ Table of Contents .. toctree:: :caption: Other Links - Download + Download from GitHub + Download Library Bundle CircuitPython Reference Documentation CircuitPython Support Forum Discord Chat From a5a81ec3dfb079fbd9f26d1d9707e2775f469986 Mon Sep 17 00:00:00 2001 From: evaherrada Date: Tue, 21 Jun 2022 17:00:37 -0400 Subject: [PATCH 31/57] Removed duplicate-code from library pylint disable Signed-off-by: evaherrada --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0a91a11..3343606 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: name: pylint (library code) types: [python] args: - - --disable=consider-using-f-string,duplicate-code + - --disable=consider-using-f-string exclude: "^(docs/|examples/|tests/|setup.py$)" - id: pylint name: pylint (example code) From 06c54e3ddef83e9224cd47ffdb403d6700a520b3 Mon Sep 17 00:00:00 2001 From: evaherrada Date: Fri, 22 Jul 2022 13:58:59 -0400 Subject: [PATCH 32/57] Changed .env to .venv in README.rst --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 05bf341..3f71556 100644 --- a/README.rst +++ b/README.rst @@ -49,8 +49,8 @@ To install in a virtual environment in your current project: .. code-block:: shell mkdir project-name && cd project-name - python3 -m venv .env - source .env/bin/activate + python3 -m venv .venv + source .venv/bin/activate pip3 install adafruit-circuitpython-max7219 Usage Example From e22d74f69aca55ba51ad710c65a275e4895995fa Mon Sep 17 00:00:00 2001 From: evaherrada Date: Tue, 2 Aug 2022 17:00:47 -0400 Subject: [PATCH 33/57] Added Black formatting badge --- README.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.rst b/README.rst index 3f71556..cc86400 100644 --- a/README.rst +++ b/README.rst @@ -14,6 +14,10 @@ Introduction :target: https://github.com/adafruit/Adafruit_CircuitPython_MAX7219/actions/ :alt: Build Status +.. image:: https://img.shields.io/badge/code%20style-black-000000.svg + :target: https://github.com/psf/black + :alt: Code Style: Black + CircuitPython driver for the MAX7219 LED matrix driver chip. See `here `_ for the equivalent MicroPython driver. From b904e5b2f8696f4e89b933f3f28e0228b6079b0d Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Mon, 8 Aug 2022 22:05:53 -0400 Subject: [PATCH 34/57] Switched to pyproject.toml --- .github/workflows/build.yml | 18 ++++++------ .github/workflows/release.yml | 17 ++++++----- optional_requirements.txt | 3 ++ pyproject.toml | 46 +++++++++++++++++++++++++++++ requirements.txt | 2 +- setup.py | 54 ----------------------------------- 6 files changed, 70 insertions(+), 70 deletions(-) create mode 100644 optional_requirements.txt create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 474520d..22f6582 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,6 +47,8 @@ jobs: pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit - name: Library version run: git describe --dirty --always --tags + - name: Setup problem matchers + uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1 - name: Pre-commit hooks run: | pre-commit run --all-files @@ -60,16 +62,16 @@ jobs: - name: Build docs working-directory: docs run: sphinx-build -E -W -b html . _build/html - - name: Check For setup.py + - name: Check For pyproject.toml id: need-pypi run: | - echo ::set-output name=setup-py::$( find . -wholename './setup.py' ) + echo ::set-output name=pyproject-toml::$( find . -wholename './pyproject.toml' ) - name: Build Python package - if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') + if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') run: | - pip install --upgrade setuptools wheel twine readme_renderer testresources - python setup.py sdist - python setup.py bdist_wheel --universal + pip install --upgrade build twine + for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do + sed -i -e "s/0.0.0-auto.0/1.2.3/" $file; + done; + python -m build twine check dist/* - - name: Setup problem matchers - uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a65e5de..d1b4f8d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,25 +61,28 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - name: Check For setup.py + - name: Check For pyproject.toml id: need-pypi run: | - echo ::set-output name=setup-py::$( find . -wholename './setup.py' ) + echo ::set-output name=pyproject-toml::$( find . -wholename './pyproject.toml' ) - name: Set up Python - if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') + if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') uses: actions/setup-python@v2 with: python-version: '3.x' - name: Install dependencies - if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') + if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install --upgrade build twine - name: Build and publish - if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') + if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') env: TWINE_USERNAME: ${{ secrets.pypi_username }} TWINE_PASSWORD: ${{ secrets.pypi_password }} run: | - python setup.py sdist + for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do + sed -i -e "s/0.0.0-auto.0/${{github.event.release.tag_name}}/" $file; + done; + python -m build twine upload dist/* diff --git a/optional_requirements.txt b/optional_requirements.txt new file mode 100644 index 0000000..d4e27c4 --- /dev/null +++ b/optional_requirements.txt @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries +# +# SPDX-License-Identifier: Unlicense diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8024d90 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,46 @@ +# SPDX-FileCopyrightText: 2022 Alec Delaney for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +[build-system] +requires = [ + "setuptools", + "wheel", +] + +[project] +name = "adafruit-circuitpython-max7219" +description = "CircuitPython library for MAX7219 LED matrix driver." +version = "0.0.0-auto.0" +readme = "README.rst" +authors = [ + {name = "Adafruit Industries", email = "circuitpython@adafruit.com"} +] +urls = {Homepage = "https://github.com/adafruit/Adafruit_CircuitPython_MAX7219"} +keywords = [ + "adafruit", + "max7219", + "LED", + "matrix", + "breakout", + "hardware", + "micropython", + "circuitpython", +] +license = {text = "MIT"} +classifiers = [ + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Embedded Systems", + "Topic :: System :: Hardware", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", +] +dynamic = ["dependencies", "optional-dependencies"] + +[tool.setuptools] +packages = ["adafruit_max7219"] + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.txt"]} +optional-dependencies = {optional = {file = ["optional_requirements.txt"]}} diff --git a/requirements.txt b/requirements.txt index 32df5a7..22f317d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries +# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries # # SPDX-License-Identifier: Unlicense diff --git a/setup.py b/setup.py deleted file mode 100644 index ef06dbc..0000000 --- a/setup.py +++ /dev/null @@ -1,54 +0,0 @@ -# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries -# -# SPDX-License-Identifier: MIT - -"""A setuptools based setup module. - -See: -https://packaging.python.org/en/latest/distributing.html -https://github.com/pypa/sampleproject -""" - -# Always prefer setuptools over distutils -from setuptools import setup, find_packages - -# To use a consistent encoding -from codecs import open -from os import path - -here = path.abspath(path.dirname(__file__)) - -# Get the long description from the README file -with open(path.join(here, "README.rst"), encoding="utf-8") as f: - long_description = f.read() - -setup( - name="adafruit-circuitpython-max7219", - use_scm_version=True, - setup_requires=["setuptools_scm"], - description="CircuitPython library for MAX7219 LED matrix driver.", - long_description=long_description, - long_description_content_type="text/x-rst", - # The project's main homepage. - url="https://github.com/adafruit/Adafruit_CircuitPython_MAX7219", - # Author details - author="Adafruit Industries", - author_email="circuitpython@adafruit.com", - install_requires=["Adafruit-Blinka", "adafruit-circuitpython-busdevice"], - # Choose your license - license="MIT", - # See https://pypi.python.org/pypi?%3Aaction=list_classifiers - classifiers=[ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "Topic :: Software Development :: Libraries", - "Topic :: System :: Hardware", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3", - ], - # What does your project relate to? - keywords="adafruit max7219 LED matrix breakout hardware micropython circuitpython", - # You can just specify the packages manually here if your project is - # simple. Or you can use find_packages(). - packages=["adafruit_max7219"], -) From 027f38ea751d398ab15ca461d7ca566e041c75bb Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Tue, 9 Aug 2022 12:03:54 -0400 Subject: [PATCH 35/57] Add setuptools-scm to build system requirements Signed-off-by: Alec Delaney --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 8024d90..9dd90db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,7 @@ requires = [ "setuptools", "wheel", + "setuptools-scm", ] [project] From 710f8a51927adebfdb7cdc62c9f297b4d667741c Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Tue, 16 Aug 2022 18:09:13 -0400 Subject: [PATCH 36/57] Update version string --- adafruit_max7219/bcddigits.py | 2 +- adafruit_max7219/matrices.py | 2 +- adafruit_max7219/max7219.py | 2 +- pyproject.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adafruit_max7219/bcddigits.py b/adafruit_max7219/bcddigits.py index 81ec5ff..28929ea 100644 --- a/adafruit_max7219/bcddigits.py +++ b/adafruit_max7219/bcddigits.py @@ -17,7 +17,7 @@ except ImportError: pass -__version__ = "0.0.0-auto.0" +__version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MAX7219.git" _DECODEMODE = const(9) diff --git a/adafruit_max7219/matrices.py b/adafruit_max7219/matrices.py index faccbd2..1c969dc 100644 --- a/adafruit_max7219/matrices.py +++ b/adafruit_max7219/matrices.py @@ -19,7 +19,7 @@ except ImportError: pass -__version__ = "0.0.0-auto.0" +__version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MAX7219.git" _DECODEMODE = const(9) diff --git a/adafruit_max7219/max7219.py b/adafruit_max7219/max7219.py index c1960c2..2aeac32 100644 --- a/adafruit_max7219/max7219.py +++ b/adafruit_max7219/max7219.py @@ -52,7 +52,7 @@ except ImportError: pass -__version__ = "0.0.0-auto.0" +__version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MAX7219.git" # register definitions diff --git a/pyproject.toml b/pyproject.toml index 9dd90db..23f6ed3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ requires = [ [project] name = "adafruit-circuitpython-max7219" description = "CircuitPython library for MAX7219 LED matrix driver." -version = "0.0.0-auto.0" +version = "0.0.0+auto.0" readme = "README.rst" authors = [ {name = "Adafruit Industries", email = "circuitpython@adafruit.com"} From 71bad43fc34448de83370463c09c04ae79addd37 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Tue, 16 Aug 2022 21:09:13 -0400 Subject: [PATCH 37/57] Fix version strings in workflow files --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22f6582..cb2f60e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,7 +71,7 @@ jobs: run: | pip install --upgrade build twine for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do - sed -i -e "s/0.0.0-auto.0/1.2.3/" $file; + sed -i -e "s/0.0.0+auto.0/1.2.3/" $file; done; python -m build twine check dist/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1b4f8d..f3a0325 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -82,7 +82,7 @@ jobs: TWINE_PASSWORD: ${{ secrets.pypi_password }} run: | for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do - sed -i -e "s/0.0.0-auto.0/${{github.event.release.tag_name}}/" $file; + sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" $file; done; python -m build twine upload dist/* From ff13e5e8a18a704b5be931123e05940fcf026d90 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Mon, 22 Aug 2022 21:36:30 -0400 Subject: [PATCH 38/57] Keep copyright up to date in documentation --- docs/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 705716d..89914f2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -6,6 +6,7 @@ import os import sys +import datetime sys.path.insert(0, os.path.abspath("..")) @@ -45,6 +46,7 @@ # General information about the project. project = "Adafruit MAX7219 Library" +current_year = str(datetime.datetime.now().year) copyright = "2017, Adafruit CiruitPython and Bundle contributors" author = "Michael McWethy" From a35f8053b0e398fcced8f609407a5a556e27925a Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Mon, 22 Aug 2022 21:46:53 -0400 Subject: [PATCH 39/57] Fix copyright string --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 89914f2..349738c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -47,7 +47,7 @@ # General information about the project. project = "Adafruit MAX7219 Library" current_year = str(datetime.datetime.now().year) -copyright = "2017, Adafruit CiruitPython and Bundle contributors" +copyright = current_year + " Adafruit CiruitPython and Bundle contributors" author = "Michael McWethy" # The version info for the project you're documenting, acts as replacement for From cb824778fdd12f21bfed31c2d25b1e53ea8d3f86 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Tue, 23 Aug 2022 17:26:20 -0400 Subject: [PATCH 40/57] Use year duration range for copyright attribution --- docs/conf.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 349738c..bfb18ed 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -46,8 +46,14 @@ # General information about the project. project = "Adafruit MAX7219 Library" +creation_year = "2017" current_year = str(datetime.datetime.now().year) -copyright = current_year + " Adafruit CiruitPython and Bundle contributors" +year_duration = ( + current_year + if current_year == creation_year + else creation_year + " - " + current_year +) +copyright = year_duration + " Adafruit CiruitPython and Bundle contributors" author = "Michael McWethy" # The version info for the project you're documenting, acts as replacement for From 40e8502d6e5bf199bbae9e83934869e4f68d1063 Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Fri, 4 Nov 2022 00:02:49 -0400 Subject: [PATCH 41/57] Switching to composite actions --- .github/workflows/build.yml | 67 +---------------------- .github/workflows/release.yml | 88 ------------------------------ .github/workflows/release_gh.yml | 14 +++++ .github/workflows/release_pypi.yml | 14 +++++ 4 files changed, 30 insertions(+), 153 deletions(-) delete mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/release_gh.yml create mode 100644 .github/workflows/release_pypi.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb2f60e..041a337 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,68 +10,5 @@ jobs: test: runs-on: ubuntu-latest steps: - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - name: Translate Repo Name For Build Tools filename_prefix - id: repo-name - run: | - echo ::set-output name=repo-name::$( - echo ${{ github.repository }} | - awk -F '\/' '{ print tolower($2) }' | - tr '_' '-' - ) - - name: Set up Python 3.x - uses: actions/setup-python@v2 - with: - python-version: "3.x" - - name: Versions - run: | - python3 --version - - name: Checkout Current Repo - uses: actions/checkout@v1 - with: - submodules: true - - name: Checkout tools repo - uses: actions/checkout@v2 - with: - repository: adafruit/actions-ci-circuitpython-libs - path: actions-ci - - name: Install dependencies - # (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.) - run: | - source actions-ci/install.sh - - name: Pip install Sphinx, pre-commit - run: | - pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit - - name: Library version - run: git describe --dirty --always --tags - - name: Setup problem matchers - uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1 - - name: Pre-commit hooks - run: | - pre-commit run --all-files - - name: Build assets - run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . - - name: Archive bundles - uses: actions/upload-artifact@v2 - with: - name: bundles - path: ${{ github.workspace }}/bundles/ - - name: Build docs - working-directory: docs - run: sphinx-build -E -W -b html . _build/html - - name: Check For pyproject.toml - id: need-pypi - run: | - echo ::set-output name=pyproject-toml::$( find . -wholename './pyproject.toml' ) - - name: Build Python package - if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') - run: | - pip install --upgrade build twine - for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do - sed -i -e "s/0.0.0+auto.0/1.2.3/" $file; - done; - python -m build - twine check dist/* + - name: Run Build CI workflow + uses: adafruit/workflows-circuitpython-libs/build@main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index f3a0325..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,88 +0,0 @@ -# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries -# -# SPDX-License-Identifier: MIT - -name: Release Actions - -on: - release: - types: [published] - -jobs: - upload-release-assets: - runs-on: ubuntu-latest - steps: - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - name: Translate Repo Name For Build Tools filename_prefix - id: repo-name - run: | - echo ::set-output name=repo-name::$( - echo ${{ github.repository }} | - awk -F '\/' '{ print tolower($2) }' | - tr '_' '-' - ) - - name: Set up Python 3.x - uses: actions/setup-python@v2 - with: - python-version: "3.x" - - name: Versions - run: | - python3 --version - - name: Checkout Current Repo - uses: actions/checkout@v1 - with: - submodules: true - - name: Checkout tools repo - uses: actions/checkout@v2 - with: - repository: adafruit/actions-ci-circuitpython-libs - path: actions-ci - - name: Install deps - run: | - source actions-ci/install.sh - - name: Build assets - run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . - - name: Upload Release Assets - # the 'official' actions version does not yet support dynamically - # supplying asset names to upload. @csexton's version chosen based on - # discussion in the issue below, as its the simplest to implement and - # allows for selecting files with a pattern. - # https://github.com/actions/upload-release-asset/issues/4 - #uses: actions/upload-release-asset@v1.0.1 - uses: csexton/release-asset-action@master - with: - pattern: "bundles/*" - github-token: ${{ secrets.GITHUB_TOKEN }} - - upload-pypi: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Check For pyproject.toml - id: need-pypi - run: | - echo ::set-output name=pyproject-toml::$( find . -wholename './pyproject.toml' ) - - name: Set up Python - if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install dependencies - if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') - run: | - python -m pip install --upgrade pip - pip install --upgrade build twine - - name: Build and publish - if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') - env: - TWINE_USERNAME: ${{ secrets.pypi_username }} - TWINE_PASSWORD: ${{ secrets.pypi_password }} - run: | - for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do - sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" $file; - done; - python -m build - twine upload dist/* diff --git a/.github/workflows/release_gh.yml b/.github/workflows/release_gh.yml new file mode 100644 index 0000000..041a337 --- /dev/null +++ b/.github/workflows/release_gh.yml @@ -0,0 +1,14 @@ +# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +name: Build CI + +on: [pull_request, push] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Run Build CI workflow + uses: adafruit/workflows-circuitpython-libs/build@main diff --git a/.github/workflows/release_pypi.yml b/.github/workflows/release_pypi.yml new file mode 100644 index 0000000..041a337 --- /dev/null +++ b/.github/workflows/release_pypi.yml @@ -0,0 +1,14 @@ +# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +name: Build CI + +on: [pull_request, push] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Run Build CI workflow + uses: adafruit/workflows-circuitpython-libs/build@main From e5b26ffa30cd6e7b119cfd32773b665072f16838 Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Fri, 4 Nov 2022 00:46:59 -0400 Subject: [PATCH 42/57] Updated pylint version to 2.13.0 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3343606..4c43710 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/pycqa/pylint - rev: v2.11.1 + rev: v2.13.0 hooks: - id: pylint name: pylint (library code) From bf4ff7a4094644a0a22075b9fab4f00d21602fa3 Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Fri, 4 Nov 2022 08:15:19 -0400 Subject: [PATCH 43/57] Update pylint to 2.15.5 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4c43710..0e5fccc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/pycqa/pylint - rev: v2.13.0 + rev: v2.15.5 hooks: - id: pylint name: pylint (library code) From 10aac58068f3b9269f30c8177338e2aac1b94fd5 Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Fri, 4 Nov 2022 09:12:44 -0400 Subject: [PATCH 44/57] Fix release CI files --- .github/workflows/release_gh.yml | 14 +++++++++----- .github/workflows/release_pypi.yml | 15 ++++++++++----- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release_gh.yml b/.github/workflows/release_gh.yml index 041a337..b8aa8d6 100644 --- a/.github/workflows/release_gh.yml +++ b/.github/workflows/release_gh.yml @@ -2,13 +2,17 @@ # # SPDX-License-Identifier: MIT -name: Build CI +name: GitHub Release Actions -on: [pull_request, push] +on: + release: + types: [published] jobs: - test: + upload-release-assets: runs-on: ubuntu-latest steps: - - name: Run Build CI workflow - uses: adafruit/workflows-circuitpython-libs/build@main + - name: Run GitHub Release CI workflow + uses: adafruit/workflows-circuitpython-libs/release-gh@main + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release_pypi.yml b/.github/workflows/release_pypi.yml index 041a337..65775b7 100644 --- a/.github/workflows/release_pypi.yml +++ b/.github/workflows/release_pypi.yml @@ -2,13 +2,18 @@ # # SPDX-License-Identifier: MIT -name: Build CI +name: PyPI Release Actions -on: [pull_request, push] +on: + release: + types: [published] jobs: - test: + upload-release-assets: runs-on: ubuntu-latest steps: - - name: Run Build CI workflow - uses: adafruit/workflows-circuitpython-libs/build@main + - name: Run PyPI Release CI workflow + uses: adafruit/workflows-circuitpython-libs/release-pypi@main + with: + pypi-username: ${{ secrets.pypi_username }} + pypi-password: ${{ secrets.pypi_password }} From 253c0db061b7c64cc9d880da9e9247cb256d3998 Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Fri, 4 Nov 2022 18:34:32 -0400 Subject: [PATCH 45/57] Update .pylintrc for v2.15.5 --- .pylintrc | 45 ++++----------------------------------------- 1 file changed, 4 insertions(+), 41 deletions(-) diff --git a/.pylintrc b/.pylintrc index f772971..40208c3 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries +# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries # # SPDX-License-Identifier: Unlicense @@ -26,7 +26,7 @@ jobs=1 # List of plugins (as comma separated values of python modules names) to load, # usually to register additional checkers. -load-plugins= +load-plugins=pylint.extensions.no_self_use # Pickle collected data for later comparisons. persistent=yes @@ -54,8 +54,8 @@ confidence= # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" -# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call -disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation,unspecified-encoding +# disable=import-error,raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,deprecated-str-translate-call +disable=raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,import-error,pointless-string-statement,unspecified-encoding # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option @@ -225,12 +225,6 @@ max-line-length=100 # Maximum number of lines in a module max-module-lines=1000 -# List of optional constructs for which whitespace checking is disabled. `dict- -# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. -# `trailing-comma` allows a space between comma and closing bracket: (a, ). -# `empty-line` allows space-only lines. -no-space-check=trailing-comma,dict-separator - # Allow the body of a class to be on the same line as the declaration if body # contains single statement. single-line-class-stmt=no @@ -257,38 +251,22 @@ min-similarity-lines=12 [BASIC] -# Naming hint for argument names -argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - # Regular expression matching correct argument names argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ -# Naming hint for attribute names -attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - # Regular expression matching correct attribute names attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ # Bad variable names which should always be refused, separated by a comma bad-names=foo,bar,baz,toto,tutu,tata -# Naming hint for class attribute names -class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ - # Regular expression matching correct class attribute names class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ -# Naming hint for class names -# class-name-hint=[A-Z_][a-zA-Z0-9]+$ -class-name-hint=[A-Z_][a-zA-Z0-9_]+$ - # Regular expression matching correct class names # class-rgx=[A-Z_][a-zA-Z0-9]+$ class-rgx=[A-Z_][a-zA-Z0-9_]+$ -# Naming hint for constant names -const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - # Regular expression matching correct constant names const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ @@ -296,9 +274,6 @@ const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ # ones are exempt. docstring-min-length=-1 -# Naming hint for function names -function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - # Regular expression matching correct function names function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ @@ -309,21 +284,12 @@ good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_ # Include a hint for the correct naming format with invalid-name include-naming-hint=no -# Naming hint for inline iteration names -inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ - # Regular expression matching correct inline iteration names inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ -# Naming hint for method names -method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - # Regular expression matching correct method names method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ -# Naming hint for module names -module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - # Regular expression matching correct module names module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ @@ -339,9 +305,6 @@ no-docstring-rgx=^_ # to this list to register other decorators that produce valid properties. property-classes=abc.abstractproperty -# Naming hint for variable names -variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - # Regular expression matching correct variable names variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ From cc51d9411accb0496f4bd4c6040b91ba228df8ff Mon Sep 17 00:00:00 2001 From: evaherrada Date: Wed, 9 Nov 2022 14:56:18 -0500 Subject: [PATCH 46/57] Fixed linting --- adafruit_max7219/max7219.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_max7219/max7219.py b/adafruit_max7219/max7219.py index 2aeac32..fbaa278 100644 --- a/adafruit_max7219/max7219.py +++ b/adafruit_max7219/max7219.py @@ -78,7 +78,7 @@ def __init__( width: int, height: int, spi: busio.SPI, - cs: digitalio.DigitalInOut, + cs: digitalio.DigitalInOut, # pylint: disable=invalid-name *, baudrate: int = 8000000, polarity: int = 0, From 7f86cf87096d99e3b5672455232c6b508f7a590c Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Thu, 1 Sep 2022 20:16:31 -0400 Subject: [PATCH 47/57] Add .venv to .gitignore Signed-off-by: Alec Delaney <89490472+tekktrik@users.noreply.github.com> --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 544ec4a..db3d538 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ _build # Virtual environment-specific files .env +.venv # MacOS-specific files *.DS_Store From 00b8e7b99c9b1d27b163e1acba6e276e9ece8559 Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Thu, 19 Jan 2023 23:39:55 -0500 Subject: [PATCH 48/57] Add upload url to release action Signed-off-by: Alec Delaney <89490472+tekktrik@users.noreply.github.com> --- .github/workflows/release_gh.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release_gh.yml b/.github/workflows/release_gh.yml index b8aa8d6..9acec60 100644 --- a/.github/workflows/release_gh.yml +++ b/.github/workflows/release_gh.yml @@ -16,3 +16,4 @@ jobs: uses: adafruit/workflows-circuitpython-libs/release-gh@main with: github-token: ${{ secrets.GITHUB_TOKEN }} + upload-url: ${{ github.event.release.upload_url }} From 7dde6ceca0072f675ef0c3948361d59178978b3b Mon Sep 17 00:00:00 2001 From: Tekktrik Date: Tue, 9 May 2023 20:26:25 -0400 Subject: [PATCH 49/57] Update pre-commit hooks Signed-off-by: Tekktrik --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0e5fccc..70ade69 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,21 +4,21 @@ repos: - repo: https://github.com/python/black - rev: 22.3.0 + rev: 23.3.0 hooks: - id: black - repo: https://github.com/fsfe/reuse-tool - rev: v0.14.0 + rev: v1.1.2 hooks: - id: reuse - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 + rev: v4.4.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/pycqa/pylint - rev: v2.15.5 + rev: v2.17.4 hooks: - id: pylint name: pylint (library code) From 5be7df232d1a302a87999a399b75d579de2a5149 Mon Sep 17 00:00:00 2001 From: Tekktrik Date: Wed, 10 May 2023 22:38:02 -0400 Subject: [PATCH 50/57] Run pre-commit --- adafruit_max7219/bcddigits.py | 1 - adafruit_max7219/max7219.py | 1 - 2 files changed, 2 deletions(-) diff --git a/adafruit_max7219/bcddigits.py b/adafruit_max7219/bcddigits.py index 28929ea..cb00441 100644 --- a/adafruit_max7219/bcddigits.py +++ b/adafruit_max7219/bcddigits.py @@ -41,7 +41,6 @@ def __init__(self, spi: busio.SPI, cs: digitalio.DigitalInOut, nDigits: int = 1) super().__init__(self._ndigits, 8, spi, cs) def init_display(self) -> None: - for cmd, data in ( (_SHUTDOWN, 0), (_DISPLAYTEST, 0), diff --git a/adafruit_max7219/max7219.py b/adafruit_max7219/max7219.py index fbaa278..cf505b9 100644 --- a/adafruit_max7219/max7219.py +++ b/adafruit_max7219/max7219.py @@ -84,7 +84,6 @@ def __init__( polarity: int = 0, phase: int = 0 ): - self._chip_select = cs self._chip_select.direction = digitalio.Direction.OUTPUT From 22fcf150dbba16f4646433a2b61e7a9f35f90227 Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Tue, 23 May 2023 22:41:21 -0400 Subject: [PATCH 51/57] Update .pylintrc, fix jQuery for docs --- .pylintrc | 2 +- docs/conf.py | 1 + docs/requirements.txt | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index 40208c3..f945e92 100644 --- a/.pylintrc +++ b/.pylintrc @@ -396,4 +396,4 @@ min-public-methods=1 # Exceptions that will emit a warning when being caught. Defaults to # "Exception" -overgeneral-exceptions=Exception +overgeneral-exceptions=builtins.Exception diff --git a/docs/conf.py b/docs/conf.py index bfb18ed..36c1746 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,6 +17,7 @@ # ones. extensions = [ "sphinx.ext.autodoc", + "sphinxcontrib.jquery", "sphinx.ext.intersphinx", "sphinx.ext.viewcode", ] diff --git a/docs/requirements.txt b/docs/requirements.txt index 88e6733..797aa04 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -3,3 +3,4 @@ # SPDX-License-Identifier: Unlicense sphinx>=4.0.0 +sphinxcontrib-jquery From afa4c53ac0fd4895f40515822040e8a16ea0cf33 Mon Sep 17 00:00:00 2001 From: Jeremy Mayeres Date: Sat, 22 Jul 2023 14:06:28 +0200 Subject: [PATCH 52/57] Add font customization Fixes #36 --- adafruit_max7219/matrices.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/adafruit_max7219/matrices.py b/adafruit_max7219/matrices.py index 1c969dc..6778873 100644 --- a/adafruit_max7219/matrices.py +++ b/adafruit_max7219/matrices.py @@ -52,7 +52,15 @@ def init_display(self) -> None: self.fill(0) self.show() - def text(self, strg: str, xpos: int, ypos: int, bit_value: int = 1) -> None: + def text( + self, + strg: str, + xpos: int, + ypos: int, + bit_value: int = 1, + *, + font_name: str = "font5x8.bin" + ) -> None: """ Draw text in the 8x8 matrix. @@ -60,8 +68,9 @@ def text(self, strg: str, xpos: int, ypos: int, bit_value: int = 1) -> None: :param int xpos: x position of LED in matrix :param int ypos: y position of LED in matrix :param int bit_value: > 1 sets the text, otherwise resets + :param str font_name: path to binary font file (default: "font5x8.bin") """ - self.framebuf.text(strg, xpos, ypos, bit_value) + self.framebuf.text(strg, xpos, ypos, bit_value, font_name=font_name) def clear_all(self) -> None: """ From 193593c7a8b5707f646987f93a3f6a04016459a8 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 4 Sep 2023 15:29:13 -0500 Subject: [PATCH 53/57] add note about font can only set once --- adafruit_max7219/matrices.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adafruit_max7219/matrices.py b/adafruit_max7219/matrices.py index 6778873..3294688 100644 --- a/adafruit_max7219/matrices.py +++ b/adafruit_max7219/matrices.py @@ -68,7 +68,9 @@ def text( :param int xpos: x position of LED in matrix :param int ypos: y position of LED in matrix :param int bit_value: > 1 sets the text, otherwise resets - :param str font_name: path to binary font file (default: "font5x8.bin") + :param str font_name: path to binary font file (default: "font5x8.bin"). + The font can only be set once, if you want a different font you must + re-initialize the matrix. """ self.framebuf.text(strg, xpos, ypos, bit_value, font_name=font_name) From 86cf4c5d596a34174f4a3a70ae0097c6f7540435 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 18 Sep 2023 16:24:10 -0500 Subject: [PATCH 54/57] "fix rtd theme " --- docs/conf.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 36c1746..ba6518e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -102,19 +102,10 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -on_rtd = os.environ.get("READTHEDOCS", None) == "True" - -if not on_rtd: # only import and set the theme if we're building docs locally - try: - import sphinx_rtd_theme - - html_theme = "sphinx_rtd_theme" - html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."] - except: - html_theme = "default" - html_theme_path = ["."] -else: - html_theme_path = ["."] +import sphinx_rtd_theme + +html_theme = "sphinx_rtd_theme" +html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."] # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, From 4b04702cee6d92395b4500ccdad7759e6ad3f9ee Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 16 Oct 2023 14:30:31 -0500 Subject: [PATCH 55/57] unpin sphinx and add sphinx-rtd-theme to docs reqs Signed-off-by: foamyguy --- docs/requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 797aa04..979f568 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,5 +2,6 @@ # # SPDX-License-Identifier: Unlicense -sphinx>=4.0.0 +sphinx sphinxcontrib-jquery +sphinx-rtd-theme From e20493f2a8400db3a39a2d2d767f679d092b3b7a Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 7 Oct 2024 09:24:05 -0500 Subject: [PATCH 56/57] remove deprecated get_html_theme_path() call Signed-off-by: foamyguy --- docs/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index ba6518e..a6fc869 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -105,7 +105,6 @@ import sphinx_rtd_theme html_theme = "sphinx_rtd_theme" -html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."] # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, From a3be7a306ab8147968e8c9d9a5cbfedfa458ee7b Mon Sep 17 00:00:00 2001 From: foamyguy Date: Tue, 14 Jan 2025 11:32:34 -0600 Subject: [PATCH 57/57] add sphinx configuration to rtd.yaml Signed-off-by: foamyguy --- .readthedocs.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 33c2a61..88bca9f 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -8,6 +8,9 @@ # Required version: 2 +sphinx: + configuration: docs/conf.py + build: os: ubuntu-20.04 tools: