mirror of
https://github.com/xtacocorex/CHIP_IO
synced 2025-07-20 04:43:21 +00:00
Initial commit, working GPIO for all available CHIP GPIO pins, have not tested edge detection and callbacks
This commit is contained in:
24
test/test_gpio_input.py
Executable file
24
test/test_gpio_input.py
Executable file
@ -0,0 +1,24 @@
|
||||
import pytest
|
||||
import os
|
||||
import time
|
||||
|
||||
import CHIP_IO.GPIO as GPIO
|
||||
|
||||
def teardown_module(module):
|
||||
GPIO.cleanup()
|
||||
|
||||
class TestGPIOInput:
|
||||
def test_input(self):
|
||||
GPIO.setup("CSID6", GPIO.IN)
|
||||
#returned as an int type
|
||||
input_value = GPIO.input("CSID6")
|
||||
#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)
|
||||
GPIO.cleanup()
|
||||
|
||||
def test_direction_readback(self):
|
||||
GPIO.setup("CSID6", GPIO.IN)
|
||||
direction = GPIO.gpio_function("CSID6")
|
||||
assert direction == GPIO.IN
|
Reference in New Issue
Block a user