Skip to content

Commit 2b1c20a

Browse files
authored
Merge pull request #56 from KTibow/patch-2
Add deinit function
2 parents 491d0ee + 54c06b5 commit 2b1c20a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

adafruit_magtag/peripherals.py

+10
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ def play_tone(self, frequency, duration):
8787
attempt += 1
8888
self._speaker_enable.value = False
8989

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()
99+
90100
@property
91101
def battery(self):
92102
"""Return the voltage of the battery"""

0 commit comments

Comments
 (0)