Exemplo n.º 1
0
    def test_adc_stop(self):
        SensorManager.mux_select(ADC)
        SensorManager.stop_adc_sensor(ADC)
        SensorManager.mux_select(ADC)
        SensorManager.init_adc(ADC)
        addr = SensorEntropy.addr(ADC)
        adc_reg = SensorEntropy.reg(ADC)
        bus = SensorManager.bus

        config = bus.read_byte_data(addr, adc_reg['CONFIG_REG'])
        self.assertEqual(config, 0x00)
Exemplo n.º 2
0
    def test_adc_init(self):
        SensorManager.mux_select(ADC)
        SensorManager.init_adc(ADC)
        addr = SensorEntropy.addr(ADC)
        adc_reg = SensorEntropy.reg(ADC)
        bus = SensorManager.bus

        config = bus.read_byte_data(addr, adc_reg['CONFIG_REG'])
        mode = bus.read_byte_data(addr, adc_reg['ADV_CONFIG_REG'])
        conv = bus.read_byte_data(addr, adc_reg['CONV_RATE_REG'])
        ch = bus.read_byte_data(addr, adc_reg['CHANNEL_DISABLE_REG'])
        limits = bus.read_byte_data(addr, adc_reg['LIMIT_REG_BASE'])

        self.assertEqual(config, 0x01)
        self.assertEqual(mode, 0x04)
        self.assertEqual(conv, 0x01)
        self.assertEqual(ch, 0x00)
        self.assertEqual(limits, 0x05)