Skip to content

Commit 1bc7398

Browse files
Merge pull request #1 from QuecPython/main
合并wiki
2 parents 770954a + 319c5f6 commit 1bc7398

File tree

4 files changed

+4216
-215
lines changed

4 files changed

+4216
-215
lines changed

en-us/api/QuecPythonClasslib.md

Lines changed: 2047 additions & 60 deletions
Large diffs are not rendered by default.

en-us/api/pythonStdlib.md

Lines changed: 91 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ b'\xb3\xc9Y\x1b\xe9'
204204

205205

206206

207-
##### Initialize SD card driver(SPI mode)
207+
##### Register storage device - SPI - SD card
208208

209209
At present, it is only supported by ec600n / ec800n platforms.
210210

@@ -233,49 +233,7 @@ Initialize SD card and communicate with SD card. Use SPI communication mode.
233233

234234

235235

236-
##### Mount file system
237-
238-
> **uos.mount(vfs_obj, path)**
239-
240-
Mount the underlying file system to VFS.
241-
242-
* Parameters
243-
244-
|Parameter | parameter type | parameter description|
245-
| ------- | ---------- | ---------------- |
246-
| vfs_ Obj | VFS object | file system object|
247-
|Path | str | root directory of file system|
248-
249-
* Return Value
250-
251-
* None
252-
253-
* Example
254-
255-
```python
256-
>>> cdev = uos.VfsFat(1, 0, 4, 1)
257-
>>> uos.mount(cdev, '/sd')
258-
```
259-
260-
-SD card usage example(SPI mode)
261-
262-
At present, it is only supported by ec600n / ec800n platforms.
263-
264-
```python
265-
>>> cdev = uos.VfsFat(1, 0, 4, 1)
266-
>>> uos.mount(cdev, '/sd')
267-
>>> f = open('/sd/test.txt','w+')
268-
>>> f.write('0123456')
269-
>>> f.close()
270-
>>> uos.listdir('/sd')
271-
>>> f = open('/sd/test.txt','r')
272-
>>> f.read()
273-
>>> f.close()
274-
```
275-
276-
277-
278-
##### Initialize SD card driver(SDIO mode)
236+
##### Register storage device - SDIO - SD card
279237

280238
At present,it is only supported by EC600U/EC200U platforms.
281239

@@ -306,7 +264,7 @@ Return vfs object if the execution is successful, otherwise report error.
306264
>>> udev = VfsSd("sd_fs")
307265
```
308266

309-
##### Set detection pin
267+
###### Set detection pin
310268

311269
> **set_det(vfs_obj.GPIOn,mode)**
312270
@@ -332,7 +290,7 @@ Return 0 if the execution is successful, otherwise return -1.
332290
>>> 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).
333291
```
334292

335-
##### Setting the card insertion and removal callback function
293+
###### Setting the card insertion and removal callback function
336294

337295
> **set_callback(fun)**
338296
@@ -380,6 +338,93 @@ def call_back(para):
380338
udev.set_callback(call_back)
381339
```
382340

341+
342+
343+
##### **Register storage device - SPI NOR FLASH**
344+
345+
At present,it is only supported by EG915U platforms.
346+
347+
> uos.VfsLfs1(readsize,progsize,lookahead,pname,spi_port,spi_clk)
348+
349+
Initialize spi nor flash and Plug-in nor flash communication. Use SPI communication mode.
350+
351+
* Parameter
352+
353+
| Parameter | Type | Description |
354+
| --------- | ---- | ------------------------------------------------------------ |
355+
| readsize | int | Reserved, not used yet |
356+
| progsize | int | Reserved, not used yet |
357+
| lookahead | int | Reserved, not used yet |
358+
| pname | str | Fixed to "ext_fs". Subsequent expansion |
359+
| spi_port | int | Supported ports refer to the SPI chapter description |
360+
| spi_clk | int | clock frequency:<br />EG915U:0:6.25M 1:12.5M 2:25M 3:50M 4:3.125M 5:1.5625M 6:781.25K |
361+
362+
* Return value
363+
364+
VfsLfs1 object will be returned if successful, and OSError 19 will be returned if failed.
365+
366+
* Example
367+
368+
```python
369+
>>>ldev = uos.VfsLfs1(32, 32, 32, "ext_fs",1,0)
370+
>>>uos.mount(ldev,'/ext')
371+
>>>f = open('/ext/test.txt','w+')
372+
>>>f.write('hello world!!!')
373+
>>>f.close()
374+
375+
>>>uos.listdir('ext')
376+
377+
>>>f = open('/ext/test.txt','r')
378+
>>>f.read()
379+
>>>f.close()
380+
381+
```
382+
383+
384+
385+
386+
##### Mount file system
387+
388+
> **uos.mount(vfs_obj, path)**
389+
390+
Mount the underlying file system to VFS.
391+
392+
* Parameters
393+
394+
| Parameter | parameter type | parameter description |
395+
| --------- | -------------- | ----------------------------- |
396+
| vfs_ Obj | VFS object | file system object |
397+
| Path | str | root directory of file system |
398+
399+
* Return Value
400+
401+
* None
402+
403+
* Example
404+
405+
```python
406+
>>> cdev = uos.VfsFat(1, 0, 4, 1)
407+
>>> uos.mount(cdev, '/sd')
408+
```
409+
410+
-SD card usage example(SPI mode)
411+
412+
At present, it is only supported by ec600n / ec800n platforms.
413+
414+
```python
415+
>>> cdev = uos.VfsFat(1, 0, 4, 1)
416+
>>> uos.mount(cdev, '/sd')
417+
>>> f = open('/sd/test.txt','w+')
418+
>>> f.write('0123456')
419+
>>> f.close()
420+
>>> uos.listdir('/sd')
421+
>>> f = open('/sd/test.txt','r')
422+
>>> f.read()
423+
>>> f.close()
424+
```
425+
426+
427+
383428
#### gc - Control the Garbage Collector
384429

385430
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

Comments
 (0)