From 36310154068e6ee3768bebda831e70a4a27d3fcb Mon Sep 17 00:00:00 2001 From: Thomas Preston Date: Thu, 10 Oct 2013 12:38:30 +0100 Subject: [PATCH] updated docs and testrig tests --- docs/example.rst | 2 ++ tests.testrig.py | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/docs/example.rst b/docs/example.rst index 9efcbe1..bd8d185 100644 --- a/docs/example.rst +++ b/docs/example.rst @@ -48,6 +48,8 @@ Here are some functions you might want to use if objects aren't your thing:: >>> p.digital_read(2, 3) # reads pin2 (on board3) 1 +.. note: These are just wrappers around the PiFaceDigital object. + Interrupts ========== diff --git a/tests.testrig.py b/tests.testrig.py index 5a9de8b..a91bb18 100644 --- a/tests.testrig.py +++ b/tests.testrig.py @@ -91,6 +91,15 @@ def test_output_port(self): pfd.output_port.all_off() self.assertEqual(pfd.output_port.value, 0) + def test_digital_write(self): + global pifacedigitals + for pfd in pifacedigitals: + for pin in range(8): + pifacedigitalio.digital_write(pin, 1, pfd.hardware_addr) + self.assertEqual(pfd.output_port.bits[pin].value, 1) + pifacedigitalio.digital_write(pin, 0, pfd.hardware_addr) + self.assertEqual(pfd.output_port.bits[pin].value, 0) + # def tearDown(self): # pifacedigitalio.deinit() @@ -126,6 +135,9 @@ def test_switches(self): # while we're here, test the input pins self.assertEqual(pfd.input_pins[a].value, 1) + self.assertEqual( + pifacedigitalio.digital_read(a, pfd.hardware_addr), + 1) self.assertEqual(pfd.input_pins[b].value, 1) # and the input port