def __init__(self): self.swdio_pin = cfg.pins.swdio self.rst_pin = cfg.pins.rst self.swo_pin = cfg.pins.swo self.clk_pin = cfg.pins.swclk self.pwr_pin = cfg.pins.pwr self.mount_path = None self.device_name = None self.device_path = None self.swdio = iodevice(self.swdio_pin, iostate.Float) self.rst = iodevice(self.rst_pin, iostate.Float) self.swo = iodevice(self.swo_pin, iostate.Float) self.clk = iodevice(self.clk_pin, iostate.Float) self.pwr = iodevice(self.pwr_pin, iostate.Input, None, False)
def test_float(self): io = iodevice(16, iostate.Float) self.assertIsNotNone(io)
def test_float_to_output(self): io = iodevice(16, iostate.Float) io.outputMode(False) self.assertEqual(io.mode, iostate.Output) self.assertEqual(io.value(), False)
def test_input(self): io = iodevice(16, iostate.Input) self.assertIsNotNone(io)
def test_float_to_input(self): io = iodevice(16, iostate.Float) io.inputMode() self.assertEqual(io.mode, iostate.Input)
def test_output_to_float(self): io = iodevice(16, iostate.Output, None, False, None, None, True, False) io.close() self.assertEqual(io.mode, iostate.Float)
def test_output_to_input(self): io = iodevice(16, iostate.Output, None, False, None, None, True, True) io.inputMode() self.assertEqual(io.mode, iostate.Input)
def test_input_to_output(self): io = iodevice(16, iostate.Input) io.outputMode(True) self.assertEqual(io.mode, iostate.Output) self.assertEqual(io.value(), True)
def test_output_high(self): io = iodevice(16, iostate.Output, None, False, None, None, True, True) self.assertIsNotNone(io) self.assertEqual(io.mode, iostate.Output) self.assertEqual(io.value(), True)