def test_setup_adc(self): ADC.setup() files = os.listdir('/sys/devices') ocp = '/sys/devices/'+[s for s in files if s.startswith('ocp')][0] files = os.listdir(ocp) helper_path = ocp+'/'+[s for s in files if s.startswith('helper')][0] assert os.path.exists(helper_path + "/AIN1")
def test_read_raw_adc(self): ADC.setup() value = -1 value = ADC.read_raw("P9_40") assert value != -1
def test_read_raw_adc_no_setup(self): with pytest.raises(RuntimeError): ADC.read_raw("P9_40")