Skip to content

Commit

Permalink
updated docs and testrig tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Preston committed Oct 10, 2013
1 parent de8c726 commit 3631015
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
==========

Expand Down
12 changes: 12 additions & 0 deletions tests.testrig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3631015

Please sign in to comment.