Introduction
============
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-sd/badge/?version=latest
:target: https://docs.circuitpython.org/projects/sd/en/latest/
:alt: Documentation Status
.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg
:target: https://adafru.it/discord
:alt: Discord
.. image:: https://github.com/adafruit/Adafruit_CircuitPython_SD/workflows/Build%20CI/badge.svg
:target: https://github.com/adafruit/Adafruit_CircuitPython_SD/actions/
:alt: Build Status
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code Style: Black
CircuitPython driver for SD cards. This implements the basic reading and writing
block functionality needed to mount an SD card using `storage.VfsFat`.
Dependencies
=============
This driver depends on:
* `Adafruit CircuitPython 2.0.0+ <https://github.com/adafruit/circuitpython>`_
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_
Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
Usage Example
=============
Mounting a filesystem on an SD card so that its available through the normal Python
ways is easy.
Below is an example for the Feather M0 Adalogger. Most of this will stay the same
across different boards with the exception of the pins for the SPI and chip
select (cs) connections.
.. code-block:: python
import adafruit_sdcard
import busio
import digitalio
import board
import storage
# Connect to the card and mount the filesystem.
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
cs = digitalio.DigitalInOut(board.SD_CS)
sdcard = adafruit_sdcard.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")
# Use the filesystem as normal.
with open("/sd/test.txt", "w") as f:
f.write("Hello world\n")
Sharing the SPI bus with other devices
======================================
.. important::
If the same SPI bus is shared with other peripherals, it is important that
the SD card be initialized before accessing any other peripheral on the bus.
Failure to do so can prevent the SD card from being recognized until it is
powered off or re-inserted.
Documentation
=============
API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/sd/en/latest/>`_.
For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.
Contributing
============
Contributions are welcome! Please read our `Code of Conduct
<https://github.com/adafruit/Adafruit_CircuitPython_sdcard/blob/main/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.
Raw data
{
"_id": null,
"home_page": null,
"name": "adafruit-circuitpython-sd",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "adafruit, sdcard, sd, card, mount, storage, featherwing, adaloggerbreakout, hardware, micropython, circuitpython",
"author": null,
"author_email": "Adafruit Industries <circuitpython@adafruit.com>",
"download_url": "https://files.pythonhosted.org/packages/77/cc/15b65f38ea1304eaa3a7e83957a90c8aa6a608c0081921706726a413ed50/adafruit_circuitpython_sd-3.3.23.tar.gz",
"platform": null,
"description": "\nIntroduction\n============\n\n.. image:: https://readthedocs.org/projects/adafruit-circuitpython-sd/badge/?version=latest\n :target: https://docs.circuitpython.org/projects/sd/en/latest/\n :alt: Documentation Status\n\n.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg\n :target: https://adafru.it/discord\n :alt: Discord\n\n.. image:: https://github.com/adafruit/Adafruit_CircuitPython_SD/workflows/Build%20CI/badge.svg\n :target: https://github.com/adafruit/Adafruit_CircuitPython_SD/actions/\n :alt: Build Status\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/psf/black\n :alt: Code Style: Black\n\nCircuitPython driver for SD cards. This implements the basic reading and writing\nblock functionality needed to mount an SD card using `storage.VfsFat`.\n\nDependencies\n=============\nThis driver depends on:\n\n* `Adafruit CircuitPython 2.0.0+ <https://github.com/adafruit/circuitpython>`_\n* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.\n\nUsage Example\n=============\n\nMounting a filesystem on an SD card so that its available through the normal Python\nways is easy.\n\nBelow is an example for the Feather M0 Adalogger. Most of this will stay the same\nacross different boards with the exception of the pins for the SPI and chip\nselect (cs) connections.\n\n.. code-block:: python\n\n import adafruit_sdcard\n import busio\n import digitalio\n import board\n import storage\n\n # Connect to the card and mount the filesystem.\n spi = busio.SPI(board.SCK, board.MOSI, board.MISO)\n cs = digitalio.DigitalInOut(board.SD_CS)\n sdcard = adafruit_sdcard.SDCard(spi, cs)\n vfs = storage.VfsFat(sdcard)\n storage.mount(vfs, \"/sd\")\n\n # Use the filesystem as normal.\n with open(\"/sd/test.txt\", \"w\") as f:\n f.write(\"Hello world\\n\")\n\nSharing the SPI bus with other devices\n======================================\n\n.. important::\n If the same SPI bus is shared with other peripherals, it is important that\n the SD card be initialized before accessing any other peripheral on the bus.\n Failure to do so can prevent the SD card from being recognized until it is\n powered off or re-inserted.\n\n\nDocumentation\n=============\n\nAPI documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/sd/en/latest/>`_.\n\nFor information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n<https://github.com/adafruit/Adafruit_CircuitPython_sdcard/blob/main/CODE_OF_CONDUCT.md>`_\nbefore contributing to help this project stay welcoming.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CircuitPython library for SD cards.",
"version": "3.3.23",
"project_urls": {
"Homepage": "https://github.com/adafruit/Adafruit_CircuitPython_SD"
},
"split_keywords": [
"adafruit",
" sdcard",
" sd",
" card",
" mount",
" storage",
" featherwing",
" adaloggerbreakout",
" hardware",
" micropython",
" circuitpython"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fb969b543e8a6e5db9e095deb812323ea223bb92764b6361841ec5e6a9738d9d",
"md5": "f8538be818dbaeabe2107a20d383fcc2",
"sha256": "d150fac2b8ea1baf5f428609a1e58830398090d11c497320da67571b8f673a51"
},
"downloads": -1,
"filename": "adafruit_circuitpython_sd-3.3.23-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f8538be818dbaeabe2107a20d383fcc2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8897,
"upload_time": "2024-07-08T13:54:57",
"upload_time_iso_8601": "2024-07-08T13:54:57.995080Z",
"url": "https://files.pythonhosted.org/packages/fb/96/9b543e8a6e5db9e095deb812323ea223bb92764b6361841ec5e6a9738d9d/adafruit_circuitpython_sd-3.3.23-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "77cc15b65f38ea1304eaa3a7e83957a90c8aa6a608c0081921706726a413ed50",
"md5": "71d3344667cf6e517eff4119598fb46d",
"sha256": "31ceecdbe6eaf1af6c0e5010d6a48e034b7c8141ce58d14c0e41af76046180ae"
},
"downloads": -1,
"filename": "adafruit_circuitpython_sd-3.3.23.tar.gz",
"has_sig": false,
"md5_digest": "71d3344667cf6e517eff4119598fb46d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 30244,
"upload_time": "2024-07-08T13:54:59",
"upload_time_iso_8601": "2024-07-08T13:54:59.601904Z",
"url": "https://files.pythonhosted.org/packages/77/cc/15b65f38ea1304eaa3a7e83957a90c8aa6a608c0081921706726a413ed50/adafruit_circuitpython_sd-3.3.23.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-08 13:54:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "adafruit",
"github_project": "Adafruit_CircuitPython_SD",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "Adafruit-Blinka",
"specs": [
[
">=",
"7.0.0"
]
]
},
{
"name": "adafruit-circuitpython-busdevice",
"specs": []
},
{
"name": "adafruit-circuitpython-typing",
"specs": []
}
],
"lcname": "adafruit-circuitpython-sd"
}