mirror of
https://github.com/dbisu/pico-ducky.git
synced 2025-12-06 02:41:45 +00:00
Pico W Support (#137)
* Refactor code to support Pico W board * Updates for Pico W support * Update based on changes in CircuitPython v8.0.0 beta 6 * Updated bundle download to 8.x, fixed a few typos * Updating documentation for web interface * Update support for CircuitPython 8.0.0, fix many bugs * Document multiple payload options * Update copyright dates * Fixed typo
This commit is contained in:
31
boot.py
31
boot.py
@@ -1,13 +1,38 @@
|
||||
# License : GPLv2.0
|
||||
# copyright (c) 2023 Dave Bailey
|
||||
# Author: Dave Bailey (dbisu, @daveisu)
|
||||
# Pico and Pico W board support
|
||||
|
||||
from board import *
|
||||
import board
|
||||
import digitalio
|
||||
import storage
|
||||
|
||||
noStorageStatus = False
|
||||
noStorage = False
|
||||
noStoragePin = digitalio.DigitalInOut(GP15)
|
||||
noStoragePin.switch_to_input(pull=digitalio.Pull.UP)
|
||||
noStorageStatus = not noStoragePin.value
|
||||
noStorageStatus = noStoragePin.value
|
||||
|
||||
if(noStorageStatus == True):
|
||||
# If GP15 is not connected, it will default to being pulled high (True)
|
||||
# If GP is connected to GND, it will be low (False)
|
||||
|
||||
# Pico:
|
||||
# GP15 not connected == USB visible
|
||||
# GP15 connected to GND == USB not visible
|
||||
|
||||
# Pico W:
|
||||
# GP15 not connected == USB NOT visible
|
||||
# GP15 connected to GND == USB visible
|
||||
|
||||
if(board.board_id == 'raspberry_pi_pico'):
|
||||
# On Pi Pico, default to USB visible
|
||||
noStorage = not noStorageStatus
|
||||
elif(board.board_id == 'raspberry_pi_pico_w'):
|
||||
# on Pi Pico W, default to USB hidden by default
|
||||
# so webapp can access storage
|
||||
noStorage = noStorageStatus
|
||||
|
||||
if(noStorage == True):
|
||||
# don't show USB drive to host PC
|
||||
storage.disable_usb_drive()
|
||||
print("Disabling USB drive")
|
||||
|
||||
Reference in New Issue
Block a user