:mod:`sdioio` ============= .. py:module:: sdioio .. autoapi-nested-parse:: Interface to an SD card via the SDIO bus .. py:class:: SDCard(*, clock: digitalio.DigitalInOut, command: digitalio.DigitalInOut, data: List[digitalio.DigitalInOut], 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.VfsFat`` to allow file I/O to an SD card. .. method:: configure(*, frequency=0, width=0) Configures the SDIO bus. :param int frequency: the desired clock rate in Hertz. The actual clock rate may be higher or lower due to the granularity of available clock settings. Check the `frequency` attribute for the actual clock rate. :param int width: the number of data lines to use. Must be 1 or 4 and must also not exceed the number of data lines at construction .. note:: Leaving a value unspecified or 0 means the current setting is kept .. method:: count() Returns the total number of sectors Due to technical limitations, this is a function and not a property. :return: The number of 512-byte blocks, as a number .. method:: readblocks(start_block: int, buf: bytearray) Read one or more blocks from the card :param int start_block: The block to start reading from :param bytearray buf: The buffer to write into. Length must be multiple of 512. :return: None .. method:: writeblocks(start_block: int, buf: bytearray) Write one or more blocks to the card :param int start_block: The block to start writing from :param bytearray buf: The buffer to read from. Length must be multiple of 512. :return: None .. method:: frequency(self) :property: The actual SDIO bus frequency. This may not match the frequency requested due to internal limitations. .. method:: width(self) :property: The actual SDIO bus width, in bits .. method:: deinit() Disable permanently. :return: None .. method:: __enter__(self) No-op used by Context Managers. Provided by context manager helper. .. method:: __exit__(self) Automatically deinitializes the hardware when exiting a context. See :ref:`lifetime-and-contextmanagers` for more info.