Skip to content

Commit f1cc98b

Browse files
authored
Deinitialize hardware peripherals when exiting application
1 parent 423a707 commit f1cc98b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

code.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ async def keyboard_task() -> None:
9090
while (c := supervisor.runtime.serial_bytes_available) > 0:
9191
key = sys.stdin.read(c)
9292
if key == "\x1b": # escape
93+
peripherals.deinit()
9394
supervisor.reload()
9495
await asyncio.sleep(1/30)
9596

@@ -102,5 +103,4 @@ async def main() -> None:
102103
try:
103104
asyncio.run(main())
104105
except KeyboardInterrupt:
105-
# TODO: Deinit
106-
pass
106+
peripherals.deinit()

0 commit comments

Comments
 (0)