Skip to content

Commit

Permalink
Merge pull request #40 from tinue/development
Browse files Browse the repository at this point in the history
Release 2.3
  • Loading branch information
tinue authored Nov 24, 2019
2 parents 0408ebe + 5601e4d commit f540d1f
Show file tree
Hide file tree
Showing 14 changed files with 146 additions and 38 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: Upload Python Package
name: Upload Python Package to PyPi

on:
release:
types: [published]

jobs:
deploy:
deploy-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
ref: master
- name: Set up Python
uses: actions/setup-python@v1
with:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/pythonpublishprerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Upload Python Package to Test PyPi

on:
release:
types: [prereleased]

jobs:
deploy-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
ref: development
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
125 changes: 100 additions & 25 deletions README.md

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions __init__.py

This file was deleted.

1 change: 1 addition & 0 deletions apa102_pi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__all__ = ["colorschemes", "driver"]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""This module contains a few concrete colour cycles to play with"""

from driver import colorcycletemplate
from apa102_pi.driver import colorcycletemplate


class StrandTest(colorcycletemplate.ColorCycleTemplate):
Expand Down
File renamed without changes.
7 changes: 5 additions & 2 deletions driver/apa102.py → apa102_pi/driver/apa102.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ class APA102:
# Constants
MAX_BRIGHTNESS = 31 # Safeguard: Max. brightness that can be selected.
LED_START = 0b11100000 # Three "1" bits, followed by 5 brightness bits
BUS_SPEED_HZ = 8000000 # SPI bus speed; If the strip flickers, lower this value

def __init__(self, num_led, global_brightness=MAX_BRIGHTNESS,
order='rgb', mosi=10, sclk=11, max_speed_hz=8000000,
order='rgb', mosi=10, sclk=11, bus_speed_hz=BUS_SPEED_HZ,
ce=None):
"""Initializes the library.
Expand All @@ -90,7 +91,7 @@ def __init__(self, num_led, global_brightness=MAX_BRIGHTNESS,

# MOSI 10 and SCLK 11 is hardware SPI, which needs to be set-up differently
if mosi == 10 and sclk == 11:
self.spi = SPI.SpiDev(0, 0 if ce is None else ce, max_speed_hz) # Bus 0
self.spi = SPI.SpiDev(0, 0 if ce is None else ce, bus_speed_hz) # Bus 0
else:
self.spi = SPI.BitBang(GPIO.get_platform_gpio(), sclk, mosi, ss=ce)

Expand Down Expand Up @@ -129,6 +130,8 @@ def clock_end_frame(self):
of the driver could omit the "clockStartFrame" method if enough zeroes have
been sent as part of "clockEndFrame".
"""
# Send reset frame necessary for SK9822 type LEDs
self.spi.write([0] * 4)
# Round up num_led/2 bits (or num_led/16 bytes)
for _ in range((self.num_led + 15) // 16):
self.spi.write([0x00])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""The module contains templates for colour cycles"""
import time
from driver import apa102
from apa102_pi.driver import apa102


class ColorCycleTemplate:
Expand Down
2 changes: 1 addition & 1 deletion runcolorcycle.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""Sample script to run a few colour tests on the strip."""
from colorschemes import colorschemes
from apa102_pi.colorschemes import colorschemes

NUM_LED = 430

Expand Down
2 changes: 1 addition & 1 deletion runcolorcycle_blinkt.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""Sample script to run a few colour tests on a Pimoroni Blinkt!."""
from colorschemes import colorschemes
from apa102_pi.colorschemes import colorschemes

NUM_LED = 8
MOSI = 23 # Hardware SPI uses BCM 10 & 11. Change these values for bit bang mode
Expand Down
2 changes: 1 addition & 1 deletion sample.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""Ultra simple sample on how to use the library"""
from driver import apa102
from apa102_pi.driver import apa102
import time

# Initialize the library and the strip
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="apa102-pi",
version="2.2.0",
version="2.3.0",
author="Martin Erzberger",
author_email="martin@erzberger.ch",
description="Driver for APA102 LEDs on a Raspberry Pi",
Expand All @@ -14,6 +14,7 @@
url="https://github.com/tinue/apa102-pi",
python_requires='>3',
packages=setuptools.find_packages(),
license='GPLv2',
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
Expand All @@ -24,5 +25,5 @@
"Topic :: Software Development :: Libraries :: Python Modules",
],
install_requires=["Adafruit-GPIO"],
platforms=["Raspbian Stretch", "Raspberry Pi"]
platforms=["Raspbian Buster", "Raspberry Pi"]
)

0 comments on commit f540d1f

Please sign in to comment.