Skip to content

Commit 748f988

Browse files
committed
expand SD comments, remove leftover comment section, remove 10x specific files
1 parent d40ddef commit 748f988

File tree

4 files changed

+19
-71
lines changed

4 files changed

+19
-71
lines changed

Metro_RP2350_Examples/CircuitPython_SDCard_ListFiles/code-cp10x.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

Metro_RP2350_Examples/CircuitPython_SDCard_ListFiles/code.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
"""
55
CircuitPython Essentials SD Card Read Demo
6-
* Not compatible with CircuitPython 10.x
76
"""
87

98
import os
@@ -16,16 +15,23 @@
1615
# The SD_CS pin is the chip select line.
1716
SD_CS = board.SD_CS
1817

18+
# For CircuitPython 9.x we must initialize and mount the SD card manually.
19+
# On CircuitPython 10.x the core will automatically initialize and mount the SD.
20+
# This try/except block can be removed with 10.x has a stable release.
1921
try:
20-
# Connect to the card and mount the filesystem.
22+
# Initialize the Chip Select pin for the SD card
2123
cs = digitalio.DigitalInOut(SD_CS)
24+
# Initialize the SD card
2225
sdcard = adafruit_sdcard.SDCard(
2326
busio.SPI(board.SD_SCK, board.SD_MOSI, board.SD_MISO), cs
2427
)
28+
# Mount the SD card
2529
vfs = storage.VfsFat(sdcard)
2630
storage.mount(vfs, "/sd")
2731
except ValueError:
28-
# SD_CS in use error happens if CircuitPython core initialized the SD automatically
32+
# "ValueError SD_CS in use" error happen on CircuitPython 10.x
33+
# because the core initialized the SD automatically. The error
34+
# can be ignored on 10.x.
2935
pass
3036

3137
# Use the filesystem as normal! Our files are under /sd

Metro_RP2350_Examples/CircuitPython_SDCard_Write/code-cp10x.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

Metro_RP2350_Examples/CircuitPython_SDCard_Write/code.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44

55
"""
66
CircuitPython Essentials SD Card Write Demo
7-
REMOVE THIS LINE AND ALL BELOW IT BEFORE SUBMITTING TO LEARN
8-
Update CHIP_SELECT_PIN to match the CS pin on your board.
9-
10-
For example, for the Metro ESP32-S3, you would use: board.SD_CS.
11-
12-
This code stops working with CircuitPython 10.x which automounts /sd
137
"""
148

159
import time
@@ -23,16 +17,24 @@
2317
# The SD_CS pin is the chip select line.
2418
SD_CS = board.SD_CS
2519

20+
21+
# For CircuitPython 9.x we must initialize and mount the SD card manually.
22+
# On CircuitPython 10.x the core will automatically initialize and mount the SD.
23+
# This try/except block can be removed with 10.x has a stable release.
2624
try:
27-
# Connect to the card and mount the filesystem.
25+
# Initialize the Chip Select pin for the SD card
2826
cs = digitalio.DigitalInOut(SD_CS)
27+
# Initialize the SD card
2928
sdcard = adafruit_sdcard.SDCard(
3029
busio.SPI(board.SD_SCK, board.SD_MOSI, board.SD_MISO), cs
3130
)
31+
# Mount the SD card
3232
vfs = storage.VfsFat(sdcard)
3333
storage.mount(vfs, "/sd")
3434
except ValueError:
35-
# SD_CS in use error happens if CircuitPython core initialized the SD automatically
35+
# "ValueError SD_CS in use" error happen on CircuitPython 10.x
36+
# because the core initialized the SD automatically. The error
37+
# can be ignored on 10.x.
3638
pass
3739

3840
# Use the filesystem as normal! Our files are under /sd

0 commit comments

Comments
 (0)