def test_ADCConfigMethodReturnsCorrectConfigMask(self): lookup_table = [(0, 12, 0x90), (0, 14, 0x94), (0, 16, 0x98), (0, 18, 0x9C), (1, 12, 0xB0), (1, 14, 0xB4), (1, 16, 0xB8), (1, 18, 0xBC), (2, 12, 0xD0), (2, 14, 0xD4), (2, 16, 0xD8), (2, 18, 0xDC), (3, 12, 0xF0), (3, 14, 0xF4), (3, 16, 0xF8), (3, 18, 0xFC)] for i in range(0,2): for j in lookup_table: adc = PiADCInput([0], j[1]) self.assertEqual(j[2], adc._adcConfig(4*i + j[0])[1])
def test_ADCConfigMethodReturnsCorrectConfigMask(self): lookup_table = [(0, 12, 0x90), (0, 14, 0x94), (0, 16, 0x98), (0, 18, 0x9C), (1, 12, 0xB0), (1, 14, 0xB4), (1, 16, 0xB8), (1, 18, 0xBC), (2, 12, 0xD0), (2, 14, 0xD4), (2, 16, 0xD8), (2, 18, 0xDC), (3, 12, 0xF0), (3, 14, 0xF4), (3, 16, 0xF8), (3, 18, 0xFC)] for i in range(0, 2): for j in lookup_table: adc = PiADCInput([0], j[1]) self.assertEqual(j[2], adc._adcConfig(4 * i + j[0])[1])
def test_ADCConfigMethodReturnsCorrectAddresses(self): lookup_table = [0x68, 0x68, 0x68, 0x68, 0x69, 0x69, 0x69, 0x69] adc = PiADCInput([0], 12) for i in range(0, len(lookup_table)): self.assertEqual(lookup_table[i], adc._adcConfig(i)[0])