boot.py
 1  # SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  """CircuitPython Essentials Storage logging boot.py file"""
 6  import board
 7  import digitalio
 8  import storage
 9  
10  # For Gemma M0, Trinket M0, Metro M0/M4 Express, ItsyBitsy M0/M4 Express
11  switch = digitalio.DigitalInOut(board.D2)
12  
13  # For Feather M0/M4 Express
14  # switch = digitalio.DigitalInOut(board.D5)
15  
16  # For Circuit Playground Express, Circuit Playground Bluefruit
17  # switch = digitalio.DigitalInOut(board.D7)
18  
19  switch.direction = digitalio.Direction.INPUT
20  switch.pull = digitalio.Pull.UP
21  
22  # If the switch pin is connected to ground CircuitPython can write to the drive
23  storage.remount("/", switch.value)