mirror of
https://github.com/xtacocorex/CHIP_IO
synced 2025-07-20 04:43:21 +00:00
updates to the pytest tests to fix the issues with pwm, added 2 new tests that bring in 5 total unit tests. python3 unit tests are passing, this will close #42 and close #47
This commit is contained in:
36
test/integrations/omtest.py
Normal file
36
test/integrations/omtest.py
Normal file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import CHIP_IO.OverlayManager as OM
|
||||
import os
|
||||
|
||||
# ENABLE DEBUG
|
||||
print("ENABLING OVERLAY MANAGER DEBUG")
|
||||
OM.toggle_debug()
|
||||
|
||||
# **************** PWM *******************
|
||||
print("\nIS PWM ENABLED: {0}".format(OM.get_pwm_loaded()))
|
||||
OM.load("PWM0")
|
||||
print("IS PWM ENABLED: {0}".format(OM.get_pwm_loaded()))
|
||||
# VERIFY PWM0 EXISTS
|
||||
if os.path.exists('/sys/class/pwm/pwmchip0'):
|
||||
print("PWM DEVICE EXISTS")
|
||||
else:
|
||||
print("PWM DEVICE DID NOT LOAD PROPERLY")
|
||||
print("UNLOADING PWM0")
|
||||
OM.unload("PWM0")
|
||||
print("IS PWM ENABLED: {0}".format(OM.get_pwm_loaded()))
|
||||
|
||||
# **************** SPI2 *******************
|
||||
print("\nIS SPI ENABLED: {0}".format(OM.get_spi_loaded()))
|
||||
OM.load("SPI2")
|
||||
print("IS SPI ENABLED: {0}".format(OM.get_spi_loaded()))
|
||||
# VERIFY SPI2 EXISTS
|
||||
if os.listdir('/sys/class/spi_master') != "":
|
||||
print("SPI DEVICE EXISTS")
|
||||
else:
|
||||
print("SPI DEVICE DID NOT LOAD PROPERLY")
|
||||
print("UNLOADING SPI")
|
||||
OM.unload("SPI2")
|
||||
print("IS SPI ENABLED: {0}".format(OM.get_spi_loaded()))
|
||||
|
||||
|
Reference in New Issue
Block a user