本文整理汇总了Python中CHIP_IO.PWM.cleanup方法的典型用法代码示例。如果您正苦于以下问题:Python PWM.cleanup方法的具体用法?Python PWM.cleanup怎么用?Python PWM.cleanup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHIP_IO.PWM
的用法示例。
在下文中一共展示了PWM.cleanup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_start_pwm
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
def test_start_pwm(self):
PWM.start("PWM0", 0)
pwm_test = '/sys/class/pwm/pwmchip0/pwm0'
assert os.path.exists(pwm_test)
duty = open(pwm_test + '/duty_cycle').read()
period = open(pwm_test + '/period').read()
assert int(duty) == 0
assert int(period) == 500000
PWM.cleanup()
示例2: test_start_pwm_with_polarity_zero
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
def test_start_pwm_with_polarity_zero(self):
PWM.cleanup()
PWM.start("PWM0", 0, 2000, 0)
pwm_test = '/sys/class/pwm/pwmchip0/pwm0/'
duty = open(pwm_test + 'duty_cycle').readline().strip()
period = open(pwm_test + 'period').readline().strip()
polarity = open(pwm_test + 'polarity').readline().strip()
assert int(duty) == 0
assert int(period) == 500000
assert str(polarity) == "normal"
示例3: test_start_pwm_with_polarity_zero
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
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)
duty = open(pwm_test + '/duty_cycle').read()
period = open(pwm_test + '/period').read()
polarity = open(pwm_test + '/polarity').read()
assert int(duty) == 0
assert int(period) == 500000
assert string(polarity) == "normal"
PWM.cleanup()
示例4: test_start_pwm_with_polarity_one
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
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)
duty = open(pwm_test + '/duty_cycle').readline().strip()
period = open(pwm_test + '/period').readline().strip()
polarity = open(pwm_test + '/polarity').readline().strip()
assert int(duty) == 0
assert int(period) == 500000
assert str(polarity) == "inverted"
PWM.cleanup()
示例5: test_pwm_duty_modified
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
def test_pwm_duty_modified(self):
PWM.start("PWM0", 0)
pwm_test = '/sys/class/pwm/pwmchip0/pwm0'
assert os.path.exists(pwm_test)
duty = open(pwm_test + '/duty_cycle').readline().strip()
period = open(pwm_test + '/period').readline().strip()
assert int(duty) == 0
assert int(period) == 500000
PWM.set_duty_cycle("PWM0", 100)
duty = open(pwm_test + '/duty_cycle').readline().strip()
period = open(pwm_test + '/period').readline().strip()
assert int(duty) == 500000
assert int(period) == 500000
PWM.cleanup()
示例6: test_pwm_start_valid_duty_cycle_max
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
def test_pwm_start_valid_duty_cycle_max(self):
#testing an exception isn't thrown
PWM.start("PWM0", 100)
PWM.cleanup()
示例7: teardown_module
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
def teardown_module(module):
PWM.cleanup()
示例8: test_pwm_freq_non_setup_key
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
def test_pwm_freq_non_setup_key(self):
with pytest.raises(ValueError):
PWM.set_frequency("P9_15", 100)
PWM.cleanup()
示例9: test_pwm_frequency_invalid_value_string
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
def test_pwm_frequency_invalid_value_string(self):
PWM.start("PWM0", 0)
with pytest.raises(TypeError):
PWM.set_frequency("PWM0", "11")
PWM.cleanup()
示例10: test_pwm_frequency_invalid_value_negative
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
def test_pwm_frequency_invalid_value_negative(self):
PWM.start("PWM0", 0)
with pytest.raises(ValueError):
PWM.set_frequency("PWM0", -1)
PWM.cleanup()
示例11: test_pwm_duty_cycle_invalid_value_string
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
def test_pwm_duty_cycle_invalid_value_string(self):
PWM.start("PWM0", 0)
with pytest.raises(TypeError):
PWM.set_duty_cycle("PWM0", "a")
PWM.cleanup()
示例12: test_pwm_duty_cycle_invalid_value_negative
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
def test_pwm_duty_cycle_invalid_value_negative(self):
PWM.start("PWM0", 0)
with pytest.raises(ValueError):
PWM.set_duty_cycle("PWM0", -1)
PWM.cleanup()
示例13: test_pwm_duty_cycle_invalid_key
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
def test_pwm_duty_cycle_invalid_key(self):
with pytest.raises(ValueError):
PWM.set_duty_cycle("P9_15", 100)
PWM.cleanup()
示例14: test_pwm_duty_cycle_non_setup_key
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
def test_pwm_duty_cycle_non_setup_key(self):
with pytest.raises(RuntimeError):
PWM.set_duty_cycle("PWM0", 100)
PWM.cleanup()
示例15: teardown_module
# 需要导入模块: from CHIP_IO import PWM [as 别名]
# 或者: from CHIP_IO.PWM import cleanup [as 别名]
def teardown_module(module):
PWM.cleanup()
if not UT.is_chip_pro():
OM.unload("PWM0")