forked from proveskit/CircuitPython_RP2350_v5b
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboot.py
More file actions
44 lines (34 loc) · 1.06 KB
/
boot.py
File metadata and controls
44 lines (34 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# from busio import _spi_init
# import os
# from lib.pysquared.nvm.counter import Counter
# import board
# import sdcardio
import storage
# This tells the computer to disconnect from the board's mass storage device (CIRCUITPY drive).
# This is the correct method for CircuitPython 9+
storage.disable_usb_drive() # disable CIRCUITPY
try:
with open("/sd/leaderboard.json", "r") as file:
pass # File exists
except OSError:
with open("/sd/leaderboard.json", "w") as file:
file.write("{}")
# After the USB drive is disabled, we can remount the /sd filesystem
# as writable for our CircuitPython code.
# storage.remount("/sd", readonly=False)
# os.mkdir("/sd") # Ensure the lib directory exists'
# from lib.pysquared.logger import Logger
# logger: Logger = Logger(
# error_counter=Counter(0),
# colorized=False,
# )
# spi1 = _spi_init(
# logger,
# board.SPI1_SCK,
# board.SPI1_MOSI,
# board.SPI1_MISO,
# )
# sd = sdcardio.SDCard(spi1, board.SPI1_CS1)
# vfs = storage.VfsFat(sd)
# storage.mount(vfs, "/sd")
# os.listdir("/sd")