mirror of
https://github.com/xtacocorex/CHIP_IO
synced 2025-07-20 12:53:22 +00:00
Fixed softpwm bug ("disable" code didn't synchronize thread exit)
This commit is contained in:
@ -1,2 +1,2 @@
|
||||
<EFBFBD>}q(Utest_softpwm_setup]q(Uteardown_moduleqUTestSoftpwmSetupqeUtest_gpio_output]q(hUTestGPIOOutputqeUtest_pwm_setup]q(hUTestPwmSetupqeUtest_gpio_setup]q (hU TestSetupq
|
||||
eUtest_gpio_input]q(hU
|
||||
eUtest_gpio_input]q(hU
|
@ -239,4 +239,3 @@ GPIO.cleanup()
|
||||
|
||||
mystr = "DONE: %d ERRORS" % num_errs
|
||||
print(mystr)
|
||||
|
||||
|
@ -15,7 +15,7 @@ class TestGPIOInput:
|
||||
#value read from the file will have a \n new line
|
||||
value = open('/sys/class/gpio/gpio138/value').read()
|
||||
assert int(value) == input_value
|
||||
time.sleep(30)
|
||||
# time.sleep(30) - what is this for?
|
||||
GPIO.cleanup()
|
||||
|
||||
def test_direction_readback(self):
|
||||
|
@ -1,11 +1,12 @@
|
||||
import pytest
|
||||
import os
|
||||
|
||||
import CHIP_IO.GPIO as GPIO
|
||||
|
||||
|
||||
def teardown_module(module):
|
||||
GPIO.cleanup()
|
||||
|
||||
|
||||
class TestGPIOOutput:
|
||||
def test_output_high(self):
|
||||
GPIO.setup("CSID6", GPIO.OUT)
|
||||
@ -25,6 +26,7 @@ class TestGPIOOutput:
|
||||
GPIO.setup("CSID6", GPIO.OUT)
|
||||
direction = GPIO.gpio_function("CSID6")
|
||||
assert direction == GPIO.OUT
|
||||
GPIO.cleanup()
|
||||
|
||||
def test_output_greater_than_one(self):
|
||||
GPIO.setup("CSID6", GPIO.OUT)
|
||||
|
@ -2,18 +2,21 @@ import pytest
|
||||
import os
|
||||
|
||||
import CHIP_IO.SOFTPWM as PWM
|
||||
import CHIP_IO.GPIO as GPIO
|
||||
|
||||
|
||||
def teardown_module(module):
|
||||
PWM.cleanup()
|
||||
|
||||
|
||||
class TestSoftpwmSetup:
|
||||
def test_start_pwm(self):
|
||||
PWM.start("XIO-P7", 50, 10)
|
||||
base = GPIO.get_gpio_base() + 7
|
||||
gfile = '/sys/class/gpio/gpio%d' % base
|
||||
assert os.path.exists(base)
|
||||
direction = open(base + '/direction').read()
|
||||
assert direction == 'out\n'
|
||||
assert os.path.exists(gfile)
|
||||
direction = open(gfile + '/direction').read()
|
||||
assert(direction == 'out\n')
|
||||
PWM.cleanup()
|
||||
|
||||
def test_pwm_start_invalid_pwm_key(self):
|
||||
@ -25,12 +28,12 @@ class TestSoftpwmSetup:
|
||||
PWM.start("XIO-P7", -1)
|
||||
|
||||
def test_pwm_start_valid_duty_cycle_min(self):
|
||||
#testing an exception isn't thrown
|
||||
# testing an exception isn't thrown
|
||||
PWM.start("XIO-P7", 0)
|
||||
PWM.cleanup()
|
||||
|
||||
def test_pwm_start_valid_duty_cycle_max(self):
|
||||
#testing an exception isn't thrown
|
||||
# testing an exception isn't thrown
|
||||
PWM.start("XIO-P7", 100)
|
||||
PWM.cleanup()
|
||||
|
||||
|
Reference in New Issue
Block a user