summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-pwmled.spec337
-rw-r--r--sources1
3 files changed, 339 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..f4c220a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/pwmled-1.6.10.tar.gz
diff --git a/python-pwmled.spec b/python-pwmled.spec
new file mode 100644
index 0000000..715ef4d
--- /dev/null
+++ b/python-pwmled.spec
@@ -0,0 +1,337 @@
+%global _empty_manifest_terminate_build 0
+Name: python-pwmled
+Version: 1.6.10
+Release: 1
+Summary: Control LEDs connected to a micro controller using pwm.
+License: MIT
+URL: https://github.com/soldag/python-pwmled
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/35/bd/a658cfd6a4336cadb7b8152be7086b6b79d82142db37dc017dc785efc2dd/pwmled-1.6.10.tar.gz
+BuildArch: noarch
+
+Requires: python3-adafruit-blinka
+Requires: python3-adafruit-circuitpython-pca9685
+Requires: python3-pigpio
+Requires: python3-singleton
+
+%description
+# python-pwmled [![PyPI version](https://badge.fury.io/py/pwmled.svg)](https://badge.fury.io/py/pwmled)
+
+`python-pwmled` controls LEDs connected to a micro controller using pulse-width modulation. It supports one-color, RGB and RGBW leds driven by GPIOs of an Raspberry Pi or a PCA9685 controller.
+
+# Installation
+`python-pwmled` requires Python 3. It can be installed using pip:
+```bash
+pip install pwmled
+```
+
+When directly controlling the GPIOs of a Raspberry Pi using the `GpioDriver`(see [below](#configuration)), the [pigpio C library](https://github.com/joan2937/pigpio) is required. It can be installed with the following commands:
+```bash
+wget abyz.co.uk/rpi/pigpio/pigpio.zip
+unzip pigpio.zip
+cd PIGPIO
+make
+sudo make install
+```
+Besides the library, the `pigpiod` utility is installed, which starts `pigpio` as daemon. The daemon must be running when using the `GpioDriver`.
+```bash
+sudo pigpiod
+```
+
+# Usage
+### Configuration
+`python-pwmled` supports several possibilities for connecting LEDs to your micro controller:
+- GPIO: LEDs can be connected directly to the GPIOs of a Raspberry Pi.
+- PCA9885: A [PCA9685](https://cdn-shop.adafruit.com/datasheets/PCA9685.pdf) can be used as I2C-bus PWM controller.
+
+```python
+from pwmled.driver.gpio import GpioDriver
+from pwmled.driver.pca9685 import Pca9685Driver
+
+# GPIO driver, which controls pins 17, 22, 23
+driver = GpioDriver([17, 22, 23])
+driver = GpioDriver([17, 22, 23], freq=200)
+# To control the pigpio on a other machine use the host and port parameter
+driver = GpioDriver([17, 22, 23], host='other.host', port=8889)
+
+# PCA9685 driver which controls pins 1, 2, 3
+driver = Pca9685Driver([1, 2, 3])
+driver = Pca9685Driver([1, 2, 3], freq=200, address=0x40)
+```
+
+### Control
+Each LED needs a separated driver, which controls the corresponding pins. The number and order of pins depends on the led type:
+- One-color: 1 pin
+- RGB: 3 pins (`[R, G, B]`)
+- RGBW: 4 pins (`[R, G, B, W]`)
+
+The supported operations are shown in the following example:
+
+```python
+from pwmled import Color
+from pwmled.led import SimpleLed
+from pwmled.led.rgb import RgbLed
+from pwmled.led.rgbw import RgbwLed
+from pwmled.driver.gpio import GpioDriver
+
+# One-color led
+driver = GpioDriver([C])
+led = SimpleLed(driver)
+led.on()
+led.brightness = 0.5
+led.transition(5, brightness=0)
+led.off()
+
+# RGB led
+driver = GpioDriver([R, G, B])
+led = RgbLed(driver)
+led.on()
+led.color = Color(255, 0, 0)
+led.set(color=Color(0, 255, 0), brightness=0.5) # set two properties simultaneously
+led.transition(5, color=Color(0, 0, 255), brightness=1)
+led.off()
+
+# RGBW led
+driver = GpioDriver([R, G, B, W])
+led = RgbwLed(driver)
+# RgbwLed has same interface as RgbLed
+```
+
+# Contributions
+Pull-requests are welcome, especially for adding new drivers or led types.
+
+# License
+This library is provided under [MIT license](https://raw.githubusercontent.com/soldag/python-pwmled/master/LICENSE.md).
+
+
+%package -n python3-pwmled
+Summary: Control LEDs connected to a micro controller using pwm.
+Provides: python-pwmled
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-pwmled
+# python-pwmled [![PyPI version](https://badge.fury.io/py/pwmled.svg)](https://badge.fury.io/py/pwmled)
+
+`python-pwmled` controls LEDs connected to a micro controller using pulse-width modulation. It supports one-color, RGB and RGBW leds driven by GPIOs of an Raspberry Pi or a PCA9685 controller.
+
+# Installation
+`python-pwmled` requires Python 3. It can be installed using pip:
+```bash
+pip install pwmled
+```
+
+When directly controlling the GPIOs of a Raspberry Pi using the `GpioDriver`(see [below](#configuration)), the [pigpio C library](https://github.com/joan2937/pigpio) is required. It can be installed with the following commands:
+```bash
+wget abyz.co.uk/rpi/pigpio/pigpio.zip
+unzip pigpio.zip
+cd PIGPIO
+make
+sudo make install
+```
+Besides the library, the `pigpiod` utility is installed, which starts `pigpio` as daemon. The daemon must be running when using the `GpioDriver`.
+```bash
+sudo pigpiod
+```
+
+# Usage
+### Configuration
+`python-pwmled` supports several possibilities for connecting LEDs to your micro controller:
+- GPIO: LEDs can be connected directly to the GPIOs of a Raspberry Pi.
+- PCA9885: A [PCA9685](https://cdn-shop.adafruit.com/datasheets/PCA9685.pdf) can be used as I2C-bus PWM controller.
+
+```python
+from pwmled.driver.gpio import GpioDriver
+from pwmled.driver.pca9685 import Pca9685Driver
+
+# GPIO driver, which controls pins 17, 22, 23
+driver = GpioDriver([17, 22, 23])
+driver = GpioDriver([17, 22, 23], freq=200)
+# To control the pigpio on a other machine use the host and port parameter
+driver = GpioDriver([17, 22, 23], host='other.host', port=8889)
+
+# PCA9685 driver which controls pins 1, 2, 3
+driver = Pca9685Driver([1, 2, 3])
+driver = Pca9685Driver([1, 2, 3], freq=200, address=0x40)
+```
+
+### Control
+Each LED needs a separated driver, which controls the corresponding pins. The number and order of pins depends on the led type:
+- One-color: 1 pin
+- RGB: 3 pins (`[R, G, B]`)
+- RGBW: 4 pins (`[R, G, B, W]`)
+
+The supported operations are shown in the following example:
+
+```python
+from pwmled import Color
+from pwmled.led import SimpleLed
+from pwmled.led.rgb import RgbLed
+from pwmled.led.rgbw import RgbwLed
+from pwmled.driver.gpio import GpioDriver
+
+# One-color led
+driver = GpioDriver([C])
+led = SimpleLed(driver)
+led.on()
+led.brightness = 0.5
+led.transition(5, brightness=0)
+led.off()
+
+# RGB led
+driver = GpioDriver([R, G, B])
+led = RgbLed(driver)
+led.on()
+led.color = Color(255, 0, 0)
+led.set(color=Color(0, 255, 0), brightness=0.5) # set two properties simultaneously
+led.transition(5, color=Color(0, 0, 255), brightness=1)
+led.off()
+
+# RGBW led
+driver = GpioDriver([R, G, B, W])
+led = RgbwLed(driver)
+# RgbwLed has same interface as RgbLed
+```
+
+# Contributions
+Pull-requests are welcome, especially for adding new drivers or led types.
+
+# License
+This library is provided under [MIT license](https://raw.githubusercontent.com/soldag/python-pwmled/master/LICENSE.md).
+
+
+%package help
+Summary: Development documents and examples for pwmled
+Provides: python3-pwmled-doc
+%description help
+# python-pwmled [![PyPI version](https://badge.fury.io/py/pwmled.svg)](https://badge.fury.io/py/pwmled)
+
+`python-pwmled` controls LEDs connected to a micro controller using pulse-width modulation. It supports one-color, RGB and RGBW leds driven by GPIOs of an Raspberry Pi or a PCA9685 controller.
+
+# Installation
+`python-pwmled` requires Python 3. It can be installed using pip:
+```bash
+pip install pwmled
+```
+
+When directly controlling the GPIOs of a Raspberry Pi using the `GpioDriver`(see [below](#configuration)), the [pigpio C library](https://github.com/joan2937/pigpio) is required. It can be installed with the following commands:
+```bash
+wget abyz.co.uk/rpi/pigpio/pigpio.zip
+unzip pigpio.zip
+cd PIGPIO
+make
+sudo make install
+```
+Besides the library, the `pigpiod` utility is installed, which starts `pigpio` as daemon. The daemon must be running when using the `GpioDriver`.
+```bash
+sudo pigpiod
+```
+
+# Usage
+### Configuration
+`python-pwmled` supports several possibilities for connecting LEDs to your micro controller:
+- GPIO: LEDs can be connected directly to the GPIOs of a Raspberry Pi.
+- PCA9885: A [PCA9685](https://cdn-shop.adafruit.com/datasheets/PCA9685.pdf) can be used as I2C-bus PWM controller.
+
+```python
+from pwmled.driver.gpio import GpioDriver
+from pwmled.driver.pca9685 import Pca9685Driver
+
+# GPIO driver, which controls pins 17, 22, 23
+driver = GpioDriver([17, 22, 23])
+driver = GpioDriver([17, 22, 23], freq=200)
+# To control the pigpio on a other machine use the host and port parameter
+driver = GpioDriver([17, 22, 23], host='other.host', port=8889)
+
+# PCA9685 driver which controls pins 1, 2, 3
+driver = Pca9685Driver([1, 2, 3])
+driver = Pca9685Driver([1, 2, 3], freq=200, address=0x40)
+```
+
+### Control
+Each LED needs a separated driver, which controls the corresponding pins. The number and order of pins depends on the led type:
+- One-color: 1 pin
+- RGB: 3 pins (`[R, G, B]`)
+- RGBW: 4 pins (`[R, G, B, W]`)
+
+The supported operations are shown in the following example:
+
+```python
+from pwmled import Color
+from pwmled.led import SimpleLed
+from pwmled.led.rgb import RgbLed
+from pwmled.led.rgbw import RgbwLed
+from pwmled.driver.gpio import GpioDriver
+
+# One-color led
+driver = GpioDriver([C])
+led = SimpleLed(driver)
+led.on()
+led.brightness = 0.5
+led.transition(5, brightness=0)
+led.off()
+
+# RGB led
+driver = GpioDriver([R, G, B])
+led = RgbLed(driver)
+led.on()
+led.color = Color(255, 0, 0)
+led.set(color=Color(0, 255, 0), brightness=0.5) # set two properties simultaneously
+led.transition(5, color=Color(0, 0, 255), brightness=1)
+led.off()
+
+# RGBW led
+driver = GpioDriver([R, G, B, W])
+led = RgbwLed(driver)
+# RgbwLed has same interface as RgbLed
+```
+
+# Contributions
+Pull-requests are welcome, especially for adding new drivers or led types.
+
+# License
+This library is provided under [MIT license](https://raw.githubusercontent.com/soldag/python-pwmled/master/LICENSE.md).
+
+
+%prep
+%autosetup -n pwmled-1.6.10
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-pwmled -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 1.6.10-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..4ee84ee
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+0df3ac880c47968cb6dae4eff6290a41 pwmled-1.6.10.tar.gz