aboutsummaryrefslogtreecommitdiffstats
path: root/roles/serial/files
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2020-11-10 20:46:04 +0100
committerbinary <me@rgoncalves.se>2020-11-10 20:46:04 +0100
commit0a673e300800b91342499cec9cd482b5d2d9c603 (patch)
tree752309b2f30928063340afefe39682679491a451 /roles/serial/files
parent89c7516b1f9ec4ce7ce2947f98f2070c242f4459 (diff)
downloadinfrastructure-0a673e300800b91342499cec9cd482b5d2d9c603.tar.gz
Fully working init for alpine vm
Diffstat (limited to 'roles/serial/files')
-rw-r--r--roles/serial/files/serial_macro.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/roles/serial/files/serial_macro.py b/roles/serial/files/serial_macro.py
new file mode 100644
index 0000000..eb47226
--- /dev/null
+++ b/roles/serial/files/serial_macro.py
@@ -0,0 +1,14 @@
+#!/bin/python3
+
+import serial
+import time
+
+
+def send_cmd(ser, delay, cmd):
+ ser.write(f"{cmd}\n".encode("utf-8"))
+ time.sleep(delay)
+
+def send_cmds(ser, cmds):
+ for cmd in cmds:
+ send_cmd(ser, cmd[0], cmd[1])
+
remember that computers suck.