Skip to content

Commit f5a2887

Browse files
committed
Grounding GP0 on boot removes CDC and MSC devices
1 parent bff94f7 commit f5a2887

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pico/boot.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""
2+
boot.py file for Pico data logging example. If pin GP0 is connected to GND when
3+
the pico starts up, make the filesystem writeable by CircuitPython.
4+
"""
5+
import board
6+
import digitalio
7+
import storage
8+
from buttons import btns, pins
9+
10+
print(f"Checking if btn[0]={pins[0]} is pressed.")
11+
12+
# If write pin is connected to ground on start-up, CircuitPython can write to CIRCUITPY filesystem.
13+
if not btns[0].value:
14+
print("Mounting as read-only for host! Disabling storage and serial port.")
15+
storage.remount("/", readonly=False)
16+
storage.disable_usb_drive()
17+
usb_cdc.disable()
18+
else:
19+
print("Not pressed. Starting in RW mode.")

0 commit comments

Comments
 (0)