2016-06-07 21:46:27 +00:00
|
|
|
.. currentmodule:: machine
|
2017-04-18 05:27:37 +00:00
|
|
|
.. _machine.SD:
|
2015-06-10 21:29:56 +00:00
|
|
|
|
2019-05-31 07:04:32 +00:00
|
|
|
class SD -- secure digital memory card (cc3200 port only)
|
|
|
|
=========================================================
|
2015-06-10 21:29:56 +00:00
|
|
|
|
2018-07-20 05:58:18 +00:00
|
|
|
.. warning::
|
|
|
|
|
|
|
|
This is a non-standard class and is only available on the cc3200 port.
|
|
|
|
|
|
|
|
|
2015-06-10 21:29:56 +00:00
|
|
|
The SD card class allows to configure and enable the memory card
|
|
|
|
module of the WiPy and automatically mount it as ``/sd`` as part
|
|
|
|
of the file system. There are several pin combinations that can be
|
|
|
|
used to wire the SD card socket to the WiPy and the pins used can
|
|
|
|
be specified in the constructor. Please check the `pinout and alternate functions
|
|
|
|
table. <https://raw.githubusercontent.com/wipy/wipy/master/docs/PinOUT.png>`_ for
|
|
|
|
more info regarding the pins which can be remapped to be used with a SD card.
|
|
|
|
|
|
|
|
Example usage::
|
|
|
|
|
2015-10-14 10:32:01 +00:00
|
|
|
from machine import SD
|
|
|
|
import os
|
|
|
|
# clk cmd and dat0 pins must be passed along with
|
2015-06-10 21:29:56 +00:00
|
|
|
# their respective alternate functions
|
2015-10-14 10:32:01 +00:00
|
|
|
sd = machine.SD(pins=('GP10', 'GP11', 'GP15'))
|
|
|
|
os.mount(sd, '/sd')
|
2015-08-11 14:06:43 +00:00
|
|
|
# do normal file operations
|
2015-06-10 21:29:56 +00:00
|
|
|
|
|
|
|
Constructors
|
|
|
|
------------
|
|
|
|
|
2016-06-09 00:03:53 +00:00
|
|
|
.. class:: SD(id,... )
|
2015-06-10 21:29:56 +00:00
|
|
|
|
2021-12-15 00:49:22 +00:00
|
|
|
Create a SD card object. See ``init()`` for parameters if initialization.
|
2015-06-10 21:29:56 +00:00
|
|
|
|
|
|
|
Methods
|
|
|
|
-------
|
|
|
|
|
2016-06-07 22:33:49 +00:00
|
|
|
.. method:: SD.init(id=0, pins=('GP10', 'GP11', 'GP15'))
|
2015-06-10 21:29:56 +00:00
|
|
|
|
2017-05-29 07:08:14 +00:00
|
|
|
Enable the SD card. In order to initialize the card, give it a 3-tuple:
|
2015-10-20 14:24:25 +00:00
|
|
|
``(clk_pin, cmd_pin, dat0_pin)``.
|
2015-06-10 21:29:56 +00:00
|
|
|
|
2016-06-07 22:33:49 +00:00
|
|
|
.. method:: SD.deinit()
|
2015-06-10 21:29:56 +00:00
|
|
|
|
2015-10-14 10:32:01 +00:00
|
|
|
Disable the SD card.
|