ov2640_jpeg_kaluga1_3_boot.py
1 # SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries 2 # SPDX-FileCopyrightText: Copyright (c) 2021 Jeff Epler for Adafruit Industries 3 # 4 # SPDX-License-Identifier: Unlicense 5 """Use this file as CIRCUITPY/boot.py in conjunction with ov2640_jpeg_kaluga1_3.py 6 7 It makes the CIRCUITPY filesystem writable to CircuitPython 8 (and read-only to the PC) unless the "MODE" button on the audio 9 daughterboard is held while the board is powered on or reset. 10 """ 11 12 import analogio 13 import board 14 import storage 15 16 V_MODE = 1.98 17 V_RECORD = 2.41 18 19 a = analogio.AnalogIn(board.IO6) 20 a_voltage = a.value * a.reference_voltage / 65535 # pylint: disable=no-member 21 if abs(a_voltage - V_MODE) > 0.05: # If mode is NOT pressed... 22 print("storage writable by CircuitPython") 23 storage.remount("/", readonly=False)