machine.SD.rst 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. .. currentmodule:: machine
  2. .. _machine.SD:
  3. class SD -- secure digital memory card
  4. ======================================
  5. .. warning::
  6. This is a non-standard class and is only available on the cc3200 port.
  7. The SD card class allows to configure and enable the memory card
  8. module of the WiPy and automatically mount it as ``/sd`` as part
  9. of the file system. There are several pin combinations that can be
  10. used to wire the SD card socket to the WiPy and the pins used can
  11. be specified in the constructor. Please check the `pinout and alternate functions
  12. table. <https://raw.githubusercontent.com/wipy/wipy/master/docs/PinOUT.png>`_ for
  13. more info regarding the pins which can be remapped to be used with a SD card.
  14. Example usage::
  15. from machine import SD
  16. import os
  17. # clk cmd and dat0 pins must be passed along with
  18. # their respective alternate functions
  19. sd = machine.SD(pins=('GP10', 'GP11', 'GP15'))
  20. os.mount(sd, '/sd')
  21. # do normal file operations
  22. Constructors
  23. ------------
  24. .. class:: SD(id,... )
  25. Create a SD card object. See ``init()`` for parameters if initialization.
  26. Methods
  27. -------
  28. .. method:: SD.init(id=0, pins=('GP10', 'GP11', 'GP15'))
  29. Enable the SD card. In order to initialize the card, give it a 3-tuple:
  30. ``(clk_pin, cmd_pin, dat0_pin)``.
  31. .. method:: SD.deinit()
  32. Disable the SD card.