2023-01-11 15:33:01 +00:00
|
|
|
#!/usr/bin/env python
|
2023-03-02 22:52:52 +00:00
|
|
|
import hid_test # type: ignore
|
2022-10-24 15:05:00 +00:00
|
|
|
import time
|
|
|
|
|
2022-10-25 12:18:04 +00:00
|
|
|
|
2023-03-02 22:52:52 +00:00
|
|
|
def reset_tk1() -> None:
|
|
|
|
""" Reset a TK1 contained in a TP1 programmer
|
|
|
|
|
|
|
|
Manipulate the GPIO lines on the TP1 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.
|
|
|
|
"""
|
2022-10-24 15:05:00 +00:00
|
|
|
d = hid_test.ice40_flasher()
|
|
|
|
d.gpio_set_direction(14, True)
|
|
|
|
d.gpio_put(14, False)
|
|
|
|
d.gpio_set_direction(14, False)
|
|
|
|
d.close()
|
|
|
|
|
2023-03-02 22:52:52 +00:00
|
|
|
|
2022-10-25 12:18:04 +00:00
|
|
|
reset_tk1()
|