Sfoglia il codice sorgente

【修改】:修改 MicroPython 开发手册格式

SummerGift 8 anni fa
parent
commit
d0ac192cbb

+ 82 - 82
docs/Development_manual_document_section/03-Basic_Module.md

@@ -7,13 +7,13 @@
 #### **rtthread** – 系统相关函数
 #### **rtthread** – 系统相关函数
 `rtthread` 模块提供了与 rt-thread 操作系统相关的功能,如查看栈使用情况等。
 `rtthread` 模块提供了与 rt-thread 操作系统相关的功能,如查看栈使用情况等。
 
 
-- rtthread.current_tid()
+- rtthread.current_tid()  
 返回当前线程的 id 。
 返回当前线程的 id 。
 
 
-- rtthread.is_preempt_thread()
+- rtthread.is_preempt_thread()  
 返回是否是可抢占线程。
 返回是否是可抢占线程。
 
 
-- rtthread.stacks_analyze()
+- rtthread.stacks_analyze()  
 返回当前系统线程和栈使用信息。
 返回当前系统线程和栈使用信息。
 
 
 `example`:
 `example`:
@@ -44,24 +44,24 @@ timer        4  suspend 0x00000080 0x00000200    25%   0x00000009 000
 
 
 `函数`
 `函数`
 
 
-- utime.sleep(seconds)
+- utime.sleep(seconds)  
 休眠指定的时间(秒),Seconds 可以是浮点数。注意有些版本的 MicroPython不支持浮点数,为了兼容可以使用 sleep_ms() 和 ``sleep_us()``函数。
 休眠指定的时间(秒),Seconds 可以是浮点数。注意有些版本的 MicroPython不支持浮点数,为了兼容可以使用 sleep_ms() 和 ``sleep_us()``函数。
 
 
-- utime.sleep_ms(ms)
+- utime.sleep_ms(ms)  
 延时指定毫秒,参数不能小于0。
 延时指定毫秒,参数不能小于0。
 
 
-- utime.sleep_us(us)
+- utime.sleep_us(us)  
 延时指定微秒,参数不能小于0。
 延时指定微秒,参数不能小于0。
 
 
-- utime.ticks_ms()
+- utime.ticks_ms()  
 返回不断递增的毫秒计数器,在某些值后会重新计数(未指定)。计数值本身无特定意义,只适合用在``ticks_diff()``。
 返回不断递增的毫秒计数器,在某些值后会重新计数(未指定)。计数值本身无特定意义,只适合用在``ticks_diff()``。
 
 
 注:执行标准数学运算(+,-)或关系运算符(<,>,>,> =)直接在这些值上会导致无效结果。执行数学运算然后传递结果作为论据来`ticks_diff()` 或 ` ticks_add() ` 也将导致后一个函数的无效结果。
 注:执行标准数学运算(+,-)或关系运算符(<,>,>,> =)直接在这些值上会导致无效结果。执行数学运算然后传递结果作为论据来`ticks_diff()` 或 ` ticks_add() ` 也将导致后一个函数的无效结果。
 
 
-- utime.ticks_us()
+- utime.ticks_us()  
 和上面 ticks_ms() 类似,只是返回微秒。
 和上面 ticks_ms() 类似,只是返回微秒。
 
 
-- utime.ticks_cpu()
+- utime.ticks_cpu()  
 与 ticks_ms() 和 ticks_us() 类似,具有更高精度 (使用 CPU 时钟)。
 与 ticks_ms() 和 ticks_us() 类似,具有更高精度 (使用 CPU 时钟)。
 
 
 - 可用性:并非每个端口都实现此功能。
 - 可用性:并非每个端口都实现此功能。
@@ -87,45 +87,45 @@ timer        4  suspend 0x00000080 0x00000200    25%   0x00000009 000
 
 
 `函数`
 `函数`
 
 
-- sys.exit(retval=0)
+- sys.exit(retval=0)  
 终止当前程序给定的退出代码。 函数会抛出 SystemExit 异常。
 终止当前程序给定的退出代码。 函数会抛出 SystemExit 异常。
 
 
-- sys.print_exception(exc, file=sys.stdout)
+- sys.print_exception(exc, file=sys.stdout)  
 打印异常与追踪到一个类似文件的对象 file (或者缺省 sys.stdout ).
 打印异常与追踪到一个类似文件的对象 file (或者缺省 sys.stdout ).
 
 
 `常数`
 `常数`
 
 
-- sys.argv
+- sys.argv  
 当前程序启动时参数的可变列表。
 当前程序启动时参数的可变列表。
 
 
-- sys.byteorder
+- sys.byteorder  
 系统字节顺序 (“little” or “big”).
 系统字节顺序 (“little” or “big”).
 
 
-- sys.implementation
+- sys.implementation  
 使用当前Python实现的。对于micropython,它具有以下属性:
 使用当前Python实现的。对于micropython,它具有以下属性:
 
 
-- sys.modules
+- sys.modules  
 加载模块字典。在一部分环境中它可能不包含内置模块。
 加载模块字典。在一部分环境中它可能不包含内置模块。
 
 
-- sys.path
+- sys.path  
 搜索导入模块的可变目录列表。
 搜索导入模块的可变目录列表。
 
 
-- sys.platform
+- sys.platform  
 返回当前操作系统信息。
 返回当前操作系统信息。
 
 
-- sys.stderr
+- sys.stderr  
 标准错误流。
 标准错误流。
 
 
-- sys.stdin
+- sys.stdin  
 标准输入流。
 标准输入流。
 
 
-- sys.stdout
+- sys.stdout  
 标准输出流。
 标准输出流。
 
 
-- sys.version
+- sys.version  
 符合的Python语言版本,如字符串。
 符合的Python语言版本,如字符串。
 
 
-- sys.version_info
+- sys.version_info  
 Python 语言版本,实现符合,作为一个元组的值。
 Python 语言版本,实现符合,作为一个元组的值。
 
 
 `example`:
 `example`:
@@ -161,126 +161,126 @@ stat            unlink          mount           umount
 
 
 `函数`
 `函数`
 
 
-- math.acos(x)
+- math.acos(x)  
 返回 ``x`` 的反余弦。
 返回 ``x`` 的反余弦。
 
 
-- math.acosh(x)
+- math.acosh(x)  
 返回 ``x`` 的逆双曲余弦。
 返回 ``x`` 的逆双曲余弦。
 
 
-- math.asin(x)
+- math.asin(x)  
 返回 ``x`` 的反正弦。
 返回 ``x`` 的反正弦。
 
 
-- math.asinh(x)
+- math.asinh(x)  
 返回``x`` 的逆双曲正弦。
 返回``x`` 的逆双曲正弦。
 
 
-- math.atan(x)
+- math.atan(x)  
 返回 ``x`` 的逆切线。
 返回 ``x`` 的逆切线。
 
 
-- math.atan2(y, x)
+- math.atan2(y, x)  
 Return the principal value of the inverse tangent of y/x.
 Return the principal value of the inverse tangent of y/x.
 
 
-- math.atanh(x)
+- math.atanh(x)  
 Return the inverse hyperbolic tangent of x.
 Return the inverse hyperbolic tangent of x.
 
 
-- math.ceil(x)
+- math.ceil(x)  
 Return an integer, being x rounded towards positive infinity.
 Return an integer, being x rounded towards positive infinity.
 
 
-- math.copysign(x, y)
+- math.copysign(x, y)  
 Return x with the sign of y.
 Return x with the sign of y.
 
 
-- math.cos(x)
+- math.cos(x)  
 Return the cosine of x.
 Return the cosine of x.
 
 
-- math.cosh(x)
+- math.cosh(x)  
 Return the hyperbolic cosine of x.
 Return the hyperbolic cosine of x.
 
 
-- math.degrees(x)
+- math.degrees(x)  
 Return radians x converted to degrees.
 Return radians x converted to degrees.
 
 
-- math.erf(x)
+- math.erf(x)  
 Return the error function of x.
 Return the error function of x.
 
 
-- math.erfc(x)
+- math.erfc(x)  
 Return the complementary error function of x.
 Return the complementary error function of x.
 
 
-- math.exp(x)
+- math.exp(x)  
 Return the exponential of x.
 Return the exponential of x.
 
 
-- math.expm1(x)
+- math.expm1(x)  
 Return exp(x) - 1.
 Return exp(x) - 1.
 
 
-- math.fabs(x)
+- math.fabs(x)  
 Return the absolute value of x.
 Return the absolute value of x.
 
 
-- math.floor(x)
+- math.floor(x)  
 Return an integer, being x rounded towards negative infinity.
 Return an integer, being x rounded towards negative infinity.
 
 
-- math.fmod(x, y)
+- math.fmod(x, y)  
 Return the remainder of x/y.
 Return the remainder of x/y.
 
 
-- math.frexp(x)
+- math.frexp(x)  
 Decomposes a floating-point number into its mantissa and exponent. The returned value is the tuple (m, e) such that x == m * 2**e exactly. If x == 0 then the function returns (0.0, 0), otherwise the relation 0.5 <= abs(m) < 1 holds.
 Decomposes a floating-point number into its mantissa and exponent. The returned value is the tuple (m, e) such that x == m * 2**e exactly. If x == 0 then the function returns (0.0, 0), otherwise the relation 0.5 <= abs(m) < 1 holds.
 
 
-- math.gamma(x)
+- math.gamma(x)  
 Return the gamma function of x.
 Return the gamma function of x.
 
 
-- math.isfinite(x)
+- math.isfinite(x)  
 Return True if x is finite.
 Return True if x is finite.
 
 
-- math.isinf(x)
+- math.isinf(x)  
 Return True if x is infinite.
 Return True if x is infinite.
 
 
-- math.isnan(x)
+- math.isnan(x)  
 Return True if x is not-a-number
 Return True if x is not-a-number
 
 
-- math.ldexp(x, exp)
+- math.ldexp(x, exp)  
 Return x * (2**exp).
 Return x * (2**exp).
 
 
-- math.lgamma(x)
+- math.lgamma(x)  
 Return the natural logarithm of the gamma function of x.
 Return the natural logarithm of the gamma function of x.
 
 
-- math.log(x)
+- math.log(x)  
 Return the natural logarithm of x.
 Return the natural logarithm of x.
 
 
-- math.log10(x)
+- math.log10(x)  
 Return the base-10 logarithm of x.
 Return the base-10 logarithm of x.
 
 
-- math.log2(x)
+- math.log2(x)  
 Return the base-2 logarithm of x.
 Return the base-2 logarithm of x.
 
 
-- math.modf(x)
+- math.modf(x)  
 Return a tuple of two floats, being the fractional and integral parts of x. Both return values have the same sign as x.
 Return a tuple of two floats, being the fractional and integral parts of x. Both return values have the same sign as x.
 
 
-- math.pow(x, y)
+- math.pow(x, y)  
 Returns x to the power of y.
 Returns x to the power of y.
 
 
-- math.radians(x)
+- math.radians(x)  
 Return degrees x converted to radians.
 Return degrees x converted to radians.
 
 
-- math.sin(x)
+- math.sin(x)  
 Return the sine of x.
 Return the sine of x.
 
 
-- math.sinh(x)
+- math.sinh(x)  
 Return the hyperbolic sine of x.
 Return the hyperbolic sine of x.
 
 
-- math.sqrt(x)
+- math.sqrt(x)  
 Return the square root of x.
 Return the square root of x.
 
 
-- math.tan(x)
+- math.tan(x)  
 Return the tangent of x.
 Return the tangent of x.
 
 
-- math.tanh(x)
+- math.tanh(x)  
 Return the hyperbolic tangent of x.
 Return the hyperbolic tangent of x.
 
 
-- math.trunc(x)
+- math.trunc(x)  
 返回一个整数, x 接近于0。
 返回一个整数, x 接近于0。
 
 
 `常数`
 `常数`
 
 
-- math.e
+- math.e  
 自然对数的底
 自然对数的底
 
 
-- math.pi
+- math.pi  
 圆周率
 圆周率
 
 
 ----------
 ----------
@@ -291,23 +291,23 @@ Return the hyperbolic tangent of x.
 
 
 `函数`
 `函数`
 
 
-- uio.open(name, mode='r', **kwargs)
+- uio.open(name, mode='r', **kwargs)  
 打开一个文件,关联到内建函数``open()``。所有端口 (用于访问文件系统) 需要支持模式参数,但支持其他参数不同的端口。
 打开一个文件,关联到内建函数``open()``。所有端口 (用于访问文件系统) 需要支持模式参数,但支持其他参数不同的端口。
 
 
 `类`
 `类`
 
 
-- class uio.FileIO(...)
+- class uio.FileIO(...)  
 这个文件类型用二进制方式打开文件,等于使用``open(name, “rb”)``。 不应直接使用这个实例。
 这个文件类型用二进制方式打开文件,等于使用``open(name, “rb”)``。 不应直接使用这个实例。
 
 
-- class uio.TextIOWrapper(...)
+- class uio.TextIOWrapper(...)  
 这个类型以文本方式打开文件,等同于使用``open(name, “rt”)``不应直接使用这个实例。
 这个类型以文本方式打开文件,等同于使用``open(name, “rt”)``不应直接使用这个实例。
 
 
-- class uio.StringIO([string])
+- class uio.StringIO([string])  
 
 
-- class uio.BytesIO([string])
+- class uio.BytesIO([string])  
 内存文件对象。StringIO 用于文本模式 I/O (用 “t” 打开文件),BytesIO 用于二进制方式 (用 “b” 方式)。文件对象的初始内容可以用字符串参数指定(stringio用普通字符串,bytesio用byets对象)。所有的文件方法,如 read(), write(), seek(), flush(), close() 都可以用在这些对象上,包括下面方法:
 内存文件对象。StringIO 用于文本模式 I/O (用 “t” 打开文件),BytesIO 用于二进制方式 (用 “b” 方式)。文件对象的初始内容可以用字符串参数指定(stringio用普通字符串,bytesio用byets对象)。所有的文件方法,如 read(), write(), seek(), flush(), close() 都可以用在这些对象上,包括下面方法:
 
 
-- getvalue()
+- getvalue()  
 获取缓存区内容。
 获取缓存区内容。
 
 
 ----------
 ----------
@@ -319,7 +319,7 @@ Return the hyperbolic tangent of x.
 
 
 `类`
 `类`
 
 
-- ucollections.namedtuple(name, fields)
+- ucollections.namedtuple(name, fields)  
 这是工厂函数创建一个新的 namedtuple 型与一个特定的字段名称和集合。namedtuple 是元组允许子类要访问它的字段不仅是数字索引,而且还具有属性使用符号字段名访问语法。 字段是字符串序列指定字段名称。为了兼容的实现也可以用空间分隔的字符串命名的字段(但效率较低) 使用示例:
 这是工厂函数创建一个新的 namedtuple 型与一个特定的字段名称和集合。namedtuple 是元组允许子类要访问它的字段不仅是数字索引,而且还具有属性使用符号字段名访问语法。 字段是字符串序列指定字段名称。为了兼容的实现也可以用空间分隔的字符串命名的字段(但效率较低) 使用示例:
 
 
 ```python
 ```python
@@ -369,19 +369,19 @@ b 3
 
 
 `函数`
 `函数`
 
 
-- ustruct.calcsize(fmt)
+- ustruct.calcsize(fmt)  
 返回需要的字节数`fmt`。
 返回需要的字节数`fmt`。
 
 
-- ustruct.pack(fmt, v1, v2, ...)
+- ustruct.pack(fmt, v1, v2, ...)  
 按照字符串格式`fmt` 压缩参数 v1, v2, ... 。 返回值是参数编码后的字节对象。
 按照字符串格式`fmt` 压缩参数 v1, v2, ... 。 返回值是参数编码后的字节对象。
 
 
-- ustruct.pack_into(fmt, buffer, offset, v1, v2, ...)
+- ustruct.pack_into(fmt, buffer, offset, v1, v2, ...)  
 按照字符串格式`fmt` 压缩参数 v1, v2, ... 到缓冲区`buffer`,开始位置是`offset`。`offset`可以是负数,从缓冲区末尾开始计数。
 按照字符串格式`fmt` 压缩参数 v1, v2, ... 到缓冲区`buffer`,开始位置是`offset`。`offset`可以是负数,从缓冲区末尾开始计数。
 
 
-- ustruct.unpack(fmt, data)
+- ustruct.unpack(fmt, data)  
 按照字符串格式`fmt`解压数据`data`。 返回值是解压后参数的元组。
 按照字符串格式`fmt`解压数据`data`。 返回值是解压后参数的元组。
 
 
-- ustruct.unpack_from(fmt, data, offset=0)
+- ustruct.unpack_from(fmt, data, offset=0)  
 从 fmt 的 offset 开始解压数据,如果 offset 是负数就是从缓冲区末尾开始计算。 返回值是解压后参数元组。
 从 fmt 的 offset 开始解压数据,如果 offset 是负数就是从缓冲区末尾开始计算。 返回值是解压后参数元组。
 
 
 ----------
 ----------
@@ -394,13 +394,13 @@ b 3
 
 
 `类`
 `类`
 
 
-- class array.array(typecode[, iterable])
+- class array.array(typecode[, iterable])  
 指定类型创建数组元素。用可选项[]做为数组的初始值,可选项[]未指定的,则创建空数组。
 指定类型创建数组元素。用可选项[]做为数组的初始值,可选项[]未指定的,则创建空数组。
 
 
-- append(val)
+- append(val)  
 将新元素添加到数组的结尾,并将其扩展。
 将新元素添加到数组的结尾,并将其扩展。
 
 
-- extend(iterable)
+- extend(iterable)  
 使用迭代方式将新元素添加到数组的结尾,并将其扩展。
 使用迭代方式将新元素添加到数组的结尾,并将其扩展。
 
 
 ----------
 ----------
@@ -411,19 +411,19 @@ b 3
 
 
 `函数`
 `函数`
 
 
-- gc.enable()
+- gc.enable()  
 启动自动垃圾回收。
 启动自动垃圾回收。
 
 
-- gc.disable()
+- gc.disable()  
 禁用自动垃圾回收。 堆内存仍然可以分配,垃圾回收仍然可以手动启动使用 gc.collect().
 禁用自动垃圾回收。 堆内存仍然可以分配,垃圾回收仍然可以手动启动使用 gc.collect().
 
 
-- gc.collect()
+- gc.collect()  
 运行垃圾回收。
 运行垃圾回收。
 
 
-- gc.mem_alloc()
+- gc.mem_alloc()  
 返回分配的堆RAM的字节数。
 返回分配的堆RAM的字节数。
 
 
-- gc.mem_free()
+- gc.mem_free()  
 返回可用堆内存的字节数。
 返回可用堆内存的字节数。
 
 
 ----------
 ----------

+ 12 - 12
docs/Development_manual_document_section/04-Hardware_Control_Module.md

@@ -11,32 +11,32 @@
 
 
 `复位功能`
 `复位功能`
 
 
-- machine.reset()
+- machine.reset()  
 重置设备的方式类似类似按下 rst 按钮。
 重置设备的方式类似类似按下 rst 按钮。
 
 
-- machine.reset_cause()
+- machine.reset_cause()  
 Get the reset cause. See constants for the possible return values.
 Get the reset cause. See constants for the possible return values.
 
 
 `中断功能`
 `中断功能`
 
 
-- machine.disable_irq()
+- machine.disable_irq()  
 Disable interrupt requests. Returns the previous IRQ state which should be considered an opaque value. This return value should be passed to the enable_irq function to restore interrupts to their original state, before disable_irq was called.
 Disable interrupt requests. Returns the previous IRQ state which should be considered an opaque value. This return value should be passed to the enable_irq function to restore interrupts to their original state, before disable_irq was called.
 
 
-- machine.enable_irq(state)
+- machine.enable_irq(state)  
 Re-enable interrupt requests. The state parameter should be the value that was returned from the most recent call to the disable_irq function.
 Re-enable interrupt requests. The state parameter should be the value that was returned from the most recent call to the disable_irq function.
 
 
 `有效的相关功能`
 `有效的相关功能`
 
 
-- machine.freq()
+- machine.freq()  
 Returns CPU frequency in hertz.
 Returns CPU frequency in hertz.
 
 
-- machine.idle()
+- machine.idle()  
 Gates the clock to the CPU, useful to reduce power consumption at any time during short or long periods. Peripherals continue working and execution resumes as soon as any interrupt is triggered (on many ports this includes system timer interrupt occurring at regular intervals on the order of millisecond).
 Gates the clock to the CPU, useful to reduce power consumption at any time during short or long periods. Peripherals continue working and execution resumes as soon as any interrupt is triggered (on many ports this includes system timer interrupt occurring at regular intervals on the order of millisecond).
 
 
-- machine.sleep()
+- machine.sleep()  
 Stops the CPU and disables all peripherals except for WLAN. Execution is resumed from the point where the sleep was requested. For wake up to actually happen, wake sources should be configured first.
 Stops the CPU and disables all peripherals except for WLAN. Execution is resumed from the point where the sleep was requested. For wake up to actually happen, wake sources should be configured first.
 
 
-- machine.deepsleep()
+- machine.deepsleep()  
 Stops the CPU and all peripherals (including networking interfaces, if any). Execution is resumed from the main script, just as with a reset. The reset cause can be checked to know that we are coming from machine.DEEPSLEEP. For wake up to actually happen, wake sources should be configured first, like Pin change or RTC timeout.
 Stops the CPU and all peripherals (including networking interfaces, if any). Execution is resumed from the main script, just as with a reset. The reset cause can be checked to know that we are coming from machine.DEEPSLEEP. For wake up to actually happen, wake sources should be configured first, like Pin change or RTC timeout.
 
 
 `example`:
 `example`:
@@ -77,7 +77,7 @@ GC:
 
 
 `类`
 `类`
 
 
-- machine.Pin
+- machine.Pin  
 更多内容可参考 [machine.Pin](http://docs.micropython.org/en/latest/pyboard/library/machine.Pin.html)  。
 更多内容可参考 [machine.Pin](http://docs.micropython.org/en/latest/pyboard/library/machine.Pin.html)  。
 
 
 `example`:
 `example`:
@@ -92,7 +92,7 @@ GC:
 >>> p_in.value()                # get value, 0 or 1
 >>> p_in.value()                # get value, 0 or 1
 ```
 ```
 
 
-- machine.I2C
+- machine.I2C  
 更多内容可参考 [machine.I2C](http://docs.micropython.org/en/latest/pyboard/library/machine.I2C.html) 。
 更多内容可参考 [machine.I2C](http://docs.micropython.org/en/latest/pyboard/library/machine.I2C.html) 。
 
 
 `software I2C example ` :
 `software I2C example ` :
@@ -121,7 +121,7 @@ b'\x12'                               # starting at memory-address 8 in the slav
 [81]                                  # Decimal representation
 [81]                                  # Decimal representation
 ```
 ```
 
 
-- machine.SPI
+- machine.SPI  
 更多内容可参考 [machine.SPI](http://docs.micropython.org/en/latest/pyboard/library/machine.SPI.html) 。
 更多内容可参考 [machine.SPI](http://docs.micropython.org/en/latest/pyboard/library/machine.SPI.html) 。
 
 
 `software SPI example ` :
 `software SPI example ` :
@@ -154,6 +154,6 @@ bytearray(b'\xef')
 >>> spi.init(100000,0,0,8,1)     # Resetting SPI parameter
 >>> spi.init(100000,0,0,8,1)     # Resetting SPI parameter
 ```
 ```
 
 
-- machine.UART
+- machine.UART  
 
 
 ----------
 ----------

+ 26 - 26
docs/Development_manual_document_section/05-System_Module.md

@@ -11,13 +11,13 @@
 
 
 `函数`
 `函数`
 
 
-- uos.chdir(path)
+- uos.chdir(path)  
 更改当前目录。
 更改当前目录。
 
 
-- uos.getcwd()
+- uos.getcwd()  
 获取当前目录。
 获取当前目录。
 
 
-- uos.ilistdir([dir])
+- uos.ilistdir([dir])  
 这个函数返回一个迭代器,然后产生三元组对应正在列出的目录中的条目。没有参数,它列出了
 这个函数返回一个迭代器,然后产生三元组对应正在列出的目录中的条目。没有参数,它列出了
 当前目录,否则它列出了目录给出的`dir`。
 当前目录,否则它列出了目录给出的`dir`。
 
 
@@ -28,22 +28,22 @@ inode 对应文件的inode的整数,可0的文件系统,没有这样的概
 uos.listdir([dir])
 uos.listdir([dir])
 没有参数,列出当前目录。否则列出给定目录。
 没有参数,列出当前目录。否则列出给定目录。
 
 
-- uos.mkdir(path)
+- uos.mkdir(path)  
 创建一个目录。
 创建一个目录。
 
 
-- uos.remove(path)
+- uos.remove(path)  
 删除文件。
 删除文件。
 
 
-- uos.rmdir(path)
+- uos.rmdir(path)  
 删除目录。
 删除目录。
 
 
-- uos.rename(old_path, new_path)
+- uos.rename(old_path, new_path)  
 重命名文件。
 重命名文件。
 
 
-- uos.stat(path)
+- uos.stat(path)  
 获取文件或目录的状态。
 获取文件或目录的状态。
 
 
-- uos.sync()
+- uos.sync()  
 同步所有的文件系统。
 同步所有的文件系统。
 
 
 `example`:
 `example`:
@@ -76,37 +76,37 @@ stat            unlink          mount           umount
 
 
 `函数`
 `函数`
 
 
-- select.poll()
+- select.poll()  
 创建轮询类的实例。
 创建轮询类的实例。
 
 
-- select.select(rlist, wlist, xlist[, timeout])
+- select.select(rlist, wlist, xlist[, timeout])  
 等待激活一组对象。
 等待激活一组对象。
 
 
 提供的兼容性和效率不高,推荐使用 `Poll`。
 提供的兼容性和效率不高,推荐使用 `Poll`。
 
 
 `eventmask` 
 `eventmask` 
 
 
-- select.POLLIN - 读取可用数据
+- select.POLLIN - 读取可用数据  
 
 
-- select.POLLOUT - 写入更多数据
+- select.POLLOUT - 写入更多数据  
 
 
-- select.POLLERR - 发生错误
+- select.POLLERR - 发生错误  
 
 
-- select.POLLHUP - 流结束/连接终止检测
+- select.POLLHUP - 流结束/连接终止检测  
 eventmask 默认 select.POLLIN | select.POLLOUT.
 eventmask 默认 select.POLLIN | select.POLLOUT.
 
 
 `类 Poll`
 `类 Poll`
 
 
-- poll.register(obj[, eventmask])
+- poll.register(obj[, eventmask])  
 登记轮询对象 obj 。 
 登记轮询对象 obj 。 
 
 
-- poll.unregister(obj)
+- poll.unregister(obj)  
 注销轮询对象 obj。
 注销轮询对象 obj。
 
 
-- poll.modify(obj, eventmask)
+- poll.modify(obj, eventmask)  
 修改对象 ``obj`` 的 eventmask。
 修改对象 ``obj`` 的 eventmask。
 
 
-- poll.poll([timeout])
+- poll.poll([timeout])  
 等待至少一个已注册的对象准备就绪。返回列表(obj, event, ...) 元组, event 元素指定了一个流发生的事件,是上面所描述的 `select.POLL*`常量组合。 在元组中可能有其他元素,取决于平台和版本,所以不要假定它的大小是2。如果超时,则返回空列表。超时为毫秒。
 等待至少一个已注册的对象准备就绪。返回列表(obj, event, ...) 元组, event 元素指定了一个流发生的事件,是上面所描述的 `select.POLL*`常量组合。 在元组中可能有其他元素,取决于平台和版本,所以不要假定它的大小是2。如果超时,则返回空列表。超时为毫秒。
 
 
 ----------
 ----------
@@ -116,25 +116,25 @@ eventmask 默认 select.POLLIN | select.POLLOUT.
 
 
 更多内容可参考 [ctypes](https://docs.python.org/3/library/ctypes.html?highlight=ctypes#module-ctypes) 。
 更多内容可参考 [ctypes](https://docs.python.org/3/library/ctypes.html?highlight=ctypes#module-ctypes) 。
 
 
-- uctypes.LITTLE_ENDIAN
+- uctypes.LITTLE_ENDIAN  
 Layout type for a little-endian packed structure. (Packed means that every field occupies exactly as many bytes as defined in the descriptor, i.e. the alignment is 1).
 Layout type for a little-endian packed structure. (Packed means that every field occupies exactly as many bytes as defined in the descriptor, i.e. the alignment is 1).
 
 
-- uctypes.BIG_ENDIAN
+- uctypes.BIG_ENDIAN  
 Layout type for a big-endian packed structure.
 Layout type for a big-endian packed structure.
 
 
-- uctypes.NATIVE
+- uctypes.NATIVE  
 Layout type for a native structure - with data endianness and alignment conforming to the ABI of the system on which MicroPython runs.
 Layout type for a native structure - with data endianness and alignment conforming to the ABI of the system on which MicroPython runs.
 
 
-- uctypes.sizeof(struct)
+- uctypes.sizeof(struct)  
 Return size of data structure in bytes. Argument can be either structure class or specific instantiated structure object (or its aggregate field).
 Return size of data structure in bytes. Argument can be either structure class or specific instantiated structure object (or its aggregate field).
 
 
-- uctypes.addressof(obj)
+- uctypes.addressof(obj)  
 Return address of an object. Argument should be bytes, bytearray or other object supporting buffer protocol (and address of this buffer is what actually returned).
 Return address of an object. Argument should be bytes, bytearray or other object supporting buffer protocol (and address of this buffer is what actually returned).
 
 
-- uctypes.bytes_at(addr, size)
+- uctypes.bytes_at(addr, size)  
 Capture memory at the given address and size as bytes object. As bytes object is immutable, memory is actually duplicated and copied into bytes object, so if memory contents change later, created object retains original value.
 Capture memory at the given address and size as bytes object. As bytes object is immutable, memory is actually duplicated and copied into bytes object, so if memory contents change later, created object retains original value.
 
 
-- uctypes.bytearray_at(addr, size)
+- uctypes.bytearray_at(addr, size)  
 Capture memory at the given address and size as bytearray object. Unlike bytes_at() function above, memory is captured by reference, so it can be both written too, and you will access current value at the given memory address.
 Capture memory at the given address and size as bytearray object. Unlike bytes_at() function above, memory is captured by reference, so it can be both written too, and you will access current value at the given memory address.
 
 
 ----------
 ----------

+ 43 - 43
docs/Development_manual_document_section/06-Tools_Module.md

@@ -10,39 +10,39 @@
 
 
 `函数`
 `函数`
 
 
-- cmath.cos(z)
+- cmath.cos(z)  
 返回``z``的余弦。
 返回``z``的余弦。
 
 
-- cmath.exp(z)
+- cmath.exp(z)  
 返回``z``的指数。
 返回``z``的指数。
 
 
-- cmath.log(z)
+- cmath.log(z)  
 返回``z``的对数。
 返回``z``的对数。
 
 
-- cmath.log10(z)
+- cmath.log10(z)  
 返回``z``的常用对数。
 返回``z``的常用对数。
 
 
-- cmath.phase(z)
+- cmath.phase(z)  
 返回``z``的相位, 范围是(-pi, +pi],以弧度表示。
 返回``z``的相位, 范围是(-pi, +pi],以弧度表示。
 
 
-- cmath.polar(z)
+- cmath.polar(z)  
 返回``z``的极坐标.
 返回``z``的极坐标.
 
 
-- cmath.rect(r, phi)
+- cmath.rect(r, phi)  
 返回`模量`r``和相位``phi``的复数。
 返回`模量`r``和相位``phi``的复数。
 
 
-- cmath.sin(z)
+- cmath.sin(z)  
 返回``z``的正弦。
 返回``z``的正弦。
 
 
-- cmath.sqrt(z)
+- cmath.sqrt(z)  
 返回``z``的平方根。
 返回``z``的平方根。
 
 
 `常数`
 `常数`
 
 
-- cmath.e
+- cmath.e  
 自然对数的指数。
 自然对数的指数。
 
 
-- cmath.pi
+- cmath.pi  
 圆周率。
 圆周率。
 
 
 ----------
 ----------
@@ -55,19 +55,19 @@
 
 
 `函数`
 `函数`
 
 
-- ubinascii.hexlify(data[, sep])
+- ubinascii.hexlify(data[, sep])  
 将二进制数据转换为十六进制表示。
 将二进制数据转换为十六进制表示。
 
 
-- Difference to CPython
+- Difference to CPython  
 If additional argument, sep is supplied, it is used as a separator between hexadecimal values.
 If additional argument, sep is supplied, it is used as a separator between hexadecimal values.
 
 
-- ubinascii.unhexlify(data)
+- ubinascii.unhexlify(data)  
 将十六进制数据转换为二进制表示。返回字节串 (换言之, 反二进制转换)
 将十六进制数据转换为二进制表示。返回字节串 (换言之, 反二进制转换)
 
 
-- ubinascii.a2b_base64(data)
+- ubinascii.a2b_base64(data)  
 Base64编码的数据转换为二进制表示。返回字节串。
 Base64编码的数据转换为二进制表示。返回字节串。
 
 
-- ubinascii.b2a_base64(data)
+- ubinascii.b2a_base64(data)  
 编码base64格式的二进制数据。返回的字符串。
 编码base64格式的二进制数据。返回的字符串。
 
 
 ----------
 ----------
@@ -87,22 +87,22 @@ MD5 - A legacy algorithm, not considered cryptographically secure. Only selected
 
 
 `函数`
 `函数`
 
 
-- class uhashlib.sha256([data])
+- class uhashlib.sha256([data])  
 创建一个SHA256哈希对象并提供 data 赋值。
 创建一个SHA256哈希对象并提供 data 赋值。
 
 
-- class uhashlib.sha1([data])
+- class uhashlib.sha1([data])  
 创建一个SHA1哈希对象并提供 data 赋值。
 创建一个SHA1哈希对象并提供 data 赋值。
 
 
-- class uhashlib.md5([data])
+- class uhashlib.md5([data])  
 创建一个MD5哈希对象并提供 data 赋值。
 创建一个MD5哈希对象并提供 data 赋值。
 
 
-- hash.update(data)
+- hash.update(data)  
 将更多二进制数据放入哈希表中。
 将更多二进制数据放入哈希表中。
 
 
-- hash.digest()
+- hash.digest()  
 返回字节对象哈希的所有数据。调用此方法后,将无法将更多数据送入哈希。
 返回字节对象哈希的所有数据。调用此方法后,将无法将更多数据送入哈希。
 
 
-- hash.hexdigest()
+- hash.hexdigest()  
 此方法没有实现, 使用 ubinascii.hexlify(hash.digest()) 达到类似效果。
 此方法没有实现, 使用 ubinascii.hexlify(hash.digest()) 达到类似效果。
 
 
 ----------
 ----------
@@ -115,13 +115,13 @@ MD5 - A legacy algorithm, not considered cryptographically secure. Only selected
 
 
 `函数`
 `函数`
 
 
-- uheapq.heappush(heap, item)
+- uheapq.heappush(heap, item)  
 把 item 推到 heap。
 把 item 推到 heap。
 
 
-- uheapq.heappop(heap)
+- uheapq.heappop(heap)  
 从 heap 弹出第一个元素并返回。 如果是堆时空的会抛出 IndexError。
 从 heap 弹出第一个元素并返回。 如果是堆时空的会抛出 IndexError。
 
 
-- uheapq.heapify(x)
+- uheapq.heapify(x)  
 将列表 x 转换成堆。
 将列表 x 转换成堆。
 
 
 ----------
 ----------
@@ -133,10 +133,10 @@ MD5 - A legacy algorithm, not considered cryptographically secure. Only selected
 
 
 `函数`
 `函数`
 
 
-- ujson.dumps(obj)
+- ujson.dumps(obj)  
 返回 obj JSON字符串。
 返回 obj JSON字符串。
 
 
-- ujson.loads(str)
+- ujson.loads(str)  
 解析 str 字符串并返回对象。如果字符串格式错误将引发 ValueError 异常。
 解析 str 字符串并返回对象。如果字符串格式错误将引发 ValueError 异常。
 
 
 ----------
 ----------
@@ -166,31 +166,31 @@ MD5 - A legacy algorithm, not considered cryptographically secure. Only selected
 
 
 `函数`
 `函数`
 
 
-- ure.compile(regex)
+- ure.compile(regex)  
 编译正则表达式,返回 regex 对象。
 编译正则表达式,返回 regex 对象。
 
 
-- ure.match(regex, string)
+- ure.match(regex, string)  
 用 string 匹配 regex,匹配总是从字符串的开始匹配。
 用 string 匹配 regex,匹配总是从字符串的开始匹配。
 
 
-- ure.search(regex, string)
+- ure.search(regex, string)  
 在 string 中搜索 regex。不同于匹配,它搜索第一个匹配位置的正则表达式字符串 (结果可能会是0)。
 在 string 中搜索 regex。不同于匹配,它搜索第一个匹配位置的正则表达式字符串 (结果可能会是0)。
 
 
-- ure.DEBUG
+- ure.DEBUG  
 标志值,显示表达式的调试信息。
 标志值,显示表达式的调试信息。
 
 
 **正则表达式对象**:
 **正则表达式对象**:
 
 
 编译正则表达式,使用 `ure.compile()` 创建实例。
 编译正则表达式,使用 `ure.compile()` 创建实例。
 
 
-- regex.match(string)
-- regex.search(string)
-- regex.split(string, max_split=-1)
+- regex.match(string)  
+- regex.search(string)  
+- regex.split(string, max_split=-1)  
 
 
 **匹配对象** :
 **匹配对象** :
 
 
 匹配对象是 match() 和 search() 方法的返回值。
 匹配对象是 match() 和 search() 方法的返回值。
 
 
-- match.group([index])
+- match.group([index])  
 只支持数字组。
 只支持数字组。
 
 
 ----------
 ----------
@@ -203,7 +203,7 @@ MD5 - A legacy algorithm, not considered cryptographically secure. Only selected
 
 
 `函数`
 `函数`
 
 
-- uzlib.decompress(data)
+- uzlib.decompress(data)  
 返回解压后的 bytes 数据。
 返回解压后的 bytes 数据。
 
 
 ----------
 ----------
@@ -215,27 +215,27 @@ MD5 - A legacy algorithm, not considered cryptographically secure. Only selected
 
 
 `函数` 
 `函数` 
 
 
-- urandom.choice()
+- urandom.choice()  
 Return a random element from the non-empty sequence seq. If seq is empty, raises IndexError.
 Return a random element from the non-empty sequence seq. If seq is empty, raises IndexError.
 
 
-- urandom.getrandbits()
+- urandom.getrandbits()  
 Returns a Python integer with k random bits. This method is supplied with the MersenneTwister generator and some other generators may also provide it as an optional part of the API. When available, getrandbits() enables randrange() to handle arbitrarily large ranges.
 Returns a Python integer with k random bits. This method is supplied with the MersenneTwister generator and some other generators may also provide it as an optional part of the API. When available, getrandbits() enables randrange() to handle arbitrarily large ranges.
 
 
-- urandom.randint()
+- urandom.randint()  
 Return a random integer N such that a <= N <= b. Alias for randrange(a, b+1).
 Return a random integer N such that a <= N <= b. Alias for randrange(a, b+1).
 
 
-- urandom.random()
+- urandom.random()  
 Return the next random floating point number in the range [0.0, 1.0).
 Return the next random floating point number in the range [0.0, 1.0).
 
 
-- urandom.randrange()
+- urandom.randrange()  
 Return a randomly selected element from range(start, stop, step). This is equivalent to choice(range(start, stop, step)), but doesn’t actually build a range object.
 Return a randomly selected element from range(start, stop, step). This is equivalent to choice(range(start, stop, step)), but doesn’t actually build a range object.
 
 
 
 
-- urandom.seed()
+- urandom.seed()  
 Initialize the random number generator.
 Initialize the random number generator.
 If a is omitted or None, the current system time is used. If randomness sources are provided by the operating system, they are used instead of the system time (see the os.urandom() function for details on availability).
 If a is omitted or None, the current system time is used. If randomness sources are provided by the operating system, they are used instead of the system time (see the os.urandom() function for details on availability).
 
 
-- urandom.uniform()
+- urandom.uniform()  
 Return a random floating point number N such that a <= N <= b for a <= b and b <= N <= a for b < a.
 Return a random floating point number N such that a <= N <= b for a <= b and b <= N <= a for b < a.
 The end-point value b may or may not be included in the range depending on floating-point rounding in the equation a + (b-a) * random().
 The end-point value b may or may not be included in the range depending on floating-point rounding in the equation a + (b-a) * random().
 
 

+ 29 - 28
docs/Development_manual_document_section/07-Network_Module.md

@@ -10,88 +10,89 @@
 
 
 `常数`
 `常数`
 
 
-- socket.AF_INET
-- socket.AF_INET6
+- socket.AF_INET  
+- socket.AF_INET6  
 
 
 `TCP类型定义`
 `TCP类型定义`
 
 
-- socket.SOCK_STREAM
-- socket.SOCK_DGRAM
+- socket.SOCK_STREAM  
+- socket.SOCK_DGRAM  
 
 
 `Socket类型`
 `Socket类型`
 
 
-- socket.IPPROTO_UDP
-- socket.IPPROTO_TCP
+- socket.IPPROTO_UDP  
+- socket.IPPROTO_TCP  
 
 
 `IP协议号`
 `IP协议号`
 
 
-- socket.SOL_*
+- socket.SOL_*  
 Socket option levels (an argument to setsockopt()). The exact inventory depends on a board.
 Socket option levels (an argument to setsockopt()). The exact inventory depends on a board.
 
 
-- socket.SO_*
+- socket.SO_*  
 Socket options (an argument to setsockopt()). The exact inventory depends on a board.
 Socket options (an argument to setsockopt()). The exact inventory depends on a board.
 
 
-- socket.IPPROTO_SEC
+- socket.IPPROTO_SEC  
 Special protocol value to create SSL-compatible socket.
 Special protocol value to create SSL-compatible socket.
 
 
 `函数`
 `函数`
 
 
-- socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP)
+- socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP)  
 创建新的套接字,使用指定的地址、类型和协议号。
 创建新的套接字,使用指定的地址、类型和协议号。
 
 
-- socket.getaddrinfo(host, port)
+- socket.getaddrinfo(host, port)  
 传递 主机/端口 到一个5个数据的元组。元组列表的结构如下:
 传递 主机/端口 到一个5个数据的元组。元组列表的结构如下:
 (family, type, proto, canonname, sockaddr)
 (family, type, proto, canonname, sockaddr)
 
 
-- socket.close()
+- socket.close()  
 关闭套接字。一旦关闭后,套接字所有的功能都将失效。远端将接收不到任何数据 (清理队列数据后)。 在回收垃圾时套接字会自动关闭,但还是推荐在必要时用 close() 去关闭,或, or to use a with statement around them。
 关闭套接字。一旦关闭后,套接字所有的功能都将失效。远端将接收不到任何数据 (清理队列数据后)。 在回收垃圾时套接字会自动关闭,但还是推荐在必要时用 close() 去关闭,或, or to use a with statement around them。
 
 
-- socket.bind(address)
+- socket.bind(address)  
 将套接字绑定到地址,套接字不能是已经绑定的。
 将套接字绑定到地址,套接字不能是已经绑定的。
 
 
-- socket.listen([backlog])
+- socket.listen([backlog])  
 允许服务器接收连接。如果指定了 backlog,它不能小于0 (如果小于0将自动设置为0);超出后系统将拒绝新的连接。如果没有指定,将使用默认值。
 允许服务器接收连接。如果指定了 backlog,它不能小于0 (如果小于0将自动设置为0);超出后系统将拒绝新的连接。如果没有指定,将使用默认值。
 
 
-- socket.accept()
+- socket.accept()  
 接收连接。套接字需要指定地址并监听连接。返回值是 (conn, address),其中conn是用来接收和发送数据的套接字,address是绑定到另一端的套接字。
 接收连接。套接字需要指定地址并监听连接。返回值是 (conn, address),其中conn是用来接收和发送数据的套接字,address是绑定到另一端的套接字。
 
 
-- socket.connect(address)
+- socket.connect(address)  
 连接到指定地址的远端套接字。
 连接到指定地址的远端套接字。
 
 
-- socket.send(bytes)
+- socket.send(bytes)  
 发送数据。套接字需要已连接到远程。
 发送数据。套接字需要已连接到远程。
 
 
-- socket.sendall(bytes)
+- socket.sendall(bytes)  
 发送数据。套接字已连接到远程。 Unlike send(), this method will try to send all of data, by sending data chunk by chunk consecutively.
 发送数据。套接字已连接到远程。 Unlike send(), this method will try to send all of data, by sending data chunk by chunk consecutively.
-- socket.recv(bufsize)
+
+- socket.recv(bufsize)  
 接收数据,返回值是数据字节对象。bufsize是接收数据的最大数量。
 接收数据,返回值是数据字节对象。bufsize是接收数据的最大数量。
 
 
-- socket.sendto(bytes, address)
+- socket.sendto(bytes, address)  
 发送数据。套接字没有连接到远程,目标套接字由地址参数指定。
 发送数据。套接字没有连接到远程,目标套接字由地址参数指定。
 
 
-- socket.recvfrom(bufsize)
+- socket.recvfrom(bufsize)  
 接收数据。返回值是 (bytes, address),其中 bytes 是字节对象,address 是发送数据的套接字。
 接收数据。返回值是 (bytes, address),其中 bytes 是字节对象,address 是发送数据的套接字。
 
 
-- socket.setsockopt(level, optname, value)
+- socket.setsockopt(level, optname, value)  
 设置套接字参数。需要的符号常数定义在套接字模块 (SO_* 等)。value 可以是整数或字节对象。
 设置套接字参数。需要的符号常数定义在套接字模块 (SO_* 等)。value 可以是整数或字节对象。
 
 
-- socket.settimeout(value)
+- socket.settimeout(value)  
 设置阻塞套接字超时时间。value 参数可以是代表秒的正浮点数或 None。如果设定大于 0 的参数,在后面套接字操作超出指定时间后将引起 timeout 异常。如果参数是 0,套接字将使用非阻塞模式。如果是 None,套接字使用阻塞模式。
 设置阻塞套接字超时时间。value 参数可以是代表秒的正浮点数或 None。如果设定大于 0 的参数,在后面套接字操作超出指定时间后将引起 timeout 异常。如果参数是 0,套接字将使用非阻塞模式。如果是 None,套接字使用阻塞模式。
 
 
-- socket.setblocking(flag)
+- socket.setblocking(flag)  
 设置阻塞或非阻塞模式: 如果 flag 是 false,设置非阻塞模式。
 设置阻塞或非阻塞模式: 如果 flag 是 false,设置非阻塞模式。
 
 
-- socket.read([size])
+- socket.read([size])  
 Read up to size bytes from the socket. Return a bytes object. If size is not given, it reads all data available from the socket until EOF; as such the method will not return until the socket is closed. This function tries to read as much data as requested (no “short reads”). This may be not possible with non-blocking socket though, and then less data will be returned.
 Read up to size bytes from the socket. Return a bytes object. If size is not given, it reads all data available from the socket until EOF; as such the method will not return until the socket is closed. This function tries to read as much data as requested (no “short reads”). This may be not possible with non-blocking socket though, and then less data will be returned.
 
 
-- socket.readinto(buf[, nbytes])
+- socket.readinto(buf[, nbytes])  
 Read bytes into the buf. If nbytes is specified then read at most that many bytes. Otherwise, read at most len(buf) bytes. Just as read(), this method follows “no short reads” policy.
 Read bytes into the buf. If nbytes is specified then read at most that many bytes. Otherwise, read at most len(buf) bytes. Just as read(), this method follows “no short reads” policy.
 Return value: number of bytes read and stored into buf.
 Return value: number of bytes read and stored into buf.
 
 
-- socket.readline()
+- socket.readline()  
 读取一行,以换行符结束,返回读取的数据行。
 读取一行,以换行符结束,返回读取的数据行。
 
 
-- socket.write(buf)
+- socket.write(buf)  
 Write the buffer of bytes to the socket. This function will try to write all data to a socket (no “short writes”). This may be not possible with a non-blocking socket though, and returned value will be less than the length of buf.
 Write the buffer of bytes to the socket. This function will try to write all data to a socket (no “short writes”). This may be not possible with a non-blocking socket though, and returned value will be less than the length of buf.
 Return value: number of bytes written.
 Return value: number of bytes written.