1
0
mirror of https://github.com/xtacocorex/CHIP_IO synced 2025-07-20 12:53:22 +00:00

Updating the readme to add Python3 installation process

This commit is contained in:
Robert Wolterman
2016-09-18 19:15:44 -05:00
committed by GitHub
parent fcd5afcdc8
commit a9902d1267

View File

@ -6,6 +6,8 @@ NOTE: Now requires the custom DTC to install the library
Manual:: Manual::
For Python2.7:
sudo apt-get update sudo apt-get update
sudo apt-get install git build-essential python-dev python-pip flex bison -y sudo apt-get install git build-essential python-dev python-pip flex bison -y
git clone https://github.com/atenart/dtc git clone https://github.com/atenart/dtc
@ -19,6 +21,21 @@ Manual::
cd .. cd ..
sudo rm -rf CHIP_IO sudo rm -rf CHIP_IO
For Python3:
sudo apt-get update
sudo apt-get install git build-essential python3-dev python3-pip flex bison -y
git clone https://github.com/atenart/dtc
cd dtc
make
sudo make install PREFIX=/usr
cd ..
git clone git://github.com/xtacocorex/CHIP_IO.git
cd CHIP_IO
sudo python3 setup.py install
cd ..
sudo rm -rf CHIP_IO
**Usage** **Usage**
Using the library is very similar to the excellent RPi.GPIO library used on the Raspberry Pi. Below are some examples. Using the library is very similar to the excellent RPi.GPIO library used on the Raspberry Pi. Below are some examples.
@ -205,11 +222,10 @@ Hardware PWM requires a DTB Overlay loaded on the CHIP to allow the kernel to kn
PWM.start("PWM0", 50) PWM.start("PWM0", 50)
PWM.set_duty_cycle("PWM0", 25.5) PWM.set_duty_cycle("PWM0", 25.5)
PWM.set_frequency("PWM0", 10) PWM.set_frequency("PWM0", 10)
# To stop PWM
PWM.stop("PWM0") PWM.stop("PWM0")
PWM.cleanup() PWM.cleanup()
#For specific polarity: this example sets polarity to 1 on start:
#set polarity to 1 on start:
PWM.start("PWM0", 50, 2000, 1) PWM.start("PWM0", 50, 2000, 1)
**SOFTPWM**:: **SOFTPWM**::
@ -221,11 +237,10 @@ Hardware PWM requires a DTB Overlay loaded on the CHIP to allow the kernel to kn
SPWM.start("XIO-P7", 50) SPWM.start("XIO-P7", 50)
SPWM.set_duty_cycle("XIO-P7", 25.5) SPWM.set_duty_cycle("XIO-P7", 25.5)
SPWM.set_frequency("XIO-P7", 10) SPWM.set_frequency("XIO-P7", 10)
# To Stop SPWM
SPWM.stop("XIO-P7") SPWM.stop("XIO-P7")
SPWM.cleanup() SPWM.cleanup()
#For specific polarity: this example sets polarity to 1 on start:
#set polarity to 1 on start:
SPWM.start("XIO-P7", 50, 2000, 1) SPWM.start("XIO-P7", 50, 2000, 1)
Use SOFTPWM at low speeds (hundreds of Hz) for the best results. Do not use for anything that needs high precision or reliability. Use SOFTPWM at low speeds (hundreds of Hz) for the best results. Do not use for anything that needs high precision or reliability.
@ -270,7 +285,7 @@ There is no verification that the Custom Overlay is setup properly, it's fire an
# To unload, just call unload() # To unload, just call unload()
OM.unload("CUST") OM.unload("CUST")
Note that this requires the 4.4 kernel with the CONFIG_OF_CONFIGFS option enabled in the kernel config. **OverlayManager requires a 4.4 kernel with the CONFIG_OF_CONFIGFS option enabled in the kernel config.**
**Running tests** **Running tests**