mirror of
				https://github.com/KevinMidboe/python-gpiozero.git
				synced 2025-10-29 17:50:37 +00:00 
			
		
		
		
	Ensure GPIO.cleanup is called
Small patch to ensure GPIO.cleanup is always called on interpreter shutdown. This just means the library will "play nice" with whatever comes afterward.
This commit is contained in:
		| @@ -1,6 +1,14 @@ | ||||
| from __future__ import absolute_import | ||||
|  | ||||
| import atexit | ||||
|  | ||||
| from RPi import GPIO | ||||
|  | ||||
|  | ||||
| def gpiozero_shutdown(): | ||||
|     GPIO.cleanup() | ||||
|  | ||||
| atexit.register(gpiozero_shutdown) | ||||
| GPIO.setmode(GPIO.BCM) | ||||
| GPIO.setwarnings(False) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user