Skip to content

Commit 7605aa5

Browse files
committed
Allow separate SD card SPI bus
1 parent 99f312d commit 7605aa5

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

red_vision_examples/rv_init/bus_spi.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,14 @@
2020
# mosi = 3,
2121
# miso = 4,
2222
)
23+
24+
# Some boards use the same SPI bus for both the display and the SD card, others
25+
# have separate buses. We'll create a separate `spi_sd` object for the SD card.
26+
import sys
27+
if "IoT RedBoard RP2350" in sys.implementation._machine:
28+
spi_sd = SPI(
29+
1,
30+
baudrate = 24_000_000,
31+
)
32+
else:
33+
spi_sd = spi

red_vision_examples/rv_init/sd_card.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
# Import the Pin class for the board's default pins.
1515
from machine import Pin
1616

17-
# Import the SPI bus
18-
from .bus_spi import spi
17+
# Import the SPI bus.
18+
from .bus_spi import spi_sd as spi
1919

2020
# When the SD card is initialized, it changes the SPI bus baudrate. We'll
2121
# want to revert it, so we need to know the original baudrate. There's no

0 commit comments

Comments
 (0)