From 11d21081b4321ff4a1078b728911fe15fea94509 Mon Sep 17 00:00:00 2001 From: Daniel Campora Date: Tue, 11 Aug 2015 16:06:43 +0200 Subject: cc3200: Rework SD API. Increase heap to avoid malloc failures. --- docs/library/pyb.SD.rst | 29 +++++++++++++++++++---------- docs/wipy/quickref.rst | 6 +++--- 2 files changed, 22 insertions(+), 13 deletions(-) (limited to 'docs') diff --git a/docs/library/pyb.SD.rst b/docs/library/pyb.SD.rst index 0746b435b..9b3d95dac 100644 --- a/docs/library/pyb.SD.rst +++ b/docs/library/pyb.SD.rst @@ -15,25 +15,34 @@ Example usage:: # data, clk and cmd pins must be passed along with # their respective alternate functions - sd = pyb.SD('GP15', 8, 'GP10', 6, 'GP11', 6) - sd.enable() # enable and mount the SD card - sd.disable() # disable and unmount it + sd = pyb.SD(('GP15', 8, 'GP10', 6, 'GP11', 6)) + sd.mount() + # do normal file operations Constructors ------------ -.. class:: pyb.SD(dat_pin, dat_pin_af, clk_pin, clk_pin_af, cmd_pin, cmd_pin_af) +.. class:: pyb.SD([pins_tuple]) - Create a SD card object. Data, clock and cmd pins must be passed along with - their respective alternate functions. + Create a SD card object. In order to initalize the card, give it a 6-tuple + ``(dat_pin, dat_af, clk_pin, clk_af, cmd_pin, cmd_af)`` with the data, clock + and cmd pins together their respective alternate functions. Methods ------- -.. method:: sd.enable() +.. method:: sd.init([pins_tuple]) - Enable the SD card and mount it on the file system. Accesible as ``/sd``. + Enable the SD card. -.. method:: sd.disable() +.. method:: sd.deinit() - Disable the SD card and remove it from the file system. + Disable the SD card (also unmounts it to avoid file system crashes). + +.. method:: sd.mount() + + Mount the SD card on the file system. Accesible as ``/sd``. + +.. method:: sd.unmount() + + Unmount the SD card from the file system. diff --git a/docs/wipy/quickref.rst b/docs/wipy/quickref.rst index 2acbaa541..358020d94 100644 --- a/docs/wipy/quickref.rst +++ b/docs/wipy/quickref.rst @@ -172,10 +172,10 @@ See :ref:`pyb.SD `. :: from pyb import SD - # SD card pins need special configuration so we pass 'em to the constructor + # SD card pins need special configuration so we pass them to the constructor # data pin, data af, clock pin, clock af, cmd pin, cmd af - sd = pyb.SD('GP15', 8, 'GP10', 6, 'GP11', 6) - sd.enable() + sd = pyb.SD(('GP15', 8, 'GP10', 6, 'GP11', 6)) + sd.mount() WLAN (WiFi) ----------- -- cgit v1.2.3