當前位置: 首頁>>代碼示例>>Python>>正文


Python PWM.cleanup方法代碼示例

本文整理匯總了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()
開發者ID:aninternetof,項目名稱:CHIP_IO,代碼行數:13,代碼來源:test_pwm_setup.py

示例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"
開發者ID:vagelim,項目名稱:CHIP_IO,代碼行數:14,代碼來源:test_pwm_setup.py

示例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()
開發者ID:aninternetof,項目名稱:CHIP_IO,代碼行數:15,代碼來源:test_pwm_setup.py

示例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()
開發者ID:HeatfanJohn,項目名稱:CHIP_IO,代碼行數:15,代碼來源:test_pwm_setup.py

示例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()
開發者ID:HeatfanJohn,項目名稱:CHIP_IO,代碼行數:19,代碼來源:test_pwm_setup.py

示例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()
開發者ID:aninternetof,項目名稱:CHIP_IO,代碼行數:6,代碼來源:test_pwm_setup.py

示例7: teardown_module

# 需要導入模塊: from CHIP_IO import PWM [as 別名]
# 或者: from CHIP_IO.PWM import cleanup [as 別名]
def teardown_module(module):
    PWM.cleanup()
開發者ID:aninternetof,項目名稱:CHIP_IO,代碼行數:4,代碼來源:test_pwm_setup.py

示例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()
開發者ID:aninternetof,項目名稱:CHIP_IO,代碼行數:6,代碼來源:test_pwm_setup.py

示例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()
開發者ID:aninternetof,項目名稱:CHIP_IO,代碼行數:7,代碼來源:test_pwm_setup.py

示例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()
開發者ID:aninternetof,項目名稱:CHIP_IO,代碼行數:7,代碼來源:test_pwm_setup.py

示例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()
開發者ID:aninternetof,項目名稱:CHIP_IO,代碼行數:7,代碼來源:test_pwm_setup.py

示例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()
開發者ID:aninternetof,項目名稱:CHIP_IO,代碼行數:7,代碼來源:test_pwm_setup.py

示例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()
開發者ID:aninternetof,項目名稱:CHIP_IO,代碼行數:6,代碼來源:test_pwm_setup.py

示例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()
開發者ID:aninternetof,項目名稱:CHIP_IO,代碼行數:6,代碼來源:test_pwm_setup.py

示例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")
開發者ID:vagelim,項目名稱:CHIP_IO,代碼行數:6,代碼來源:test_pwm_setup.py


注:本文中的CHIP_IO.PWM.cleanup方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。