:mod:`sdcardio` =============== .. py:module:: sdcardio .. autoapi-nested-parse:: Interface to an SD card via the SPI bus .. py:class:: SDCard(bus: busio.SPI, cs=digitalio.DigitalInOut, baudrate=8000000) SD Card Block Interface Controls an SD card over SPI. This built-in module has higher read performance than the library adafruit_sdcard, but it is only compatible with `busio.SPI`, not `bitbangio.SPI`. Usually an SDCard object is used with ``storage.VfsFat`` to allow file I/O to an SD card. .. 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:: deinit() Disable permanently. :return: None .. 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