Commit graph

45 commits

Author SHA1 Message Date
Drew Fustini
f2f5c0af7e
relocate doc dir to avoid confusion (#218)
Now that there is 'docs' dir, move existing
'doc' dir containing misc documentation into
'test/notes' dir.

Signed-off-by: Drew Fustini <drew@pdp7.com>
2017-12-03 03:44:43 -06:00
Drew Fustini
a666e500df remove test_rotary.py as not valid for pytest 2017-11-25 05:04:55 -06:00
Drew Fustini
fff7617a15
fix error in set_brightness()
Resolve error that occurs in set_brightness():

E       TypeError: unorderable types: str() < int()

Signed-off-by: Drew Fustini <drew@pdp7.com>
2017-11-22 03:30:22 -06:00
Drew Fustini
2f54b4e788
use dict.items() instead of dict.iteritems() for Python 3
from: https://wiki.python.org/moin/Python3.0

> Remove dict.iteritems(), dict.iterkeys(), and dict.itervalues().
>    Instead: use dict.items(), dict.keys(), and dict.values() respectively.

Signed-off-by: Drew Fustini <drew@pdp7.com>
2017-11-22 03:26:11 -06:00
Drew Fustini
cd6b0a721a
fix except syntax for Python 3
Signed-off-by: Drew Fustini <drew@pdp7.com>
2017-11-22 03:25:14 -06:00
Drew Fustini
a7dd48c3f4 update PWM test for 4.14 kernel udev paths
pytest now passes all tests OK on 4.14.0-rc7-ti-r6 as non-root user:

debian@beaglebone:~/ssh/adafruit-beaglebone-io-python/test$ python -m pytest
======== test session starts =============
platform linux2 -- Python 2.7.13, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
rootdir: /home/debian/ssh/adafruit-beaglebone-io-python, inifile:
collected 58 items

test_adc.py ......
test_gpio_input.py ..
test_gpio_output.py ......
test_gpio_setup.py ..........
test_led.py ..
test_pwm_setup.py ...........................
test_spi.py ..
test_uart.py ...

======== 58 passed in 13.30 seconds ========

debian@beaglebone:~$ sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[6c2688b0be448b7bb9ca18849b430d496a84acb4]
eeprom:[A335BNLT000C3014BBBK1316]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2017-10-17]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2017.09-00002-g0f3f1c7907]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2017.09-rc2-00002-g84a7f2]
kernel:[4.14.0-rc7-ti-r6]
nodejs:[v6.11.5]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg:[bb-cape-overlays]:[4.4.20171027.1-0rcnee1~stretch+20171027]
pkg:[bb-wl18xx-firmware]:[1.20170829-0rcnee1~stretch+20170829]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee0~stretch+20170830]
2017-11-01 09:05:23 +00:00
Drew Fustini
ac1746dcd2 add test script for all BeagleBone PWM outputs 2017-11-01 09:05:21 +00:00
Drew Fustini
d6bf8fddc0 add test for issue #170
Output from running test:

debian@beaglebone:~/ssh/adafruit-beaglebone-io-python$ sudo python test/issue170-pwm.py; journalctl -p debug -t python --since "1 min ago"
-- Logs begin at Tue 2017-10-31 06:56:00 UTC, end at Tue 2017-10-31 07:36:39 UTC. --
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: version <unknown> initialized
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: P9_14, 50.000000, 2000.000000, 1
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: lookup_exported_pwm: couldn't find 'P9_14'
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: initialize_pwm: OK
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: set_pin_mode() :: Pinmux file /sys/devices/platform/ocp/ocp:P9_14
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: set_pin_mode() :: Set pinmux mode to pwm for P9_14
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: P9_14, /sys/devices/platform/ocp/48302000.epwmss/48302
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: P9_14, /sys/devices/platform/ocp/48302000.epwmss/48302
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_setup: P9_14 OK
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: call pwm_set_frequency(key=P9_14 freq=2000.000000)
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_set_frequency: P9_14 2000.000000 OK
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: call pwm_set_duty_cycle(key=P9_14 duty=50.000000)
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_set_duty_cycle: P9_14 50.000000 OK
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: call pwm_set_polarity(key=P9_14 polarity=1)
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_set_polarity: P9_14 1 OK
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: write(pwm->enable_fd, buffer=1, len=1)
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: P9_14 OK
Oct 31 07:35:57 beaglebone python[1997]: [40B blob data]
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: P9_14, 50.000000, 2000.000000, 0
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: lookup_exported_pwm: couldn't find 'P9_14'
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: set_pin_mode() :: Pinmux file /sys/devices/platform/ocp/ocp:P9_14
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: set_pin_mode() :: Set pinmux mode to pwm for P9_14
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: P9_14, /sys/devices/platform/ocp/48302000.epwmss/48302
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: P9_14, /sys/devices/platform/ocp/48302000.epwmss/48302
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_setup: P9_14 OK
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: call pwm_set_frequency(key=P9_14 freq=2000.000000)
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_set_frequency: P9_14 2000.000000 OK
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: call pwm_set_duty_cycle(key=P9_14 duty=50.000000)
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_set_duty_cycle: P9_14 50.000000 OK
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: call pwm_set_polarity(key=P9_14 polarity=0)
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_set_polarity: P9_14 0 OK
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: write(pwm->enable_fd, buffer=1, len=1)
Oct 31 07:35:57 beaglebone python[1997]: Adafruit_BBIO: pwm_start: P9_14 OK
Oct 31 07:35:57 beaglebone python[1997]: [40B blob data]
2017-10-31 07:38:31 +00:00
Drew Fustini
d75e0c8216 update test for issue #178
RESULTS:

debian@beaglebone:~/ssh/adafruit-beaglebone-io-python/test$ sudo python -m pytest
=================================================== test session starts ====================================================
platform linux2 -- Python 2.7.13, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
rootdir: /home/debian/ssh/adafruit-beaglebone-io-python, inifile:
collected 58 items

test_adc.py ......
test_gpio_input.py ..
test_gpio_output.py ......
test_gpio_setup.py ..........
test_led.py ..
test_pwm_setup.py ...........................
test_spi.py ..
test_uart.py ...

================================================ 58 passed in 13.31 seconds ================================================

debian@beaglebone:~/ssh/adafruit-beaglebone-io-python/test$ sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[6c2688b0be448b7bb9ca18849b430d496a84acb4]
eeprom:[A335BNLT000C3014BBBK1316]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2017-10-17]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2017.09-00002-g0f3f1c7907]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2017.09-rc2-00002-g84a7f2]
kernel:[4.9.57-ti-r71]
nodejs:[v6.11.4]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg:[bb-cape-overlays]:[4.4.20171013.2-0rcnee1~stretch+20171013]
pkg:[bb-wl18xx-firmware]:[1.20170829-0rcnee1~stretch+20170829]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee0~stretch+20170830]
debian@beaglebone:~/ssh/adafruit-beaglebone-io-python/test$

debian@beaglebone:~/ssh/adafruit-beaglebone-io-python$ sudo python ./test/issue178.py
========================
test GPIO.setup(): USR0
test GPIO.output(): USR0
test GPIO.input(): USR0=1
========================
test GPIO.setup(): USR1
test GPIO.output(): USR1
test GPIO.input(): USR1=1
========================
test GPIO.setup(): USR2
test GPIO.output(): USR2
test GPIO.input(): USR2=1
========================
test GPIO.setup(): USR3
test GPIO.output(): USR3
test GPIO.input(): USR3=1
========================
test GPIO.setup(): RED_LED
test GPIO.output(): RED_LED
test GPIO.input(): RED_LED=1
========================
test GPIO.setup(): GREEN_LED
test GPIO.output(): GREEN_LED
test GPIO.input(): GREEN_LED=1
========================
test GPIO.setup(): BAT25
test GPIO.output(): BAT25
test GPIO.input(): BAT25=1
========================
test GPIO.setup(): BAT50
test GPIO.output(): BAT50
test GPIO.input(): BAT50=1
========================
test GPIO.setup(): BAT75
test GPIO.output(): BAT75
test GPIO.input(): BAT75=1
========================
test GPIO.setup(): P8_7
test GPIO.output(): P8_7
test GPIO.input(): P8_7=1
========================
test GPIO.setup(): P8_8
test GPIO.output(): P8_8
test GPIO.input(): P8_8=1
========================
test GPIO.setup(): P8_17
test GPIO.output(): P8_17
test GPIO.input(): P8_17=1
========================
test GPIO.setup(): P8_32
test GPIO.output(): P8_32
test GPIO.input(): P8_32=1
========================
test GPIO.setup(): P8_26
test GPIO.output(): P8_26
test GPIO.input(): P8_26=1

journalctl -p debug -t python --since "1 min ago"

-- Logs begin at Tue 2017-10-24 20:55:42 UTC, end at Tue 2017-10-31 04:02:47 UTC. --
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: version <unknown> initialized
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_export: 53 couldn't write "/sys/class/gpio/export": 16-Device or resource busy
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_direction: 53 not applicable to built-in LEDs
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: USR LED path
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/leds/beaglebone:green:usr0/brightness
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 53 0 OK
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: USR LED path
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/leds/beaglebone:green:usr0/brightness
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 53 1 OK
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio open_value_file: filename=/sys/class/leds/beaglebone:green:usr0/brightness
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_get_value: 53 OK
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_export: 54 couldn't write "/sys/class/gpio/export": 16-Device or resource busy
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_direction: 54 not applicable to built-in LEDs
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: USR LED path
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/leds/beaglebone:green:usr1/brightness
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 54 0 OK
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: USR LED path
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/leds/beaglebone:green:usr1/brightness
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 54 1 OK
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio open_value_file: filename=/sys/class/leds/beaglebone:green:usr1/brightness
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_get_value: 54 OK
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_export: 55 couldn't write "/sys/class/gpio/export": 16-Device or resource busy
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_direction: 55 not applicable to built-in LEDs
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: USR LED path
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/leds/beaglebone:green:usr2/brightness
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 55 0 OK
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: USR LED path
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/leds/beaglebone:green:usr2/brightness
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 55 1 OK
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio open_value_file: filename=/sys/class/leds/beaglebone:green:usr2/brightness
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_get_value: 55 OK
Oct 31 04:02:43 beaglebone python[14351]: Adafruit_BBIO: gpio_export: 56 couldn't write "/sys/class/gpio/export": 16-Device or resource busy
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_direction: 56 not applicable to built-in LEDs
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: USR LED path
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/leds/beaglebone:green:usr3/brightness
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 56 0 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: USR LED path
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/leds/beaglebone:green:usr3/brightness
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 56 1 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio open_value_file: filename=/sys/class/leds/beaglebone:green:usr3/brightness
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_get_value: 56 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_export: 66 already exported
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_direction: 66 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio66/value
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 66 0 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio66/value
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 66 1 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio open_value_file: default gpio path
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio open_value_file: filename=/sys/class/gpio/gpio66/value
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_get_value: 66 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_export: 67 already exported
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_direction: 67 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio67/value
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 67 0 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio67/value
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 67 1 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio open_value_file: default gpio path
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio open_value_file: filename=/sys/class/gpio/gpio67/value
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_get_value: 67 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_export: 27 already exported
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_direction: 27 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio27/value
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 27 0 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio27/value
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 27 1 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio open_value_file: default gpio path
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio open_value_file: filename=/sys/class/gpio/gpio27/value
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_get_value: 27 OK
Oct 31 04:02:44 beaglebone python[14351]: Adafruit_BBIO: gpio_export: 11 OK
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_direction: 11 OK
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio11/value
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 11 0 OK
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio11/value
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 11 1 OK
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio open_value_file: default gpio path
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio open_value_file: filename=/sys/class/gpio/gpio11/value
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_get_value: 11 OK
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_export: 61 already exported
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_direction: 61 OK
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio61/value
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 61 0 OK
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio61/value
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 61 1 OK
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio open_value_file: default gpio path
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio open_value_file: filename=/sys/class/gpio/gpio61/value
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_get_value: 61 OK
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_export: 66 already exported
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_direction: 66 OK
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio66/value
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 66 0 OK
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio66/value
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 66 1 OK
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_get_value: 66 OK
Oct 31 04:02:45 beaglebone python[14351]: Adafruit_BBIO: gpio_export: 67 already exported
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_direction: 67 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio67/value
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 67 0 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio67/value
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 67 1 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_get_value: 67 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_export: 27 already exported
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_direction: 27 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio27/value
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 27 0 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio27/value
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 27 1 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_get_value: 27 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_export: 11 already exported
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_direction: 11 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio11/value
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 11 0 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio11/value
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 11 1 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_get_value: 11 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_export: 61 already exported
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_direction: 61 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio61/value
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 61 0 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: default gpio path
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: filename=/sys/class/gpio/gpio61/value
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_set_value: 61 1 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_get_value: 61 OK
Oct 31 04:02:46 beaglebone python[14351]: Adafruit_BBIO: gpio_unexport: 11 OK
2017-10-31 04:03:11 +00:00
Drew Fustini
0740f75d61 Add test for GPIO regression #178
These are all the LEDs defined in [source/event_gpio.h](https://github.com/adafruit/adafruit-beaglebone-io-python/blob/master/source/event_gpio.h) which map to entries in `pins_t table[]` in [source/common.c](https://github.com/adafruit/adafruit-beaglebone-io-python/blob/master/source/common.c#L72)

* 66
  * BeagleBone (not Blue): `{ "TIMER4", "P8_7", 66, -1, -1},`
  * BeagleBone Blue: `{ "RED_LED", "RED", 66, -1, -1}, // LEDs`

* 67
  * BeagleBone (not Blue):  `{ "TIMER7", "P8_8", 67, -1, -1},`
  * BeagleBone Blue:  `{ "GREEN_LED", "GREEN", 67, -1, -1},`

* 27
  * BeagleBone (not Blue): `{ "GPIO0_27", "P8_17", 27, -1, -1},`
  * BeagleBone Blue: `{ "BAT25", "BAT25", 27, -1, -1},`
  * PocketBeagle: `{ "GPIO0_27", "P2_19", 27, -1, -1},`

* 11
  * BeagleBone (not Blue): `{ "UART5_RTSN", "P8_32", 11, -1, -1},`
  * BeagleBone Blue: `{ "BAT50", "BAT50", 11, -1, -1},`

* 61
  * BeagleBone (not Blue): ` { "GPIO1_29", "P8_26", 61, -1, -1},`
  * BeagleBone Blue: ` { "BAT75", "BAT75", 61, -1, -1},`

NOTE: header pin modes are well defined in these PDFs:
* [BBBP8Header.pdf](http://exploringbeaglebone.com/wp-content/uploads/2014/10/BBBP8Header.pdf)
* [BBBP9Header.pdf](http://exploringbeaglebone.com/wp-content/uploads/2014/10/BBBP9Header.pdf)

```
import Adafruit_BBIO.GPIO as GPIO

test_pins = [ "P8_7", "P8_8", "P8_17", "P8_32", "P8_26" ]

for pin in test_pins:
  print("========================")
  print("test GPIO.setup(): {0}".format(pin))
  GPIO.setup(pin, GPIO.OUT)
  print("test GPIO.output(): {0}".format(pin))
  GPIO.output(pin, GPIO.HIGH)
  value = GPIO.input(pin);
  print("test GPIO.input(): {0}={1}".format(pin, value));

GPIO.cleanup()
```

```
debian@beaglebone:~/ssh/adafruit-beaglebone-io-python$ cat /etc/dogtag
BeagleBoard.org Debian Image 2017-10-17
debian@beaglebone:~/ssh/adafruit-beaglebone-io-python$ cat /etc/debian_version
9.2
debian@beaglebone:~/ssh/adafruit-beaglebone-io-python$ uname -a
Linux beaglebone 4.9.57-ti-r71 #1 SMP PREEMPT Thu Oct 19 18:17:06 UTC 2017 armv7l GNU/Linux
```

```
debian@beaglebone:~/ssh/adafruit-beaglebone-io-python$ sudo python ~/issue178.py
========================
test GPIO.setup(): P8_7
gpio_set_value: uboot_overlay_enabled() is true
gpio_set_value: pocketbeagle() is FASLE
gpio_set_value: beaglebone_blue() is FALSE
gpio_set_value: default gpio path
gpio_set_value: filename=/sys/class/gpio/gpio66/value
test GPIO.output(): P8_7
gpio_set_value: uboot_overlay_enabled() is true
gpio_set_value: pocketbeagle() is FASLE
gpio_set_value: beaglebone_blue() is FALSE
gpio_set_value: default gpio path
gpio_set_value: filename=/sys/class/gpio/gpio66/value
gpio open_value_file: default gpio path
gpio open_value_file: filename=/sys/class/gpio/gpio66/value
test GPIO.input(): P8_7=1
========================
test GPIO.setup(): P8_8
gpio_set_value: uboot_overlay_enabled() is true
gpio_set_value: pocketbeagle() is FASLE
gpio_set_value: beaglebone_blue() is FALSE
gpio_set_value: default gpio path
gpio_set_value: filename=/sys/class/gpio/gpio67/value
test GPIO.output(): P8_8
gpio_set_value: uboot_overlay_enabled() is true
gpio_set_value: pocketbeagle() is FASLE
gpio_set_value: beaglebone_blue() is FALSE
gpio_set_value: default gpio path
gpio_set_value: filename=/sys/class/gpio/gpio67/value
gpio open_value_file: default gpio path
gpio open_value_file: filename=/sys/class/gpio/gpio67/value
test GPIO.input(): P8_8=1
========================
test GPIO.setup(): P8_17
gpio_set_value: uboot_overlay_enabled() is true
gpio_set_value: pocketbeagle() is FASLE
gpio_set_value: beaglebone_blue() is FALSE
gpio_set_value: default gpio path
gpio_set_value: filename=/sys/class/gpio/gpio27/value
test GPIO.output(): P8_17
gpio_set_value: uboot_overlay_enabled() is true
gpio_set_value: pocketbeagle() is FASLE
gpio_set_value: beaglebone_blue() is FALSE
gpio_set_value: default gpio path
gpio_set_value: filename=/sys/class/gpio/gpio27/value
gpio open_value_file: default gpio path
gpio open_value_file: filename=/sys/class/gpio/gpio27/value
test GPIO.input(): P8_17=1
========================
test GPIO.setup(): P8_32
gpio_set_value: uboot_overlay_enabled() is true
gpio_set_value: pocketbeagle() is FASLE
gpio_set_value: beaglebone_blue() is FALSE
gpio_set_value: default gpio path
gpio_set_value: filename=/sys/class/gpio/gpio11/value
test GPIO.output(): P8_32
gpio_set_value: uboot_overlay_enabled() is true
gpio_set_value: pocketbeagle() is FASLE
gpio_set_value: beaglebone_blue() is FALSE
gpio_set_value: default gpio path
gpio_set_value: filename=/sys/class/gpio/gpio11/value
gpio open_value_file: default gpio path
gpio open_value_file: filename=/sys/class/gpio/gpio11/value
test GPIO.input(): P8_32=1
========================
test GPIO.setup(): P8_26
gpio_set_value: uboot_overlay_enabled() is true
gpio_set_value: pocketbeagle() is FASLE
gpio_set_value: beaglebone_blue() is FALSE
gpio_set_value: default gpio path
gpio_set_value: filename=/sys/class/gpio/gpio61/value
test GPIO.output(): P8_26
gpio_set_value: uboot_overlay_enabled() is true
gpio_set_value: pocketbeagle() is FASLE
gpio_set_value: beaglebone_blue() is FALSE
gpio_set_value: default gpio path
gpio_set_value: filename=/sys/class/gpio/gpio61/value
gpio open_value_file: default gpio path
gpio open_value_file: filename=/sys/class/gpio/gpio61/value
test GPIO.input(): P8_26=1
```
2017-10-31 02:13:21 +00:00
Drew Fustini
d9be5f9610 TEMPORARY FIX: disable polarity check
disable polarity check due to issue in 4.9.x+ kernels

refer to issue #170:
https://github.com/adafruit/adafruit-beaglebone-io-python/issues/170

and commit c35e4cb from pull request #173:
"source/c_pwm.c: disable pwm_set_polarity (broken in v4.9.x/v4.14.x)"
c35e4cb98a
2017-10-18 07:22:17 +00:00
Drew Fustini
713cafa28e Workaround test failure until TIMERn bug is fixed
Replace GPIO for test "TIMER6" with "P8_10" as TIMERn syntax
is not working on newer kernels such as 4.4.

This is a valid path:
/sys/devices/platform/ocp/ocp:P8_10_pinmux/state

while this path is invalid:
/sys/devices/platform/ocp/ocp:TIMER_pinmux/state

Originally discovered while testing Pull Request #152.
See issue #156 for details.
2017-08-23 07:59:56 +00:00
Drew Fustini
ed51778ce6 update QEP test for issue #122 2017-06-10 04:36:19 +00:00
Drew Fustini
3ccdbb5987 update QEP test 2017-06-10 04:33:58 +00:00
Drew Fustini
c418cdae9a document howo to enable all the eqep pins 2017-05-11 09:44:15 +00:00
Drew Fustini
c6b314c7e5 return position from getPosition() 2017-04-24 06:22:25 +00:00
Drew Fustini
790deb2021 read from eqep position file 2017-04-24 06:15:18 +00:00
Drew Fustini
0b4bf35ae1 add test for rotary encoder 2017-04-23 05:38:27 +00:00
Drew Fustini
82511cc617 reduce ADC reads in pytest from 10,000 to 1,000
Reduce number of reads of ADC so that pytest will run faster.
Long run time is especially annoying when using strace.
2017-04-05 07:28:03 +00:00
Drew Fustini
0870d6a583 Add device tree patch for full test coverage of test_led.py
Patch for device tree binding in ti-linux-4.4.y branch of
the ti-linux-kernel-dev repo which renames the labels of
the USR LED nodes from usrN to the trigger name

Normal labels:
  * beaglebone:green:usr0
  * beaglebone:green:usr1
  * beaglebone:green:usr2
  * beaglebone:green:usr3

Alternate labels:
  * beaglebone:green:heartbeat
  * beaglebone:green:mmc0
  * beaglebone:green:cpu0
  * beaglebone:green:mmc1

Related issue:
Doesn't support Ubuntu core beaglebone leds #129
https://github.com/adafruit/adafruit-beaglebone-io-python/issues/129
2017-01-09 02:11:20 +00:00
Drew Fustini
c27d805bf4 tidy up the the USR LED test 2017-01-09 02:10:04 +00:00
Drew Fustini
d6136bf639 refactor methods to test all LEDs 2017-01-08 10:01:01 +00:00
Drew Fustini
67e0f61f9c add PWM test for ecap0 (P9_42) and ecap2 (P9_28) 2016-12-20 10:26:19 +00:00
Matthew West
d80a6c99ba Fix 4.1+ bug with tests. 2016-08-10 13:40:50 -07:00
Matthew West
08ea892889 Add cleanup before each test, to avoid cascading failures due to already-setup pins
Reformat file
2016-08-10 09:07:40 -07:00
Matthew West
472e2f964d Fix PWM test failure on some Debian 8.5, Linux 4.4
https://github.com/adafruit/adafruit-beaglebone-io-python/pull/108#issuecomment-238785262
2016-08-10 09:00:41 -07:00
Matthew West
c459ff7751 Bring tests in line with Linux 4.1+ 2016-08-08 12:16:54 -07:00
Matthew West
cd2456b157 Fix PWM tests to reflect 4.1+ 2016-08-08 12:09:19 -07:00
Drew Fustini
76b3e78e18 Update ADC test to handle Linux 4.1+ kernel 2016-06-03 09:22:37 +00: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
Justin Cooper
25e654a982 fix for SPI not loading spidevX.X correctly based on load order 2014-05-23 03:22:48 +00: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
Chris Desjardins
2d9b9b3d1d Add new test case for 3 digit gpio 2013-08-08 13:00:39 +02:00
Justin Cooper
35d21db43e add simple uart test 2013-07-30 19:33:57 +00: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
5c09f8915a fix for ADC segmentation faults, bump to 0.0.9 2013-07-09 20:13:47 +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
bdafa9a6c5 working adc, remove cleanup, add read_raw 2000-01-01 03:57:40 +00:00
Justin Cooper
78610e35a2 clean up adc, and add test 2000-01-01 00:03:14 +00:00
Justin Cooper
579326dbd3 remove old test file 2013-06-12 04:45:57 +00:00
Justin Cooper
de8c79beeb tests for min and max duty cycles 2013-06-12 03:31:19 +00:00
Justin Cooper
780baf89e0 add tests to test for invalid pwm keys 2013-06-12 02:46:30 +00:00
Justin Cooper
d88138cfb8 pwm tests 2013-06-11 20:44:38 +00:00
Justin Cooper
9903992a5f add a few more tests for setup and output 2013-06-11 04:12:00 +00:00
Justin Cooper
1258c651cb Initial Commit 2013-06-10 20:16:39 +00:00