mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2024-10-01 01:45:38 -04:00
Make hid_test fail less confusingly when programming device is not connected
Add requirements.txt
This commit is contained in:
parent
48f32949bc
commit
7af0fc6777
@ -9,8 +9,11 @@ USB_VID = 0xcafe
|
||||
|
||||
class ice40_flasher:
|
||||
def __init__(self):
|
||||
self.dev = None
|
||||
for dict in hid.enumerate(USB_VID):
|
||||
self.dev = hid.Device(dict['vendor_id'], dict['product_id'])
|
||||
if self.dev is None:
|
||||
raise IOError("Couldn't find any hid device with vendor id 0x%x" % (USB_VID))
|
||||
|
||||
def close(self):
|
||||
self.dev.close()
|
||||
|
4
hw/boards/mta1-usb-v1/test/requirements.txt
Normal file
4
hw/boards/mta1-usb-v1/test/requirements.txt
Normal file
@ -0,0 +1,4 @@
|
||||
hid==1.0.5
|
||||
numpy==1.23.4
|
||||
pyserial==3.5
|
||||
pyusb==1.2.1
|
@ -2,12 +2,15 @@
|
||||
import hid_test
|
||||
import time
|
||||
|
||||
def reset_mta1():
|
||||
""" Manipulate the GPIO lines on the MTA1-USB-CH552 Programmer to issue a hardware reset to the MTA1 """
|
||||
|
||||
def reset_tk1():
|
||||
"""Manipulate the GPIO lines on the MTA1-USB-CH552 Programmer to issue a
|
||||
hardware reset to the TK1. The result is that TK1 again will be in firmware
|
||||
mode, so a new app can be loaded."""
|
||||
d = hid_test.ice40_flasher()
|
||||
d.gpio_set_direction(14, True)
|
||||
d.gpio_put(14, False)
|
||||
d.gpio_set_direction(14, False)
|
||||
d.close()
|
||||
|
||||
reset_mta1()
|
||||
reset_tk1()
|
||||
|
Loading…
Reference in New Issue
Block a user