-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboot.py
More file actions
23 lines (20 loc) · 687 Bytes
/
boot.py
File metadata and controls
23 lines (20 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from board import *
import board
import digitalio
import storage
noStorage = False
noStoragePin = digitalio.DigitalInOut(GP18)
noStoragePin.switch_to_input(pull=digitalio.Pull.UP)
noStorageStatus = noStoragePin.value
if(board.board_id == 'raspberry_pi_pico'):
# On Pi Pico, default to USB visible unless GP18 is connected to GND
noStorage = not noStorageStatus
elif(board.board_id == 'raspberry_pi_pico_w'):
# On Pi Pico W, default to USB hidden, unless GP18 is connected to GND
noStorage = noStorageStatus
if(noStorage == True):
# don't show USB drive to host PC
storage.disable_usb_drive()
else:
# show USB drive to host PC
storage.enable_usb_drive()