mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-12-03 07:04:02 +08:00
1e15ec1949
My editor likes to pep8 as I edit, and I'm tired of carefully not committing those changes. Acked-by: Juan A. Suarez <jasuarez@igalia.com> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17096>
20 lines
352 B
Python
Executable File
20 lines
352 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import sys
|
|
import serial
|
|
|
|
mode = sys.argv[1]
|
|
relay = sys.argv[2]
|
|
|
|
# our relays are "off" means "board is powered".
|
|
mode_swap = {
|
|
"on": "off",
|
|
"off": "on",
|
|
}
|
|
mode = mode_swap[mode]
|
|
|
|
ser = serial.Serial('/dev/ttyACM0', 115200, timeout=2)
|
|
command = "relay {} {}\n\r".format(mode, relay)
|
|
ser.write(command.encode())
|
|
ser.close()
|