You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| EC600U | CMD:Pin number 48<br />DATA0:Pin number 39<br />DATA1:Pin number 40<br />DATA2:Pin number 49<br />DATA3:Pin number 号50<br />CLK:Pin number 132 |
300
+
| EC200U | CMD:Pin number 33<br />DATA0:Pin number 31<br />DATA1:Pin number 30<br />DATA2:Pin number 29<br />DATA3:Pin number 28<br />CLK:Pin number 32 |
301
+
302
+
* Exmaple
303
+
304
+
```python
305
+
>>>from uos import VfsSd
306
+
>>> udev = VfsSd("sd_fs")
307
+
```
308
+
309
+
##### Set detection pin
310
+
311
+
> **set_det(vfs_obj.GPIOn,mode)**
312
+
313
+
Set the detection pin and mode of SD card insert and plug out detection.
| vfs_obj.GPIOn | int | GPIO pin number for SD card insert and plug out detection, refer to the definition of Pin module |
320
+
| mode | int | 0: when inserte the SD card, the detection port is at low level; when plug out the SD card, the detection port is at high level<br />1:when inserte the SD card, the detection port is at high level;when plug out the SD card, the detection port is at low level |
321
+
322
+
* Return Value
323
+
324
+
Return 0 if the execution is successful, otherwise return -1.
325
+
326
+
* Exmaple
327
+
328
+
```python
329
+
>>>from uos import VfsSd
330
+
>>> udev = VfsSd("sd_fs")
331
+
>>> uos.mount(udev, '/sd')
332
+
>>> udev.set_det(udev.GPIO10,0)#Use gpio10 as the card detection pin, insert the SD card, the detection port is low level, plug out the SD card, the detection port is high level(the actual use depends on the hardware).
333
+
```
334
+
335
+
##### Setting the card insertion and removal callback function
336
+
337
+
> **set_callback(fun)**
338
+
339
+
Set the user callback function in case of card insert and plug out event.
| fun | function | insertion and removal callback function [ind_type]<br />ind_type: event type,0:plug out 1:insert |
346
+
347
+
* Return Value
348
+
349
+
Return 0 if the execution is successful, otherwise return -1.
350
+
351
+
352
+
SD card usage example(SDIO mode)
353
+
354
+
At present,it is only supported by EC600U/EC200U platforms.
355
+
356
+
```python
357
+
from uos import VfsSd
358
+
import ql_fs
359
+
udev = VfsSd("sd_fs")
360
+
uos.mount(udev, '/sd')
361
+
udev.set_det(udev.GPIO10,0)
362
+
#file read / write
363
+
f =open('/sd/test.txt','w+')
364
+
f.write('1234567890abcdefghijkl')
365
+
f.close()
366
+
uos.listdir('/sd')
367
+
f =open('/sd/test.txt','r')
368
+
f.read()
369
+
f.close()
370
+
#card insertion and removal callback function
371
+
defcall_back(para):
372
+
if(para ==1):
373
+
print("insert")
374
+
print(uos.listdir('/usr'))
375
+
print(ql_fs.file_copy('/usr/1.txt','/sd/test.txt'))#copy the test.Txt under SD card to 1.txt under usr partition
376
+
print(uos.listdir('/usr'))
377
+
elif(para ==0):
378
+
print("plug out")
379
+
380
+
udev.set_callback(call_back)
381
+
```
382
+
278
383
#### gc - Control the Garbage Collector
279
384
280
385
This module provides an interface to the optional garbage collector. This module implements a subset of the corresponding [CPython](https://docs.micropython.org/en/latest/reference/glossary.html#term-CPython) module, as described below. For more information, refer to the original CPython documentation: [gc](https://docs.python.org/3.5/library/gc.html#module-gc)
0 commit comments