/ CLUE_Light_Painter / boot.py
boot.py
1 # SPDX-FileCopyrightText: 2020 Phillip Burgess for Adafruit Industries 2 # 3 # SPDX-License-Identifier: MIT 4 5 """ 6 Check for connection between pin and GND on hard boot (power-on or reset). 7 If NO connection: storage is remounted as read/write so the light painter 8 code can run (it requires temporary files), but code.py can't be edited. 9 If connected: storage is left in read-only mode. Light painter code can't 10 run but files are editable. 11 """ 12 13 # pylint: disable=import-error 14 import board 15 import digitalio 16 import storage 17 18 PIN = board.D0 19 20 IO = digitalio.DigitalInOut(PIN) 21 IO.direction = digitalio.Direction.INPUT 22 IO.pull = digitalio.Pull.UP 23 24 if IO.value: # No connection 25 storage.remount('/', False) # Remount storage as read/write for painter