Skip to content

Commit c444d06

Browse files
authored
Add deinit function
This might not be used a lot, but this helps in case you need to just load up one bit, and then load up another.
1 parent 491d0ee commit c444d06

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

adafruit_magtag/peripherals.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ def play_tone(self, frequency, duration):
8686
pass
8787
attempt += 1
8888
self._speaker_enable.value = False
89+
90+
def deinit(self):
91+
"""Call deinit on all resources to free them"""
92+
self.neopixels.deinit()
93+
self._neopixel_disable.deinit()
94+
self._speaker_enable.deinit()
95+
for button in self.buttons:
96+
button.deinit()
97+
self._batt_monitor.deinit()
98+
self._light.deinit()
8999

90100
@property
91101
def battery(self):

0 commit comments

Comments
 (0)