boot.py
 1  # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
 2  # SPDX-License-Identifier: MIT
 3  """
 4  CircuitPython Essentials Storage CP Filesystem boot.py file
 5  
 6  REMOVE THIS LINE AND ALL TEXT BELOW BEFORE SUBMITTING TO GITHUB.
 7  There are three things to be updated in this file to match your board:
 8  * Update OBJECT_NAME to match the physical thing you are using, e.g. button or pin.
 9  * Update OBJECT_PIN to match the pin name to which the button or pin is attached.
10  * Update UP_OR_DOWN to match the Pull necessary for the chosen pin.
11  
12  For example:
13  If using the up button on a FunHouse, update OBJECT_NAME to button, and OBJECT_PIN to BUTTON_UP.
14  If using pin A0 on a Feather RP2040, update OBJECT_NAME to pin, and OBJECT_PIN to A0.
15  
16  For example:
17  If using the up button on a FunHouse, update UP_OR_DOWN to DOWN.
18  IF using pin A0 on a Feather RP2040, update UP_OR_DOWN to UP.
19  """
20  import board
21  import digitalio
22  import storage
23  
24  OBJECT_NAME = digitalio.DigitalInOut(board.OBJECT_PIN)
25  OBJECT_NAME.switch_to_input(pull=digitalio.Pull.UP_OR_DOWN)
26  
27  # If the OBJECT_NAME is connected to ground, the filesystem is writable by CircuitPython
28  storage.remount("/", readonly=OBJECT_NAME.value)