def setup_captouch(): global _captouch_is_setup, has_captouch, _cap1208 if _captouch_is_setup: return has_captouch _captouch_is_setup = True try: _cap1208 = Cap1208() has_captouch = True except IOError: has_captouch = False return has_captouch
except AttributeError: pass print("Stopping user tasks...") async_stop_all() print("Cleaning up...") GPIO.cleanup() print("Goodbye!") GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) _cap1208 = Cap1208() if not _cap1208._get_product_id() == CAP_PRODUCT_ID: exit("Explorer HAT not found...\nHave you enabled i2c?") import analog as _analog if _analog.adc_available: print("Explorer HAT Pro detected...") explorer_pro = True else: print("Explorer HAT Basic detected...") print("If this is incorrect, please check your i2c settings!") explorer_pro = False atexit.register(explorerhat_exit) try: