SD 类 – 安全数字存储卡

. warning:


The SD card class allows to configure and enable the memory card module of the WiPy and automatically mount it as /sd as part of the file system. There are several pin combinations that can be used to wire the SD card socket to the WiPy and the pins used can be specified in the constructor. Please check the pinout and alternate functions table. for more info regarding the pins which can be remapped to be used with a SD card. SD卡类允许配置和启用WiPy的存储卡模块,并自动将其作为文件系统的一部分以 /sd 挂载。 有几种引脚组合可用于将SD卡插槽连接到WiPy,并且可以在构造函数中指定使用的引脚。 请检查 pinout and alternate functions table. 有关可以重新映射以与SD卡一起使用的引脚的更多信息。


from machine import SD
import os
# clk cmd and dat0 pins must be passed along with  clk cmd和dat0引脚必须一起传递
# their respective alternate functions
sd = machine.SD(pins=('GP10', 'GP11', 'GP15'))
os.mount(sd, '/sd')
# do normal file operations 进行常规的文件操作
sd = machine.SD(pins=('GP10', 'GP11', 'GP15'))
os.mount(sd, '/sd')


class machine.SD(id, ...)

创建一个SD卡对象。有关参数的初始化,请参见 init()


SD.init(id=0, pins=('GP10', 'GP11', 'GP15'))

启用SD卡。为了初始化卡,给它一个3元组 (clk_pin, cmd_pin, dat0_pin)