Drew Fustini
f069dd784e
Return BBIO_OK when u-boot overlays ared enabled
...
When Linux kernel boots with u-boot overlays enabled,
do not load overlays via slots file as the write will
hang due to kernel bug in cape manager driver.
Skip cape manager and just return BBIO_OK.
2017-06-28 09:03:04 +00:00
Drew Fustini
ae47281a0e
Add documentation about u-boot overlays
2017-06-28 08:15:36 +00:00
Drew Fustini
ae38e86006
check if kernel cmdline for uboot overlay
...
Test on Debian Jessie 2017-06-18 image:
debian@beaglebone:~$ cat /proc/cmdline
console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet
debian@beaglebone:~$ grep -c bone_capemgr.uboot_capemgr_enabled=1 /proc/cmdline
1
debian@beaglebone:~$ sudo python ~/read_adc.py
load_device_tree: cmd=grep -c bone_capemgr.uboot_capemgr_enabled=1 /proc/cmdline
load_device_tree: uboot_overlay=1
load_device_tree: uboot_overlay is 1
2017-06-28 08:05:07 +00:00
Drew Fustini
d93466ff23
Test if kernel booted wit u-boot overlays
2017-06-28 05:10:02 +00:00
Vadim-Stupakov
e0385b1707
Fixed issue #145 GPIO library doesn't free GPIO file descriptor. File descriptor leak.
...
Made a little bit refactoring
2017-06-25 13:30:27 +03:00
Drew Fustini
ff57ef2558
increase size of ctrl_dir and ocp_dir for future use
...
Pad the size of ctrl_dir and ocp_dir to be on the safe side
2017-04-19 04:00:36 +00:00
Drew Fustini
01f73c578c
remove conditional logic for ctrl_dir and ocp_dir size
...
Remove conditional logic for kernel version to determine the
size of ctrl_dir and ocp_dir. Instead, the maximum possible
size is used for these arrays regardless of the kernel version
Resolves #144
2017-04-19 03:14:31 +00:00
Drew Fustini
da0b0e5890
close file descriptor to avoid leak
...
Resolves issue #140
2017-04-12 05:48:29 +00:00
Drew Fustini
2a7e7c6862
fix file descriptor leak in gpio_set_value()
...
Leak of the file descriptor was reported in issue #142 .
I have switched from open() to access() so no need to close fd.
2017-04-05 06:45:35 +00:00
Drew Fustini
c087b3c9e7
Merge pull request #143 from djsutton/fix-wait_for_edge-TypeError
...
fix TypeError: function takes exactly 3 arguments (2 given) from wait_for_edge
2017-04-02 07:33:39 -05:00
cocasema
5b9061492a
Add PWM c++ tests
2017-03-31 02:17:00 -07:00
cocasema
91fb7c8065
Add default values to pwm::start() method.
2017-03-31 02:17:00 -07:00
cocasema
ee2d7290b9
Install header files properly
2017-03-31 02:17:00 -07:00
cocasema
c28011fc6c
Add 2 versions of library with c++98 and c++11 abi
2017-03-31 02:17:00 -07:00
cocasema
ceb468108f
Add libadafruit-bbio with C++ wrappers for PWM/GPIO
2017-03-31 02:17:00 -07:00
cocasema
6c489fce8e
Add syslog and debugging messages
2017-03-31 02:16:21 -07:00
DJ Sutton
6e54808868
fix TypeError: function takes exactly 3 arguments (2 given) from wait_for_edge
...
Trying to parse 3 required arguments and then falling back to 2 will set the
PyError condition when only two arguments are present even though the
wait_for_edge function as a whole succeeds. According to
https://docs.python.org/2/c-api/exceptions.html , returning normally after this
will lead to undefined behavior the next time the code enters the C API.
Fix this by using the PyArg_ParseTuple optional argument feature instead of
trying to parse 3 arguments and falling back to 2 if it fails.
2017-03-28 19:58:17 -06:00
cocasema
4b7e11f4d7
Extract BBIO_err into a separate header
2017-03-24 22:04:06 -07:00
Drew Fustini
a9353da3cc
Merge pull request #138 from softwareschneiderei/fix_duplicate_export
...
Fix duplicate export
2017-03-24 11:03:53 -05:00
Marius Elvert
4a4130e3b6
Fix build_path memory leak
2017-03-21 16:38:38 +01:00
Marius Elvert
dcba8f66a7
Handle already exported pins
2017-03-06 15:03:46 +01:00
Marius Elvert
5bc893a8cc
Use lookup table to prevent duplicate pin export
2017-03-06 11:48:43 +01:00
Drew Fustini
6d78f9db06
Fix gcc warnings about comparing signed and unsigned values
...
warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
2017-01-11 09:14:38 +00:00
Drew Fustini
d727792e28
Silence gcc warning -Wsign-compare
...
TODO: fix source the actual cause of the warning:
source/common.c:344:14: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
2017-01-10 10:55:12 +00:00
Drew Fustini
b1ad088164
Fix unused parameter warning [-Werror=unused-parameter]
2017-01-10 10:52:01 +00:00
Drew Fustini
edac02a875
Fix gcc warning -Wno-format-security
2017-01-10 10:52:01 +00:00
Drew Fustini
43c8d5d0fe
Fix unused parameter warning [-Werror=unused-parameter]
2017-01-10 10:51:59 +00:00
Drew Fustini
14f82d94a0
remove debug logging
2017-01-09 02:21:55 +00:00
Drew Fustini
f779f8898a
add support for alternate USR LED naming
...
Related issue:
Doesn't support Ubuntu core beaglebone leds #129
https://github.com/adafruit/adafruit-beaglebone-io-python/issues/129
2017-01-04 08:56:34 +00:00
Drew Fustini
67e0f61f9c
add PWM test for ecap0 (P9_42) and ecap2 (P9_28)
2016-12-20 10:26:19 +00:00
Drew Fustini
f58cabef1d
Use pin mode "pwm2" for P9_28
2016-12-20 09:46:50 +00:00
Drew Fustini
db9b3b7b1b
fix PWM for ECAP pins (P9_28 and P9_42)
2016-12-18 07:03:58 +00:00
João Paulo Barraca
40e5cd36c6
Merge branch 'master' of https://github.com/adafruit/adafruit-beaglebone-io-python
2016-11-23 22:53:25 +00:00
João Paulo Barraca
4639c7d04e
Fix compilation error
2016-11-23 22:40:26 +00:00
Shawn Wilson
9553b1a7b0
Changed gpio_set_direction to ignore USR LEDs.
2016-11-21 11:34:06 -05:00
Shawn Wilson
5b8a2c00a6
Added a delay parameter in order to wait for udev to make
...
file permission changes.
2016-11-19 16:27:29 -05:00
João Paulo Barraca
3791de4c0a
Merge branch 'master' of https://github.com/adafruit/adafruit-beaglebone-io-python
2016-10-30 10:55:47 +00:00
Drew Fustini
4371949776
Adjust ADC scaling based on kernel version
...
The older Linux 3.8.13 kernel produced raw ADC value
of 0 to 1800. Newer Linux 4.1+ kernels produce ADC
value of 0 to 4095.
2016-10-28 08:49:53 +00:00
Deng Bo
9220c13f90
BBB has 12‐bit ADCs (2^12 = 4,096), meaning a value between 0 and 2^12 − 1 (0 to 4,095), read() should return the raw value devide by 4095.
2016-10-26 11:23:07 +08:00
Oleg Antonyan
36c5a136df
Merge remote-tracking branch 'upstream/master'
...
Conflicts:
source/py_gpio.c
2016-10-20 09:13:50 +02:00
Drew Fustini
452f2e7ee3
Buffer for SPI bus sysfs path too small
...
@kozga advised in issue #94 of a bug in
get_spi_bus_path_number()
> In version 1.0 declared path length is too low (50 bytes)
> But for kernels 4.1 path length is 54 bytes.
> In result, path is shortened to
> '/sys/devices/platform/ocp/48030000.spi/spi_master/'
> and function always return 1,
> even if you try to open /dev/spidev2.x.
These are the sysfs paths for the SPI bus 1 and 2
for Debian 8.6 with Linux 4.4.21-bone13 kernel:
/sys/devices/platform/ocp/48030000.spi/spi_master/spi1/
/sys/devices/platform/ocp/481a0000.spi/spi_master/spi2/
I have fixed by increasing the size of path to MAX_PATH.
MAX_PATH is defined as 256. This should provide enough
extra margin for any future kernel changes in sysfs paths.
2016-10-19 23:05:52 +00:00
cocasema
efc0a25f65
Treat warnings as errors
2016-10-18 21:59:24 -07:00
Drew Fustini
e7e987aa34
Merge pull request #119 from JesseMcL/pr
...
Add GPIO pullup configurations and fix PWM Segfault on kernel 4.1+
2016-10-18 22:12:39 -05:00
Jesse McLachlan
5510854b0c
Properly support pullup configuration using pinmux
2016-10-10 14:59:53 +11:00
Jesse McLachlan
207526e91d
Move BBBVERSION41 pwm disable logic into pwm list iterator.
...
Outside the list iteration loop it causes a seg fault from writing to a closed/invalid handle if PWM.stop is called when the PWM is not open
2016-10-10 14:58:52 +11:00
Jesse McLachlan
bbac61a95e
Handle bonescript compatible pin names in ocp set pin mode function (bonescript uses eg, P8_6 instead of P8_06 which OCP needs)
2016-10-10 14:55:59 +11:00
Krzysztof Ożga
508364b4b3
Fix SPI: IOError: [Errno 22] Invalid argument in xfer and xfer2 functions
2016-09-29 08:01:17 +00:00
Matthew West
0620b43818
Bugfix: add missing read call
2016-08-30 09:46:56 -06:00
Matthew West
6759d58b91
Remove some trailing whitespace
2016-08-29 21:21:50 -07:00
Matthew West
f48e60d501
When setting up a PWM pin, read period_ns & duty_ns
2016-08-29 21:20:40 -07:00
Matthew West
565f2dc27e
Fix return convention errors
2016-08-11 15:21:41 -07:00
Matthew West
09e7597982
Fix ADC error in 3.8
2016-08-10 16:52:54 -07:00
Matthew West
ddbf6c354f
Fix initialization weirdness with pwm_set_frequency
2016-08-10 15:29:51 -07:00
Matthew West
99e27ad39e
Add a safeguard if we didn't start
2016-08-10 15:29:29 -07:00
Matthew West
f4fcd12c2f
Move a common variable out of #ifdef and #else
2016-08-10 15:29:11 -07:00
Matthew West
149129c3f5
Initialize ocp_dir before use
2016-08-10 15:09:14 -07:00
Matthew West
b0c90d5be6
Improve comment giving documentation
2016-08-10 13:41:18 -07:00
Matthew West
dea25a6d84
Switch back to included device trees - possibly it was a regression on upgraded 7.11.
2016-08-10 09:25:29 -07:00
Matthew West
0b8def4cb5
Bugfixes based on CircleCI (regressions introduced on 3.8)
2016-08-08 15:26:38 -07:00
Matthew West
cd2456b157
Fix PWM tests to reflect 4.1+
2016-08-08 12:09:19 -07:00
Matthew West
b6cf76fa0b
Small bugfix to setting frequency
2016-08-08 11:26:42 -07:00
Matthew West
ac1104c55b
Fix bug with setting frequency, fix stopping
2016-08-08 11:18:27 -07:00
Matthew West
8fe1336b0a
Bug fixes almost to stability
2016-08-08 10:51:15 -07:00
Matthew West
298334a814
Bug fixes to 4.1+ PWM code
2016-08-05 13:27:42 -07:00
Matthew West
6b2aa7aabc
Change return value convention for errors
...
Replace 1 for success and 0/-1 for failure with an enum type.
2016-08-05 13:19:54 -07:00
Matthew West
8a2e4d1b85
Switch from this library's Device Tree Overlays to those included on every image.
2016-08-05 11:31:08 -07:00
Matthew West
d6fe11ed89
Add ifndef guards to all header files
2016-08-05 11:17:14 -07:00
Matthew West
599ec57f4c
Fix PWM in Linux 4.1+
2016-08-05 10:16:34 -07:00
Matthew West
a2a88fb21a
Move PWM exporting to its own function
2016-08-05 09:58:04 -07:00
Matthew West
926b253498
Bug fix - move necessary string print outside version guards
2016-08-05 09:52:29 -07:00
Matthew West
9f38244b60
Remove broken version check in common.c (now in setup.py)
2016-08-05 09:51:29 -07:00
Matthew West
b07d85d65e
Small formatting fixes to common.c
2016-08-05 09:50:57 -07:00
Matthew West
aca9eb480b
Replace build_path impementation with glob
2016-08-05 09:42:32 -07:00
Peter Lawler
ac517ff7fb
No, really. Death to stray whitespace.
2016-05-11 09:14:05 +10:00
Peter Lawler
c9273456a6
Death to stray whitespace
2016-05-11 09:13:23 +10:00
Peter Lawler
6cee8393e4
Remove lines left behind from manual merge
2016-05-11 09:12:29 +10:00
Peter Lawler
86a5145e11
Remove stray sprintf that snuck in during manual edit
2016-05-11 09:00:31 +10:00
Peter Lawler
2ff640145e
Attributions
2016-05-11 08:49:03 +10:00
Peter Lawler
b7914ee3f6
Manually edited source change removed incorrect line
2016-05-11 08:43:02 +10:00
plawler
d16654d20a
Make friends between 3.8 and 4.1+ kernels
2016-04-29 12:29:29 +10:00
Enzo Macari
d9ad2b3812
Soporte para adc y gpio ok
...
TODO: PWM
2016-02-03 17:23:35 -03:00
Drew Fustini
b620b3f942
Add support for on-board LEDs (USR0-USR3)
...
The built-in LEDs are handled by the LED class driver and have a
different /sys/ path than the GPIO pins.
See PyBBIO library for reference:
https://github.com/graycatlabs/PyBBIO/blob/master/bbio/platform/beaglebone/config.py#L44
Resolves Adafruit customer reported issue:
https://forums.adafruit.com/viewtopic.php?f=49&t=51906
2016-01-03 18:00:25 +00:00
Simon Westphahl
9514af6f22
Add support for Python 3
...
Installation of the missing py_compile module was factored out into a
standalone script which is only compatible with Python 2.
2015-05-06 08:29:00 +02:00
Justin Cooper
a764f571d5
Events should be non-reentrant #72
2014-10-13 12:35:55 -05:00
Tony DiCola
5c8db6b80d
Fix #67 and fix compiler warnings.
2014-10-03 23:24:10 +00:00
João Paulo Barraca
e75696f4d5
Added missing space
2014-07-16 00:07:41 +01:00
João Paulo Barraca
bc9109caeb
Merge branch 'master' of https://github.com/jpbarraca/adafruit-beaglebone-io-python
...
Conflicts:
source/event_gpio.h
source/py_gpio.c
2014-07-15 23:58:16 +01:00
João Paulo Barraca
3b345a7c9e
Added support for timeout
2014-07-15 23:53:59 +01:00
Justin Cooper
dabffc6d9c
bump version to 0.0.20
2014-05-27 19:45:51 +00:00
Justin Cooper
9866c2eaa7
remove dead code
2014-05-27 19:40:32 +00:00
Justin Cooper
9e1bd7ba77
remove unused variable
2014-05-27 19:40:22 +00:00
Justin Cooper
6d2610b893
clean up source
2014-05-23 16:03:44 +00:00
Justin Cooper
7075f7a3e2
initialize ctrl_dir in unload_device_tree
2014-05-23 03:27:14 +00:00
Justin Cooper
25e654a982
fix for SPI not loading spidevX.X correctly based on load order
2014-05-23 03:22:48 +00:00
Oleg Antonyan
6cba967bf2
Wait until GPIO file appears on the /sys filesystem (issue #36 )
2014-05-21 07:04:00 +03:00
João Paulo Barraca
c86fed7263
Fix compilation error
2014-03-30 02:10:45 +01:00
João Paulo Barraca
7b1f0d4fa8
Added support for timeouts in wait_for_edge
2014-03-30 00:16:03 +00:00
Terry Hardie
8bef9b21db
Fixed the use of the "initial" parameter in setup(). This allows the initial state of the port to be set correctly when setting OUTPUT mode
2014-03-09 23:35:58 -07:00
Guy Carpenter
3597729760
Use 16-bit len counters so we can xfer > 255 bytes.
2014-01-28 03:17:09 +00:00
Justin Cooper
369ff155bc
Revert memory leak changes, causing issues with lsbfirst etc
2013-12-30 09:55:26 -06:00
Justin Cooper
baa94193ac
Fix for SPI.cshigh
2013-12-28 11:15:16 -06:00
Justin Cooper
7617c873b0
bump version to 0.0.19, and update changelog
2013-11-25 18:15:11 +00:00
Justin Cooper
408ea386f0
fix xfer and xfer2 glibc errors
2013-11-25 17:56:30 +00:00
Zach Thorson
fa1b4a3e7e
Added a retry to reading for the analog inputs to avoid a bug where reading back and forth between two analog inputs would cause the resource to be unavailable every 16 scans
...
Corrected the readback of the success bit to correctly check for a read and raise an exception on failure
2013-11-20 14:52:04 -06:00
Zach Thorson
34d7e30e1a
Updated the build_path to be more selective over what paths it chooses (This should prevent chosing the wrong helper leading to seg faults)
...
Improved error messages when ADC fails to setup
Check for null file handle when opening AIN to prevent seg fault
2013-11-14 11:10:09 -06:00
Eric Lee
715e87d2ab
Increase the size of the buffer used for storing device tree names.
...
The previous buffer size was 9 which was not log enough to hold the name of the UART device tree items.
2013-09-21 23:30:34 -07:00
Justin Cooper
9d749903b0
include UART Overlays as part of installation
2013-09-12 02:07:32 +00:00
Justin Cooper
7c130826d6
bump for 0.0.17
2013-08-19 21:52:41 +00:00
Justin Cooper
a0902d971f
further pwm cleanup
2013-08-19 21:52:16 +00:00
Justin Cooper
69b617b67d
Merge pull request #29 from bit-hacker/patch-2
...
Clean up of PWM code
2013-08-19 14:43:44 -07:00
Justin Cooper
c83f6ef38d
fix memory leaks with spimodule
2013-08-19 21:35:17 +00:00
Justin Cooper
59dff1cfee
remove print statements
2013-08-19 21:25:04 +00:00
bit-hacker
fc4df3fdf1
Update c_pwm.c
...
In definition of struct pwm_exp, extended length of key by 1 to ensure room for a terminating byte. Currently, the code doesn't check this, expecting strncpy in pwm_start to trim and NUL-terminate the string.
In lookup_exported_pwm, return "not-found" condition as NULL, not 0, per general pointer usage recommendations.
In pwm_start, added code to ensure NUL-termination of the key.
In pwm_disable, there's a path that doesn't set prev_pwm and can leave it NULL. It being NULL seems to indicate a "first-time" flag, for when the first item in the list is matched. If the search should be terminated after finding device "key", should break be used? Reasonably, a device named "key" should only be found once in the tree, but as coded, it seems that this search loop might find it more than once.
In pwm_set_polarity, the original length of the buffer as 5 will cover positive 16-bit integers, but not room for a trailing NUL byte. If accidently negative, a size of 7 will include room for the sign without breaking.
2013-08-16 09:54:26 -07:00
Justin Cooper
a322ddc2c0
fix for polarity not getting set properly, add polarity as optional parameter in start
2013-08-15 03:55:08 +00:00
Justin Cooper
5f865a1b6c
remove unused variables
2013-08-12 21:28:46 +00:00
Justin Cooper
bd1c99bf93
bump version to 0.0.15
2013-08-12 21:27:08 +00:00
Justin Cooper
210693200a
bump version to 0.0.14 and update changelog
2013-08-12 21:26:06 +00:00
Justin Cooper
b9c2b3d6d7
Fix PWM duty cycle so 0 is off and 100 is on. Set polarity to 0 by default.
2013-08-12 21:25:51 +00:00
Chris Desjardins
6f2e0cf26a
Fix compiler error in gpio_set_value
2013-08-09 10:06:36 +02:00
Chris Desjardins
af62a5c9c9
Adding common.h to event_gpio.c
2013-08-09 10:01:29 +02:00
Chris Desjardins
10229240e4
The test_direction_readback fails, because gpio_get_direction wasn't properly null terminating the direction string
2013-08-09 09:57:56 +02:00
Chris Desjardins
d80be61311
Increase buffer size of filenames for value, direction, and edge files
2013-08-08 13:35:21 +02:00
Chris Desjardins
6d4aa520e6
Give extra buffer space in export, and unexport functions for gpio that are more than 2 digits
2013-08-08 12:56:21 +02:00
Justin Cooper
670bfcbf1c
better error handling of load_device_tree through adc, pwm, and uart
2013-07-30 19:34:24 +00:00
Zach Thorson
b313f8bcfc
- Removed type in python export
2013-07-29 16:59:49 -05:00
Zach Thorson
d30657c1ae
- Fixed broke GPIO.gpio_function() It should now allow calls with the IO Name
...
- Added unit tests for GPIO.gpio_function()
2013-07-29 16:53:11 -05:00
Justin Cooper
fb56ad916e
bump version to 0.0.13
2013-07-26 17:58:42 +00:00
Justin Cooper
6ab0c0da49
Merge pull request #15 from amscins/master
...
Pass the name of the GPIO to callbacks rather than the GPIO number.
2013-07-26 10:55:46 -07:00
Justin Cooper
2047922902
bump version for pypi issue
2013-07-26 17:52:26 +00:00
Chris Desjardins
b412e17e6c
Remove the gpio parameter from callbacks (it is useless)
2013-07-26 18:05:00 +02:00
Chris Desjardins
7b18706531
Fix bug in sizeof()
2013-07-26 17:55:35 +02:00
Chris Desjardins
089141070c
Add type for channel argument
2013-07-26 17:43:51 +02:00
Chris Desjardins
f82caf8f35
Update the code to invoke callback with the channel
2013-07-26 17:31:04 +02:00
Justin Cooper
0b45f8d36c
add small delay after loading any device tree overlays
2013-07-24 02:39:16 +00:00
Justin Cooper
004530a91c
remove debug statements, add device names
2013-07-23 20:40:22 +00:00
Justin Cooper
ffc58aee30
further support for UART exporting
2013-07-22 21:38:24 +00:00
Justin Cooper
b829cc4132
initial support to export uart
2013-07-22 21:04:29 +00:00
Justin Cooper
ee45a94e2f
bump to 0.0.11
2013-07-22 21:04:17 +00:00
Justin Cooper
691efb8eaf
fix for issue 14, seg faults with gpio events
2013-07-18 21:16:00 +00:00
Justin Cooper
5f50ae9c01
fix for spi overlays
2013-07-17 18:22:03 +00:00
Justin Cooper
5c09f8915a
fix for ADC segmentation faults, bump to 0.0.9
2013-07-09 20:13:47 +00:00
Justin Cooper
2a7643a7b1
temp remove overlay compilation
2013-07-03 16:59:11 +00:00
Justin Cooper
826ca2c41c
more SPI code, not working as of yet
2000-01-01 10:28:44 +00:00
Justin Cooper
c8b2057e1e
update copyright
2000-01-01 10:28:25 +00:00
Justin Cooper
a17284d4bf
update copyright notices
2013-07-01 21:01:58 +00:00
Justin Cooper
ab6dab6519
fix tests, initial non-working spi, refactor loading device tree
2000-01-01 00:06:09 +00:00
Justin Cooper
9f679aad42
bump to 0.0.6 for i2c
2000-01-01 00:51:45 +00:00
Justin Cooper
de7186368f
rename BBIO to Adafruit_BBIO
2013-06-27 02:50:45 +00:00
Justin Cooper
5df7f2fe10
update for pip and easy_install
2013-06-26 15:38:34 +00:00
Justin Cooper
f85ce1217a
update installation to support pip and easy_install
2013-06-26 01:32:16 +00:00