Raspberry pico File Mount

Aus xinux.net
Zur Navigation springen Zur Suche springen
import digitalio
import storage
from board import *

class DEBUG_MOUNT():
    
    noStorageStatus = False
    noStoragePin = digitalio.DigitalInOut(GP15)
    noStoragePin.switch_to_input(pull=digitalio.Pull.UP)
    noStorageStatus = not noStoragePin.value
    
    def mount(self):
        
        if(self.noStorageStatus == True):
            # don't show USB drive to host PC
            try:
                storage.disable_usb_drive()
            except:
                print("USB drive disabled")
            
            return "disabled"
        
        else:
            # normal boot
            print("USB drive enabled")
            
            return "enabled"