/ EInk_Autostereograms / boot.py
boot.py
1 # SPDX-FileCopyrightText: 2019 Anne Barela for Adafruit Industries 2 # 3 # SPDX-License-Identifier: MIT 4 5 import board 6 import storage 7 from analogio import AnalogIn 8 9 def read_buttons(): 10 with AnalogIn(board.A3) as ain: 11 reading = ain.value / 65535 12 if reading > 0.75: 13 return None 14 if reading > 0.4: 15 return 4 16 if reading > 0.25: 17 return 3 18 if reading > 0.13: 19 return 2 20 return 1 21 22 readonly = True 23 # if a button is pressed while booting up, CircuitPython can write to the drive 24 button = read_buttons() 25 if button != None: 26 readonly = False 27 if readonly: 28 print("OS has write access to CircuitPython drive") 29 else: 30 print("CircuitPython has write access to drive") 31 storage.remount("/", readonly)