Commit graph

254 commits

Author SHA1 Message Date
Drew Fustini
eca84d64d7 Fix warning about casting incompatible function types #308
Debian 10 (Buster) has gcc 8.2 which warns about:

cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’

The solution is to cast to '(PyCFunction)(void *)'
2019-12-11 09:06:12 +00:00
Drew Fustini
7fb13f9f3d Fix warnings on format truncation and sizeof in strncpy #308
Debian 10 (Buster) has gcc 8.2 which warns about:

source/c_pwm.c:459:65: error: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
source/c_pwm.c:396:43: error: ‘%s’ directive output may be truncated writing up to 199 bytes into a region of size 100 [-Werror=format-truncation=]
2019-12-11 09:03:44 +00:00
Drew Fustini
3a5d23d01b Fix warning about casting incompatible function types #308
Debian 10 (Buster) has gcc 8.2 which warns about:

cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’

The solution is to cast to '(PyCFunction)(void *)'
2019-12-06 10:26:49 +00:00
Drew Fustini
9298393cf5 Fix warning print format strings being truncated #308
Debian 10 (Buster) has gcc 8.2 which warns about:

error: ‘%s’ directive output may be truncated writing up to 19 bytes into a region of size between 10 and 59 [-Werror=format-truncation=]
  snprintf(path, sizeof(path), "%s/%s/state", ocp_dir, pinmux_dir);
2019-12-06 10:24:47 +00:00
Drew Fustini
7032af7e5f Fix warning about casting incompatible function types #308
Debian 10 (Buster) has gcc 8.2 which warns about:

cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’

The solution is to cast to '(PyCFunction)(void *)'
2019-12-06 10:20:18 +00:00
Drew Fustini
b867bbffe3
Change name of P1_3 to match bone.js 2019-04-03 00:21:27 +01:00
Drew Fustini
5df30a8b73
do not set pin mode for built-in USRn LEDs
This fix resolves Adafruit_BBIO issue #310 and https://github.com/adafruit/Adafruit_Blinka/issues/96 which was preventing the USR LEDs from being used by the CircuitPython Blinka library
2019-04-01 03:10:02 +01:00
Drew Fustini
2cfded3459
Fix dead link to bone.js #296 2018-12-10 07:32:21 -06:00
Drew Fustini
e96e1efb53 remove deug output 2018-11-23 05:35:27 +00:00
Drew Fustini
96aa8ed2aa do not set pinmux on the beaglebone blue
beaglebone blue has complete dtb file and does not need pinmux set for gpio ports
2018-11-23 04:54:32 +00:00
Drew Fustini
1f7c20e899 remove debug logging 2018-10-17 14:59:09 -05:00
Drew Fustini
c09ab8ee43 fix pwm on pocketbeagle and beaglebone blue #286
pocketbeagle and beaglebone blue have complete dtb file
and do not need overlays
2018-10-17 14:56:11 -05:00
Drew Fustini
b1ee5998f0
Merge pull request #285 from sam-bristow/bugfix/uart-error-reporting
Return error-code for problem UART interface
2018-10-11 11:26:28 -05:00
Sam Bristow
448854c209 Return error-code for failing interface
Rather than returning the error code for UART1 regardless of which
interface had problems, we should return the error code for the
interface that actually had an error.

Pretty sure this was a simple copy-paste mistake.
2018-10-09 23:57:20 +13:00
Sam Bristow
eff11b83fe Use print() function in all code and docs
Low-hanging fruit of Python3 compatibility work.

I've left fix_py_compile.py as it is only ever going to be run under
Python 2.
2018-10-09 23:34:26 +13:00
Drew Fustini
7affea78fd do not load overlays for the beaglebone blue #283
beaglebone blue has complete dtb file and does not need overlays

refer to issue 283:
https://github.com/adafruit/adafruit-beaglebone-io-python/issues/283
2018-10-07 22:10:02 +00:00
Erik Welsh
e626f07d8d Fixed GPIO export problem; Leaves GPIO in bad state on latest BeagleBone image on PocketBeagle 2018-09-30 16:24:33 +00:00
Drew Fustini
c749402003
Add UART entries for the PocketBeagle (issue #242)
PocketBeagle pins with UART pin mode:

  P1_30 uart0_txd
  P1_32 uart0_rxd
  P2_11 uart1_rxd
  P2_09 uart1_txd
  P1_08 uart2_rxd
  P1_10 uart2_txd
  P2_29 uart3_txd

Available UART names on PocketBeagle:

 PB-UART0: /dev/ttyO0, Rx: P1_30, Tx: P1_32
 PB-UART1: /dev/ttyO1, Rx: P2_11, Tx: P2_09
 PB-UART2: /dev/ttyO2, Rx: P1_08, Tx: P1_10
 PB-UART3: /dev/ttyO3, Rx: P2_29, Tx: none

Signed-off-by: Drew Fustini <drew@pdp7.com>
2018-08-31 04:10:47 -05:00
Drew Fustini
bbf0927781
Merge pull request #251 from amarburg/master
Added usleep after successfully enabling PWM via udev.
2018-06-26 11:16:03 -05:00
zserg
3265d156e4 * Minor style fixes
* Added comments
* Added debug logging
* Line 724 - now <initial> flag is properly reset upon removal of event detection from GPIO pin
2018-05-31 18:10:26 +01:00
zserg
b054cc083e * Fixed SEGFAULT in event_gpio,c run_callbacks()
* Added more elaborate epoll() error logging
2018-05-30 16:47:47 +01:00
Aaron Marburg
e061d1358e Added usleep after successfully enabling PWM via udev. 2018-04-12 22:46:49 +00:00
zserg
e9c70f7d23 * Fixed SEGFAULT when calling remove_event_detect() inside python callback function. 2018-02-18 00:06:57 +00:00
Drew Fustini
8dfbf64c36
Fix spidev path mismatch (#216)
Remove unnecessary call to get_spi_bus_path_number()
and use the bus and device passed to SPI_open().

Signed-off-by: Drew Fustini <drew@pdp7.com>
2017-12-01 06:36:50 -06:00
Drew Fustini
61af64e734
use set_pin_mode() to set uart pinmux (#158)
Use set_pin_mode() to set pinmux for UART
RX and TX pins. This is similar effect as
running the config-pin utility.

Signed-off-by: Drew Fustini <drew@pdp7.com>
2017-11-30 22:39:14 -06:00
Drew Fustini
a22cd5fd24
Fix seg fault of PWM in Python 3.6 (#189)
PWM.set_frequency() and PWM.set_duty_cycle()
were resulting in a seg fault inside the
call to PyArg_ParseTupleAndKeywords().

Signed-off-by: Drew Fustini <drew@pdp7.com>
2017-11-25 05:24:44 -06:00
Drew Fustini
503e8397e6
Fix leak of pwm enable file descriptor (#197)
Make sure that the file descriptor for pwm enable
is closed along with the other pwm file descriptors

Signed-off-by: Drew Fustini <drew@pdp7.com>
2017-11-24 00:29:04 -06:00
Drew Fustini
f82ba3a1ec
close enable_fd when stopping PWM output (#197)
Issue #197: JesseMcL raised the issue that running
PWM.start() and PWM.start() in a loop will eventually
exhaust the number of open file descriptors and
PWM.start() will raise the error:

  RuntimeError: problem with sysfs file.

The file descriptor for the enable file should
be closed in pwm_disable() to avoid the leak

Signed-off-by: Drew Fustini <drew@pdp7.com>
2017-11-22 04:38:14 -06:00
Drew Fustini
32814797ff
cache board type to avoid poor performance (#196)
cache board type to avoid poor performance
in functions that are called frequently like
gpio_set_value() in source/event_gpio.c

Signed-off-by: Drew Fustini <drew@pdp7.com>
2017-11-18 23:18:21 -06:00
Drew Fustini
b328cddd13
Fix PocketBeagle PWM pin typo (#192)
ehrpwm0 channel 1 is  P1_33 on a the PocketBeagle

Signed-off-by: Drew Fustini <drew@pdp7.com>
2017-11-17 03:23:29 -06:00
Drew Fustini
335e105bc1
Comment out debug log in gpio hotpath #188
Signed-off-by: Drew Fustini <drew@pdp7.com>
2017-11-08 17:43:19 -06:00
Drew Fustini
794d7136b4 Change log level from INFO to DEBUG #188
Signed-off-by: Drew Fustini <drew@pdp7.com>
2017-11-08 03:16:47 -06:00
Drew Fustini
ca0a4afcdb Filter DEBUG syslog to avoid poor performance #188 2017-11-08 03:03:52 -06:00
Drew Fustini
b65cbf8e41 sleep to avoid udev race condition #185
sleep 100 ms after export to avoid race condition as udev
needs the opportunity to set group ownership and permission

Test instructions:
==================
reboot, log back in, wait for udev to set group ownership and permission:

$ ls -la /sys/devices/platform/ocp/48304000.epwmss/48304200.pwm/pwm/pwmchip6/export
-rw-rw---- 1 root pwm 4096 Nov  2 04:02 /sys/devices/platform/ocp/48304000.epwmss/48304200.pwm/pwm/pwmchip6/export

run test program:

python ~/issue185.py

contents of test program:

import Adafruit_BBIO.PWM as PWM
PWM.start("P8_13", 50, 1000, 0)
PWM.stop("P8_13")
PWM.cleanup()
2017-11-02 04:08:48 +00:00
Robert Nelson
1ead3f90eb source/common.c: PocketBeagle Fix P2.24
I copied the initial schematic when i setup this pinmux table...

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
2017-11-01 21:24:30 -05:00
Drew Fustini
f267ec01b1 minor change to pwm debug logging 2017-11-01 09:11:44 +00:00
Drew Fustini
58eb54679c Attempt to use udev ecap path for pwm path
Example of pwm and ecap paths for pwm outputs in the 4.14 kernel:

/sys/devices/platform/ocp/48300000.epwmss/48300100.ecap/pwm/pwmchip0/pwm-0:0/duty_cycle
/sys/devices/platform/ocp/48300000.epwmss/48300200.pwm/pwm/pwmchip1/pwm-1:0/duty_cycle
/sys/devices/platform/ocp/48300000.epwmss/48300200.pwm/pwm/pwmchip1/pwm-1:1/duty_cycle
/sys/devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchip3/pwm-3:0/duty_cycle
/sys/devices/platform/ocp/48302000.epwmss/48302200.pwm/pwm/pwmchip3/pwm-3:1/duty_cycle
/sys/devices/platform/ocp/48304000.epwmss/48304100.ecap/pwm/pwmchip5/pwm-5:0/duty_cycle

Note that the ecap path is longer than pwm path by 1 character
2017-11-01 09:05:12 +00:00
Drew Fustini
705368d91e only check kernel overlays if u-boot overlays are not being used 2017-11-01 04:15:08 +00:00
Drew Fustini
5af654ca14 change fprintf() to syslog() 2017-10-31 07:19:53 +00:00
Drew Fustini
8e08a40f14 move pwm_set_polarity() after period is set 2017-10-31 06:39:20 +00:00
Drew Fustini
73ea172d21 remove polarity "hack" for PWM #170 2017-10-31 05:37:14 +00:00
Drew Fustini
1b3dab6950 add "Adafruit_BBIO" to syslog() 2017-10-31 03:53:02 +00:00
Drew Fustini
1edb20770e change syslog mask level to DEBUG 2017-10-31 03:13:50 +00:00
Drew Fustini
5f32b56e99 convert debug output to syslog 2017-10-31 02:55:02 +00:00
Drew Fustini
8e64f67ff0 convert fprintf() to syslog() for #178 2017-10-31 02:41:07 +00:00
Drew Fustini
becbc95861 check if BeagleBone Blue before accessing non-standard LEDs
This check is needed as BeagleBone Blue has additional LEDs
connected to GPIO pins that other BeagleBone models do not
2017-10-28 05:28:51 +00:00
Drew Fustini
5e2e785b51 check if board is BeagleBone Blue or PocketBeagle
This check is needed as BeagleBone Blue and PocketBeagle
have additional LEDs connected to GPIO pins that other
BeagleBone models do not
2017-10-28 04:27:03 +00:00
Drew Fustini
2cb837618a Merge pull request #163 from MarkAYoder/master
Added BAT25, BAT50, BAT75, BAT100 and WIFI LEDs
2017-10-17 10:08:15 -05:00
Drew Fustini
41094a2042 Merge pull request #173 from RobertCNelson/PocketBeagle
source/common.c: add initial PocketBeagle values
2017-10-17 10:06:18 -05:00
Robert Nelson
0735ad0352 source/common.c: Blue Fix GP0_3 id
fixes: https://github.com/adafruit/adafruit-beaglebone-io-python/issues/174

Reported-by: Randy Rossi <randy.rossi@gmail.com>
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
2017-10-13 14:06:44 -05:00