sdioio – Interface to an SD card via the SDIO bus — Adafruit CircuitPython 1 documentation (original) (raw)

Available on these boards

class sdioio.SDCard(clock: microcontroller.Pin, command: microcontroller.Pin, data: Sequence[microcontroller.Pin], frequency: int)

SD Card Block Interface with SDIO

Controls an SD card over SDIO. SDIO is a parallel protocol designed for SD cards. It uses a clock pin, a command pin, and 1 or 4 data pins. It can be operated at a high frequency such as 25MHz. Usually an SDCard object is used with storage.VfsFatto allow file I/O to an SD card.

Construct an SDIO SD Card object with the given properties

Parameters:

Example usage:

import os

import board import sdioio import storage

sd = sdioio.SDCard( clock=board.SDIO_CLOCK, command=board.SDIO_COMMAND, data=[board.SDIO_DATA], frequency=25000000) vfs = storage.VfsFat(sd) storage.mount(vfs, '/sd') os.listdir('/sd')

configure(frequency: int = 0, width: int = 0) → None

Configures the SDIO bus.

Parameters:

Note

Leaving a value unspecified or 0 means the current setting is kept

count() → int

Returns the total number of sectors

Due to technical limitations, this is a function and not a property.

Returns:

The number of 512-byte blocks, as a number

readblocks(start_block: int, buf: circuitpython_typing.WriteableBuffer) → None

Read one or more blocks from the card

Parameters:

Returns:

None

writeblocks(start_block: int, buf: circuitpython_typing.ReadableBuffer) → None

Write one or more blocks to the card

Parameters:

Returns:

None

frequency_: int_

The actual SDIO bus frequency. This may not match the frequency requested due to internal limitations.

width_: int_

The actual SDIO bus width, in bits

deinit() → None

Disable permanently.

Returns:

None

__enter__() → SDCard

No-op used by Context Managers. Provided by context manager helper.

__exit__() → None

Automatically deinitializes the hardware when exiting a context. SeeLifetime and ContextManagers for more info.