xtacocorex / chip_io Goto Github PK
View Code? Open in Web Editor NEWA CHIP IO library for Python: IO+PWM+SPWM+ADC+Utilities
License: MIT License
A CHIP IO library for Python: IO+PWM+SPWM+ADC+Utilities
License: MIT License
Refer to: https://bbs.nextthing.co/t/solved-problem-with-gpio-access/5008/74?u=xtacocorex
Check to see if CHIP_IO can be accessed from IDLE.
More of a feature request than an issue.
Any way you can add aREST support for this? I am not the greatest at programming, but I feel it should be possible as its very close to a RPi.
I got SOFTPWM working fine, except it doesn't seem to be very precise if I can trust my oscilloscope: asking for 50hz I get something more like 45Hz, and can never set duty cycle down lower than ~5%
So I wanted to try HW PWM, and hooked things up on PWM0, but no response.
Using only PWM.start("PWM0", 5, 50), no error but no response.
So I thought maybe I need to activate PWM0 overlay.
I ran
>>> import CHIP_IO.OverlayManager as OM
>>> OM.load("PWM0")
and I am getting:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.linux-armv7l/egg/CHIP_IO/OverlayManager.py", line 180, in load
File "build/bdist.linux-armv7l/egg/CHIP_IO/OverlayManager.py", line 84, in _set_overlay_verify
File "/usr/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 1] Operation not permitted: '/sys/kernel/config/device-tree'
I'm running python with sudo
so not sure what else I need to do.
I installed the dtb as per the instructions.
Any ideas?
Thanks for help.
Run GPIO.setup("XIO-P0", GPIO.IN)
, get:
ValueError: Pull Up/Down setting not capable for XIO-P0. ()
The problem is at 2b23e2d#diff-6021bb287e36c7d509f9435891dba0beR190
I was really surprised by this because my code was working last night and then broke just now when I re-cloned and re-built this library. I'll see if I can get a fix in soon, but wanted to flag this ASAP.
Hello, as far as I know there are 4 ADC-s (X1, X2, Y1, Y2) for the touchscreen. Would it be possible for you to expose these via the CHIP-IO library?
Hello,
Once a python script using CHIP_IO has exited, when I try to run it again, even with using GPIO.cleanup()
before setting up the IO, I'm getting an error:
GPIO.setup(set, GPIO.OUT)
RuntimeError: Error setting up channel CSID2, maybe already exported? (gpio_export: could not write '134' to /sys/class/gpio/export (Device or resource busy))
Is there any workaround to be able to run my script again, without rebooting?
Thanks.
Look into why the i2c-1 code shows up as i2c-3 on the 4.4 CHIPs.
Update code accordingly.
The wording in the README for edge detection isn't totally clear, fix so that it is more obvious which Pins can use this functionality.
Let's abstract out the DEBUG functionality so that we can reuse functions in other classes besides PWM and potentially add logging.
sudo py.test
fails, and sudo python2 -m pytest
fails too:========================================================================== test session starts ==========================================================================
platform linux2 -- Python 2.7.9 -- py-1.4.25 -- pytest-2.6.3
collected 0 items / 5 errors
================================================================================ ERRORS =================================================================================
_______________________________________________________________ ERROR collecting test/test_gpio_input.py ________________________________________________________________
test/test_gpio_input.py:5: in <module>
import CHIP_IO.GPIO as GPIO
E ImportError: No module named GPIO
_______________________________________________________________ ERROR collecting test/test_gpio_output.py _______________________________________________________________
test/test_gpio_output.py:3: in <module>
import CHIP_IO.GPIO as GPIO
E ImportError: No module named GPIO
_______________________________________________________________ ERROR collecting test/test_gpio_setup.py ________________________________________________________________
test/test_gpio_setup.py:4: in <module>
import CHIP_IO.GPIO as GPIO
E ImportError: No module named GPIO
________________________________________________________________ ERROR collecting test/test_pwm_setup.py ________________________________________________________________
test/test_pwm_setup.py:5: in <module>
import CHIP_IO.PWM as PWM
E ImportError: No module named PWM
______________________________________________________________ ERROR collecting test/test_softpwm_setup.py ______________________________________________________________
test/test_softpwm_setup.py:4: in <module>
import CHIP_IO.SOFTPWM as PWM
E ImportError: No module named SOFTPWM
======================================================================== 5 error in 1.23 seconds ========================================================================
sudo python3 -m pytest
fails too... :(========================================================================== test session starts ==========================================================================
platform linux -- Python 3.4.2, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /home/chip/CHIP_IO, inifile:
collected 0 items / 6 errors
================================================================================ ERRORS =================================================================================
__________________________________________________________________ ERROR collecting test/lradc_test.py __________________________________________________________________
test/lradc_test.py:11: in <module>
ADC.setup(125)
CHIP_IO/LRADC.py:57: in setup
set_sample_rate(rate)
CHIP_IO/LRADC.py:116: in set_sample_rate
print("Setting Sample Rate to: {0}").format(rate)
E AttributeError: 'NoneType' object has no attribute 'format'
---------------------------------------------------------------------------- Captured stdout ----------------------------------------------------------------------------
ENABLING LRADC DEBUG OUTPUT
LRADC SETUP WITH SAMPLE RATE OF 125
Setting Sample Rate to: {0}
_______________________________________________________________ ERROR collecting test/test_gpio_input.py ________________________________________________________________
ImportError while importing test module '/home/chip/CHIP_IO/test/test_gpio_input.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_gpio_input.py:5: in <module>
import CHIP_IO.GPIO as GPIO
E ImportError: No module named 'CHIP_IO.GPIO'
_______________________________________________________________ ERROR collecting test/test_gpio_output.py _______________________________________________________________
ImportError while importing test module '/home/chip/CHIP_IO/test/test_gpio_output.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_gpio_output.py:3: in <module>
import CHIP_IO.GPIO as GPIO
E ImportError: No module named 'CHIP_IO.GPIO'
_______________________________________________________________ ERROR collecting test/test_gpio_setup.py ________________________________________________________________
ImportError while importing test module '/home/chip/CHIP_IO/test/test_gpio_setup.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_gpio_setup.py:4: in <module>
import CHIP_IO.GPIO as GPIO
E ImportError: No module named 'CHIP_IO.GPIO'
________________________________________________________________ ERROR collecting test/test_pwm_setup.py ________________________________________________________________
ImportError while importing test module '/home/chip/CHIP_IO/test/test_pwm_setup.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_pwm_setup.py:5: in <module>
import CHIP_IO.PWM as PWM
E ImportError: No module named 'CHIP_IO.PWM'
______________________________________________________________ ERROR collecting test/test_softpwm_setup.py ______________________________________________________________
ImportError while importing test module '/home/chip/CHIP_IO/test/test_softpwm_setup.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_softpwm_setup.py:4: in <module>
import CHIP_IO.SOFTPWM as PWM
E ImportError: No module named 'CHIP_IO.SOFTPWM'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 6 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================== 6 error in 1.89 seconds ========================================================================
Prepare for the future by adding a feature to enable a user to load/unload a DTB Overlay.
Example:
Load:
sudo mkdir /sys/kernel/config/device-tree/overlays/DIPexample
su -c 'cat irtempi2c.dtbo > /sys/kernel/config/device-tree/overlays/DIPexample/dtbo'
Unload:
sudo rmdir /sys/kernel/config/device-tree/overlays/DIPexample/
Is it possible to install via pip?
is this lib has GPIO.PUD_DOWN?
Thanks
With the proper kernel and DTB, the LRADC is enabled. Get this working. Probably implement purely in Python as register setting was causing segfaults in my test code.
just a question here:
I just realize there only seem to be one PWM pin, (PWM0)
Can other pins be used for HW PWM, or is that it?
'coz I was looking to control a few motors, but if there is only one pin that's not going to work! :-/
Per discussion here: https://bbs.nextthing.co/t/change-gpio-direction/13162
Perhaps it's a missing dependency upstream, but the make of dtc fails as version_gen.h is not provided in the dtc repo. A 'make version_gen.h' is required before the make of dtc itself. Thanx!
Thank you for this wonderful library; awesome contribution.
I'd like to control the GPIO pins of the CHIP from PureData (http://puredata.info/).
Any advice on this integration? #
Tons of people are porting Raspberry Pi code to the CHIP and have gotten hung up on the RPi.GPIO setmode function.
Make this a dummy function for the time being. It might be able to be used for #32 if GPIO is drastically different on the CHIP Pro.
If you set-up a pin via string name (I think there should be constants available as well, but that's just me), one gets the following error:
>>> import CHIP_IO.GPIO as GPIO
>>> GPIO.setup("GPIO0", GPIO.OUT)
ASSRT failed at source/event_gpio.c:248 (s == strlen(direction))
While "XIO-P0" works fine, "GPIO0" throws this c-error.
Does chip have internal pull up or down resistors that I can enable? I would prefer this over using a bread board. I have tried using
GPIO.setup("CSID3", GPIO.IN, pull_up_down=GPIO.PUD_UP)
I have also tried "XIO-P0".
I don't get any errors but the pin appears to be floating.
In pwm_start we malloc memory for pwm struct in pwm_start but don't free it.
https://github.com/xtacocorex/CHIP_IO/blob/master/source/c_pwm.c#L367
If you're not root (or probably not in the group that is allowed), and try to set up a pin, the following happens:
>>> import CHIP_IO.GPIO as GPIO
>>> GPIO.setup("GPIO0", GPIO.OUT)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Channel in use (already exported)
Even though I am just not allowed to and the channel is actually not exported.
I am using CHIP version 4.4.13-ntc-mlc #1 SMP Tue Dec 6 21:38:00 UTC 2016 armv7l GNU/Linux
when running
import CHIP_IO.OverlayManager as OM
OM.load("SPI2")
in the console I am getting
sun4i-spi 1c17000.spi: prop pinctrl-0 index 0 invalid phandle
sun4i-spi 1c17000.spi: chipselect 0 already in use
spi_master spi32766: spi_device register error /soc@01c00000/spi@01c17000/spi2@0
of_spi_notify: failed to create for '/soc@01c00000/spi@01c17000/spi2@0'
__of_changeset_entry_notify: notifier error @/soc@01c00000/spi@01c17000/spi2@0
Any ideas how to resolve it?
I'm relatively new to python, and I got chip working, but after reboot its not working anymore:
chip@chip ~/dev> sudo python3 test.py
[sudo] password for chip:
Error processing line 1 of /usr/local/lib/python3.4/dist-packages/easy-install.pth:
Traceback (most recent call last):
File "/usr/lib/python3.4/site.py", line 177, in addpackage
if not dircase in known_paths and os.path.exists(dir):
File "/usr/lib/python3.4/genericpath.py", line 19, in exists
os.stat(path)
TypeError: embedded NUL character
Remainder of file ignored
Traceback (most recent call last):
File "test.py", line 1, in <module>
import CHIP_IO.GPIO as GPIO
ImportError: No module named 'CHIP_IO'
I'm wondering why chip_io isn't available by a package manager?
Is there any possibility of supporting something like Adafruit's Adafruit_GPIO.SPI
module?
I'm looking to try their user space ILI9341 module to control a Seeedstudio TFT Touch Shield v2.0.
I'm new to the CHIP, and it seems there are SPI ports available but perhaps they require a custom kernel.
XIO Pins are unable to be used for edge detection and callback.
Running sudo py.test
on a fresh install results in 9 failures:
============================= test session starts ==============================
platform linux2 -- Python 2.7.9 -- py-1.4.25 -- pytest-2.6.3
collected 63 items
test/test_gpio_input.py ..
test/test_gpio_output.py ......
test/test_gpio_setup.py ..........
test/test_pwm_setup.py FFFF...........F.........
test/test_softpwm_setup.py ...............softpwm_start failedFsoftpwm_start failedFsoftpwm_start failedFsoftpwm_start failedF.
=================================== FAILURES ===================================
_________________________ TestPwmSetup.test_start_pwm __________________________
self = <test_pwm_setup.TestPwmSetup instance at 0xb668fb70>
def test_start_pwm(self):
PWM.start("PWM0", 0)
pwm_test = '/sys/class/pwm/pwmchip0/pwm0'
> assert os.path.exists(pwm_test)
E assert <function exists at 0xb6d80d30>('/sys/class/pwm/pwmchip0/pwm0')
E + where <function exists at 0xb6d80d30> = <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'>.exists
E + where <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'> = os.path
test/test_pwm_setup.py:15: AssertionError
________________ TestPwmSetup.test_start_pwm_with_polarity_one _________________
self = <test_pwm_setup.TestPwmSetup instance at 0xb67804b8>
def test_start_pwm_with_polarity_one(self):
PWM.start("PWM0", 0, 2000, 1)
pwm_test = '/sys/class/pwm/pwmchip0/pwm0'
> assert os.path.exists(pwm_test)
E assert <function exists at 0xb6d80d30>('/sys/class/pwm/pwmchip0/pwm0')
E + where <function exists at 0xb6d80d30> = <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'>.exists
E + where <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'> = os.path
test/test_pwm_setup.py:27: AssertionError
______________ TestPwmSetup.test_start_pwm_with_polarity_default _______________
self = <test_pwm_setup.TestPwmSetup instance at 0xb6780be8>
def test_start_pwm_with_polarity_default(self):
PWM.start("PWM0", 0, 2000, 0)
pwm_test = '/sys/class/pwm/pwmchip0/pwm0'
> assert os.path.exists(pwm_test)
E assert <function exists at 0xb6d80d30>('/sys/class/pwm/pwmchip0/pwm0')
E + where <function exists at 0xb6d80d30> = <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'>.exists
E + where <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'> = os.path
test/test_pwm_setup.py:41: AssertionError
________________ TestPwmSetup.test_start_pwm_with_polarity_zero ________________
self = <test_pwm_setup.TestPwmSetup instance at 0xb66bd698>
def test_start_pwm_with_polarity_zero(self):
PWM.start("PWM0", 0, 2000, 0)
pwm_test = '/sys/class/pwm/pwmchip0/pwm0'
> assert os.path.exists(pwm_test)
E assert <function exists at 0xb6d80d30>('/sys/class/pwm/pwmchip0/pwm0')
E + where <function exists at 0xb6d80d30> = <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'>.exists
E + where <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'> = os.path
test/test_pwm_setup.py:55: AssertionError
_____________________ TestPwmSetup.test_pwm_duty_modified ______________________
self = <test_pwm_setup.TestPwmSetup instance at 0xb66bdaf8>
def test_pwm_duty_modified(self):
PWM.start("PWM0", 0)
pwm_test = '/sys/class/pwm/pwmchip0/pwm0'
> assert os.path.exists(pwm_test)
E assert <function exists at 0xb6d80d30>('/sys/class/pwm/pwmchip0/pwm0')
E + where <function exists at 0xb6d80d30> = <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'>.exists
E + where <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'> = os.path
test/test_pwm_setup.py:115: AssertionError
_________ TestSoftpwmSetup.test_pwm_duty_cycle_invalid_value_negative __________
self = <test_softpwm_setup.TestSoftpwmSetup instance at 0xb66a4238>
def test_pwm_duty_cycle_invalid_value_negative(self):
> PWM.start("XIO-P7", 0)
E RuntimeError: Error starting softpwm on pin U14_20 (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)))
test/test_softpwm_setup.py:85: RuntimeError
__________ TestSoftpwmSetup.test_pwm_duty_cycle_invalid_value_string ___________
self = <test_softpwm_setup.TestSoftpwmSetup instance at 0xb66a48a0>
def test_pwm_duty_cycle_invalid_value_string(self):
> PWM.start("XIO-P7", 0)
E RuntimeError: Error starting softpwm on pin U14_20 (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)))
test/test_softpwm_setup.py:91: RuntimeError
__________ TestSoftpwmSetup.test_pwm_frequency_invalid_value_negative __________
self = <test_softpwm_setup.TestSoftpwmSetup instance at 0xb66b6080>
def test_pwm_frequency_invalid_value_negative(self):
> PWM.start("XIO-P7", 0)
E RuntimeError: Error starting softpwm on pin U14_20 (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E Error setting up softpwm on pin 1023, maybe already exported? (g)
test/test_softpwm_setup.py:97: RuntimeError
___________ TestSoftpwmSetup.test_pwm_frequency_invalid_value_string ___________
self = <test_softpwm_setup.TestSoftpwmSetup instance at 0xb66551e8>
def test_pwm_frequency_invalid_value_string(self):
> PWM.start("XIO-P7", 0)
E RuntimeError: Error starting softpwm on pin U14_20 (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E Error setting up softpwm on pin 1023, maybe already exported? (g)
test/test_softpwm_setup.py:103: RuntimeError
===================== 9 failed, 54 passed in 2.12 seconds ======================
Dear Sir
I am getting this error:
/usr/include/features.h:374:25: fatal error: sys/cdefs.h: No such file or directory
The NTC CHIP Pro is a smaller CHIP with the GR8 SOC that is designed for embedded applications.
The IO of the CHIP Pro is slightly different from the CHIP.
Need to come up with an elegant way to handle IO on the CHIP Pro while maintaining compatibility with the CHIP/PocketCHIP.
Currently it seems file is opened whenever GPIO value is set (eg from soft PWM). I think it would make more sense to open the file handle when pin is exported and close the file handle when pin is unexported.
https://github.com/xtacocorex/CHIP_IO/blob/master/source/event_gpio.c#L385
Based on a suggestion by @aninternetof in Issue #16, we should probably do this as it seems super helpful.
Edge Detection on the XIO is goofy as it double hits for both falling and rising regardless of user setting.
I introduced a weird corner case when using GPIO.cleanup() in implementing #43. In the scenario when you just import CHIP_IO.GPIO and immediately do a cleanup on all pins, thing's break.
Test Code:
import CHIP_IO.GPIO as GPIO
GPIO.cleanup()
If you actually export a pin from inside CHIP_IO and then do a GPIO.cleanup(), it's happy.
@fordsfords I think the issue is with the C code and the Python API. I know you know nothing about the Python API part, but could you look at: 8ecec67
(py_cleanup in py_gpio.c) and see if I'm doing that strcmp right?
My initial debugging had me put an if statement around the close(epfd) in event_cleanup() inside event_gpio.c. That didn't help the situation.
Implement a more throughout check of c_pwm's sysfs write calls.
Example of place where check could benefit: https://github.com/Flexshot/CHIP_IO/blob/master/source/c_pwm.c#L122
Example of a better check of the write function result:
https://github.com/xtacocorex/CHIP_IO/blob/master/source/event_gpio.c#L109
close the file handle before checking an ASSRT.
New to GitHub, so I apologize if this is the wrong place for this, but I was having issues compiling when getting to the below step:
sudo python3 setup.py instal
The issue was something about rpigpiomodule not being defined (forgot to copy it) in py_gpio.c. So I looked at the adafruit-beagalbone repository and saw how they defined it there (https://github.com/adafruit/adafruit-beaglebone-io-python/blob/master/source/py_gpio.c) and added it to my local copy of py_gpio.c at line 862 (Code I added is below). It now compiles without issues. When I figure out how to commit changes back to the repository I will. Everything works perfect now. Thanks for your hard work porting this!!
#if PY_MAJOR_VERSION > 2
static struct PyModuleDef rpigpiomodule = {
PyModuleDef_HEAD_INIT,
"GPIO", // name of module
moduledocstring, // module documentation, may be NULL
-1, // size of per-interpreter state of the module, or -1 if the module keeps state in global variables.
gpio_methods
};
#endif
i use 4.4 or 4.3 firmware:
I follow your sample will found error:
import CHIP_IO.SOFTPWM as SPWM
SPWM.start("XIO-P7", 50)
SPWM.set_duty_cycle("XIO-P7", 25.5)
Traceback (most recent call last):
File "", line 1, in
RuntimeError: You must start() the PWM channel first
I have CHIP v1.0 and firmware official build headless 4.4 (Python 2.7.9).
Simply toggling gpio works using this library, but soft pwm does nothing. I have measured both with multimeter and ostilloscope and detected no change in output. I did not get any error messages either.
import time
import CHIP_IO.SOFTPWM as PWM
PWM.start("XIO-P7", 50)
time.sleep(5)
PWM.stop("XIO-P7")
PWM.cleanup()
When trying to add callbacks on the R8 based GPIO Pins, the edge file is not in the directory for the exported GPIO.
Need to do memory mapped work similar to RPi.GPIO.
I'm unable to get the overlay manager to work.
When i type the following in the REPL:
>>> import CHIP_IO.OverlayManager as OM
>>> OM.enable_debug()
>>> OM.load("PWM0")
I get the following error:
LOAD OVERLAY: PWM0 @
VALID OVERLAY
CONFIG PATH: /sys/kernel/config/device-tree/overlays/chip-pwm
OVERLAY PATH: /lib/firmware/chip_io/chip-pwm0.dtbo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/CHIP_IO-0.2.2-py3.4-linux-armv7l.egg/CHIP_IO/OverlayManager.py", line 180, in load
errc = _set_overlay_verify(overlay.upper(), opath, cpath)
File "/usr/local/lib/python3.4/dist-packages/CHIP_IO-0.2.2-py3.4-linux-armv7l.egg/CHIP_IO/OverlayManager.py", line 84, in _set_overlay_verify
os.makedirs(config_path)
File "/usr/lib/python3.4/os.py", line 227, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/lib/python3.4/os.py", line 227, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/lib/python3.4/os.py", line 237, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/sys/kernel/config/device-tree'
Any feedback would be appreciated. Thanks.
In the underlying C code, there is the ability to cleanup a single pin. Expose this feature to the Python layer. This way, you don't need to blast all the pins away if you just want to clean up a single pin.
Add the ability to set the SoftPWM to mimic an RC Servo so we can specify an angle and force the servo to that position. Would need the following:
trying this stuff out...I tried the py.test, with these results:
test/test_gpio_input.py FF
test/test_gpio_output.py FFFF..
test/test_gpio_setup.py FFFFFFF..F
test/test_pwm_setup.py FFFF...........F.........
test/test_softpwm_setup.py F...Segmentation fault
I just confirmed issues with the HW PWM code.
@fordsfords, looks like your imporovements might have broken it. :(
Will commit my test code for the HW PWM. Need to be running 4.4 with a custom kernel enable CONFIG_OF_CONFIGFS.
As discussed in #6 , "GPIO0" is not an allowed pin name.
The allowable names are what are defined by NTC on their documentation or the header and pin number.
The PocketCHIP does have a breakout of some pins at the top and there are indeed pins labeled "GPIO1" to "GPIO6". So it would be cool if these alternate names would be allowed.
With the 4.4.13-ntc-mlc OS drop from NTC, i2c-1 is back in the main dtb in /boot.
Do we want to remove this capability from OverlayManager?
Add callback documentation to the README.
Use example I provided in this NTC BBS Thread: https://bbs.nextthing.co/t/event-button-on-gpio/13972
Merge in @streamnsight's 2 functions from his fork:
streamnsight@51a8663
(Yes, I was totally creeping on the CHIP_IO forks since I noticed the fork number increased)
Currently we do nothing with rtnval in pwm_start except reset it to 0. We should check to see if we got the expected result.
https://github.com/xtacocorex/CHIP_IO/blob/master/source/c_pwm.c#L395
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.