2016-06-07 17:46:27 -04:00
|
|
|
.. currentmodule:: machine
|
2017-04-18 01:27:37 -04:00
|
|
|
.. _machine.SD:
|
2015-06-10 17:29:56 -04:00
|
|
|
|
2019-05-31 03:04:32 -04:00
|
|
|
class SD -- secure digital memory card (cc3200 port only)
|
|
|
|
=========================================================
|
2015-06-10 17:29:56 -04:00
|
|
|
|
2018-07-20 01:58:18 -04:00
|
|
|
.. warning::
|
|
|
|
|
|
|
|
This is a non-standard class and is only available on the cc3200 port.
|
|
|
|
|
|
|
|
|
2015-06-10 17:29:56 -04: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 06:32:01 -04:00
|
|
|
from machine import SD
|
|
|
|
import os
|
|
|
|
# clk cmd and dat0 pins must be passed along with
|
2015-06-10 17:29:56 -04:00
|
|
|
# their respective alternate functions
|
2015-10-14 06:32:01 -04:00
|
|
|
sd = machine.SD(pins=('GP10', 'GP11', 'GP15'))
|
|
|
|
os.mount(sd, '/sd')
|
2015-08-11 10:06:43 -04:00
|
|
|
# do normal file operations
|
2015-06-10 17:29:56 -04:00
|
|
|
|
|
|
|
Constructors
|
|
|
|
------------
|
|
|
|
|
2016-06-08 20:03:53 -04:00
|
|
|
.. class:: SD(id,... )
|
2015-06-10 17:29:56 -04:00
|
|
|
|
2015-10-20 10:24:25 -04:00
|
|
|
Create a SD card object. See ``init()`` for parameters if initialization.
|
2015-06-10 17:29:56 -04:00
|
|
|
|
|
|
|
Methods
|
|
|
|
-------
|
|
|
|
|
2016-06-07 18:33:49 -04:00
|
|
|
.. method:: SD.init(id=0, pins=('GP10', 'GP11', 'GP15'))
|
2015-06-10 17:29:56 -04:00
|
|
|
|
2017-05-29 03:08:14 -04:00
|
|
|
Enable the SD card. In order to initialize the card, give it a 3-tuple:
|
2015-10-20 10:24:25 -04:00
|
|
|
``(clk_pin, cmd_pin, dat0_pin)``.
|
2015-06-10 17:29:56 -04:00
|
|
|
|
2016-06-07 18:33:49 -04:00
|
|
|
.. method:: SD.deinit()
|
2015-06-10 17:29:56 -04:00
|
|
|
|
2015-10-14 06:32:01 -04:00
|
|
|
Disable the SD card.
|