Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ev3dev2/_platform/pistorms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
An assortment of classes modeling specific features of the PiStorms.
"""
from collections import OrderedDict
from evdev import InputDevice, list_devices

def find_filename(device_name):
for path in list_devices():
dev = InputDevice(path)
if device_name in dev.name:
return dev.fn

OUTPUT_A = 'pistorms:BAM1'
OUTPUT_B = 'pistorms:BAM2'
Expand All @@ -13,8 +20,8 @@
INPUT_3 = 'pistorms:BBS1'
INPUT_4 = 'pistorms:BBS2'

BUTTONS_FILENAME = '/dev/input/by-path/platform-3f804000.i2c-event'
EVDEV_DEVICE_NAME = 'PiStorms'
BUTTONS_FILENAME = find_filename(EVDEV_DEVICE_NAME)

LEDS = OrderedDict()
LEDS['red_left'] = 'pistorms:BB:red:brick-status'
Expand All @@ -38,3 +45,5 @@
LED_COLORS['MAGENTA'] = (1, 0, 1)

LED_DEFAULT_COLOR = 'GREEN'