예제 #1
0
    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)
예제 #2
0
 def test_float(self):
     io = iodevice(16, iostate.Float)
     self.assertIsNotNone(io)
예제 #3
0
 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)
예제 #4
0
 def test_input(self):
     io = iodevice(16, iostate.Input)
     self.assertIsNotNone(io)
예제 #5
0
 def test_float_to_input(self):
     io = iodevice(16, iostate.Float)
     io.inputMode()
     self.assertEqual(io.mode, iostate.Input)
예제 #6
0
 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)
예제 #7
0
 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)
예제 #8
0
 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)
예제 #9
0
 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)