test.py: Update to use rp2_sd module
Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
This commit is contained in:
@@ -9,11 +9,11 @@ import micropython
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from array import array
|
from array import array
|
||||||
from machine import Pin, SPI
|
from machine import Pin
|
||||||
from math import pi, sin, pow
|
from math import pi, sin, pow
|
||||||
from micropython import const
|
from micropython import const
|
||||||
from rp2_neopixel import NeoPixel
|
from rp2_neopixel import NeoPixel
|
||||||
from sdcard import SDCard
|
from rp2_sd import SDCard
|
||||||
|
|
||||||
micropython.alloc_emergency_exception_buf(100)
|
micropython.alloc_emergency_exception_buf(100)
|
||||||
|
|
||||||
@@ -73,9 +73,8 @@ machine.mem32[0x4001c004 + 8*4] = 0x67
|
|||||||
|
|
||||||
|
|
||||||
def list_sd():
|
def list_sd():
|
||||||
sd_spi = SPI(0, sck=Pin(2), mosi=Pin(3), miso=Pin(4))
|
|
||||||
try:
|
try:
|
||||||
sd = SDCard(sd_spi, Pin(5), 25000000)
|
sd = SDCard(mosi=Pin(3), miso=Pin(4), sck=Pin(2), ss=Pin(5), baudrate=15000000)
|
||||||
except OSError:
|
except OSError:
|
||||||
for i in range(leds):
|
for i in range(leds):
|
||||||
np[i] = (255, 0, 0)
|
np[i] = (255, 0, 0)
|
||||||
@@ -83,9 +82,9 @@ def list_sd():
|
|||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
os.mount(sd, '/sd')
|
os.mount(sd, '/sd')
|
||||||
print(os.listdir('/sd'))
|
print(os.listdir(b'/sd'))
|
||||||
except OSError:
|
except OSError as ex:
|
||||||
pass
|
print(f"{ex}")
|
||||||
|
|
||||||
|
|
||||||
delay_sum = 0
|
delay_sum = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user