summaryrefslogtreecommitdiff
path: root/digital
diff options
context:
space:
mode:
authorNicolas Schodet2013-04-15 23:44:37 +0200
committerNicolas Schodet2013-04-15 23:44:37 +0200
commitfe3a6c40aa7ccb7ea9d2ff0594252575b1bcddb8 (patch)
tree1bbdb87c4894adcd048faea9c6f7109648697b13 /digital
parentc0e163d199f7bdc55b0286e3ed12e8137ae8cc7a (diff)
digital/io-hub/tools: add pressure set UI
Diffstat (limited to 'digital')
-rw-r--r--digital/io-hub/tools/io_hub/io_hub.py3
-rw-r--r--digital/io-hub/tools/ui_apbirthday.py22
2 files changed, 24 insertions, 1 deletions
diff --git a/digital/io-hub/tools/io_hub/io_hub.py b/digital/io-hub/tools/io_hub/io_hub.py
index d5ae8271..bbd8952b 100644
--- a/digital/io-hub/tools/io_hub/io_hub.py
+++ b/digital/io-hub/tools/io_hub/io_hub.py
@@ -61,6 +61,9 @@ class Proto:
def output_transient (self, mask, duration):
self.proto.send ('o', 'LH', mask, duration)
+ def pressure (self, val):
+ self.proto.send ('f', 'H', val)
+
def close (self):
self.reset ()
self.proto.wait (lambda: True)
diff --git a/digital/io-hub/tools/ui_apbirthday.py b/digital/io-hub/tools/ui_apbirthday.py
index fa3afc32..bbca9d6b 100644
--- a/digital/io-hub/tools/ui_apbirthday.py
+++ b/digital/io-hub/tools/ui_apbirthday.py
@@ -52,7 +52,7 @@ class InterAPBirthday (Frame):
Button (self, text = 'Reset', command = self.reset).pack ()
# Outputs.
output_frame = Frame (self)
- output_frame.pack ()
+ output_frame.pack (side = LEFT, fill = Y)
def make_setreset (index):
def setreset ():
val = self.output_var[index].get ()
@@ -96,6 +96,25 @@ class InterAPBirthday (Frame):
button.grid (column = 1, row = i - 1, rowspan = 2,
sticky = 'nsew')
previous = name
+ # Misc.
+ misc_frame = Frame (self)
+ misc_frame.pack (side = LEFT, fill = Y)
+ # Pressure.
+ frame = LabelFrame (misc_frame, text = 'Pressure')
+ frame.pack ()
+ def pressure_update (val):
+ pressure_scale.configure (label = hex (int (val)))
+ pressure_max = 4096
+ pressure_scale = Scale (frame, from_ = 0, to = pressure_max -
+ pressure_max / 16, resolution = pressure_max / 32,
+ orient = HORIZONTAL, showvalue = 0, command = pressure_update)
+ pressure_scale.pack ()
+ pressure_scale.set (0x0c00)
+ def pressure_set ():
+ val = pressure_scale.get ()
+ self.io.pressure (val)
+ button = Button (frame, text = 'Set', command = pressure_set)
+ button.pack ()
def reset (self):
mask = 0
@@ -103,6 +122,7 @@ class InterAPBirthday (Frame):
self.output_var[i].set (0)
mask |= 1 << i
self.io.output (mask, 'clear')
+ self.io.pressure (0)
if __name__ == '__main__':
app = InterAPBirthday ()