diff --git a/docs/API_reference/en/networklib/uwebsocket.md b/docs/API_reference/en/networklib/uwebsocket.md index 128c0f9938949e20f39c984d07ee3e0334732c6c..6a20ae986c15ee87263a5ddc203315a129a148c6 100644 --- a/docs/API_reference/en/networklib/uwebsocket.md +++ b/docs/API_reference/en/networklib/uwebsocket.md @@ -29,7 +29,7 @@ ws_client.send(msg) ``` **Parameter** -* `msg` – String type. The data to be sent. +* `msg` – String/Byte type. The data to be sent. @@ -43,7 +43,7 @@ ws_client.recv() **Return Value** -* `result `– String type. The returned result. When this value is null or None, the connection is closed. +* `result `– String/Byte type. The returned result. When this value is null or None, the connection is closed. diff --git a/docs/API_reference/en/peripherals/ethernet.DM9051.md b/docs/API_reference/en/peripherals/ethernet.DM9051.md index 8a3f3dbb8f4bda9dc8407eb56365f47219e45349..a90428585cb26e346a4e825b2d5a59fe982f4b14 100644 --- a/docs/API_reference/en/peripherals/ethernet.DM9051.md +++ b/docs/API_reference/en/peripherals/ethernet.DM9051.md @@ -2,14 +2,14 @@ This class controls Ethernet NIC devices of `DM9051`. -> Currently, only EC600N module series support this feature. +> Currently, only the EC600N/EG912N/EG915N series and EC800MCN_LE are supported. ## Constructor ### `ethernet.DM9051` ```python -class ethernet.DM9051(mac, ip='', subnet='', gateway='', spi_port=-1,spi_cs_pin=-1) +class ethernet.DM9051(mac, ip='', subnet='', gateway='', spi_port=-1, spi_cs_pin=-1, extint_pin=-1, reset_pin=-1, work_mode=0) ``` Loads DM9051 driver, initializes DM9051 Ethernet NIC and returns DM9051 NIC object. @@ -22,6 +22,11 @@ Loads DM9051 driver, initializes DM9051 Ethernet NIC and returns DM9051 NIC obje - `gateway` - Gateway address of Ethernet NIC. The default value is an empty string'', indicating that the last bit of IP address is replaced with `1` as the gateway address. - `spi_port` - Connect to [SPI port](./machine.SPI.md) of `DM9051`. The default value is `-1`, indicating that the last configured value is used and the default configuration in the program is `SPI1` port. - `spi_cs_pin` - Connect to `SPI` chip select [GPIO pin](./machine.Pin.md) of `DM9051`. The default value is `-1`, indicating that the last configured value is used and the default configuration in the program is `Pin.GPIO13`. +- `extint_pin` - Connect to external interrupt [GPIO pin](./machine.Pin.md) of `DM9051`. The default value is `-1`, indicating that the last configured value is used and the default configuration in the program is `Pin.GPIO19`. +- `reset_pin` - Connect to reset [GPIO pin](./machine.Pin.md) of `DM9051`. The default value is `-1`, indicating that the last configured value is used and the default configuration in the program is `Pin.GPIO17`. +- `work_mode` - Configure Ethernet working mode. The default mode is terminal mode. `0` and `1` respectively represents terminal mode and gateway mode. Terminal mode indicates that the module is used as a terminal device to connect to a network supply device to access the network. Gateway mode indicates that the module is used as a gateway to provide network access for external devices through LTE network. + +> The default value varies from platform to platform. It is recommended to define the available GPIO usage ## Methods diff --git a/docs/API_reference/en/peripherals/misc.USBNET.md b/docs/API_reference/en/peripherals/misc.USBNET.md index ce943fb4e2e0f82e77fce57e433ea1e5e318b197..9db9760c2c089965b86b06086a93b9809ea16815 100644 --- a/docs/API_reference/en/peripherals/misc.USBNET.md +++ b/docs/API_reference/en/peripherals/misc.USBNET.md @@ -106,9 +106,11 @@ USBNET.open() USBNET.getNat(simid, pid) ``` -Gets NAT enabling status of a specified network card (whether IPv6 dial-up is supported). +Gets NAT enabling status of a specified network card. -> Note: Only EC200U and EC600U series modules support this function. +> Note:Currently only EC200U/EC600U/EC800G series support. +> Note:If NAT mode is enabled for the EC200U/EC600U series, the pid of the enabled route cannot perform IPv6 dial-up. +> Note:If NAT mode is enabled for the EC800G series, both IPv4 and IPv6 Pids of the enabled pid cannot dial up. **Parameter:** @@ -117,7 +119,7 @@ Gets NAT enabling status of a specified network card (whether IPv6 dial-up is su **Return Value:** -If successful, it returns NAT enable situation. Integer type: 0 and 1. `0`: Enable and IPv6 dial-up is supported. `1`: Disable and IPv6 dial-up is not supported. +If successful, it returns NAT enable situation. Integer type: 0 and 1. `0`: The NAT mode is not enabled. `1`: The NAT mode is enabled. If failed, it returns integer `-1`. @@ -137,15 +139,17 @@ USBNET.getNat(0, 1) USBNET.setNat(simid, pid, nat) ``` -Sets NAT. After NAT is set successfully, the configuration takes effect after the module is rebooted. The nat value changes to 1 when you call *USBNET.set_worktype()*, in which case `pid` cannot perform IPv6 dial-up, thus this function can be called to disable NAT to turn IPv6 dial-up back to normal after USBNET is disabled. +Sets NAT. After the NAT configuration is successful, restart the module and the configuration takes effect. When usbnet.set_worktype () is called, the nat value changes to 1, and NAT mode is enabled for this pid. Therefore, after USBnet is closed, you can call this interface to disable NAT mode and restore the dialing function of this pid. -> Note: Only EC200U and EC600U series modules support this function. +> Note:Currently only EC200U/EC600U/EC800G series support. +> Note:If NAT mode is enabled for the EC200U/EC600U series, the pid of the enabled route cannot perform IPv6 dial-up. +> Note:If NAT mode is enabled for the EC800G series, both IPv4 and IPv6 Pids of the enabled pid cannot dial up. **Parameter:** - `simid` - Integer type. Range: 0 and 1. Currently only `0` is supported. - `pid` - Integer type. PDP index. Range: `1-7`. -- `Nat` - Integer type. Range: 0 and 1. `0`: IPv6 dial-up is supported; `1`: IPv6 dial-up is not supported. +- `Nat` - Integer type. Range: 0 and 1. `0`: The NAT mode is not enabled; `1`: The NAT mode is enabled. **Return Value:** diff --git a/docs/API_reference/zh/networklib/uwebsocket.md b/docs/API_reference/zh/networklib/uwebsocket.md index 30581f172549817d13199dd678c50ff92397d164..533cc713ac92f77015387004ae20dadde454970b 100644 --- a/docs/API_reference/zh/networklib/uwebsocket.md +++ b/docs/API_reference/zh/networklib/uwebsocket.md @@ -29,7 +29,7 @@ ws_client.send(msg) ``` **参数描述:** -* `msg` - str类型, 需要发送的数据 +* `msg` - str/byte类型, 需要发送的数据 @@ -42,7 +42,7 @@ ws_client.recv() ``` **返回值描述:** -* `result `- str类型, recv接受返回的结果, 当接受空值或None的时候, 为连接被关闭 +* `result `- str/byte类型, recv接受返回的结果, 当接受空值或None的时候, 为连接被关闭 diff --git a/docs/API_reference/zh/peripherals/ethernet.DM9051.md b/docs/API_reference/zh/peripherals/ethernet.DM9051.md index 16a2091fc312e3a5c2f6712bd79279bda7556d47..189f90dc09c499271c45b4563429e971ed1d975f 100644 --- a/docs/API_reference/zh/peripherals/ethernet.DM9051.md +++ b/docs/API_reference/zh/peripherals/ethernet.DM9051.md @@ -2,14 +2,14 @@ 该类用于控制`DM9051`型号以太网网卡设备。 -> 当前仅支持EC600N系列 +> 当前仅支持EC600N/EG912N/EG915N系列及EC800MCN_LE ## 构造函数 ### `ethernet.DM9051` ```python -class ethernet.DM9051(mac, ip='', subnet='', gateway='', spi_port=-1,spi_cs_pin=-1) +class ethernet.DM9051(mac, ip='', subnet='', gateway='', spi_port=-1, spi_cs_pin=-1, extint_pin=-1, reset_pin=-1, work_mode=0) ``` 加载DM9051驱动,初始化DM9051以太网卡,并返回DM9051网卡对象。 @@ -22,6 +22,11 @@ class ethernet.DM9051(mac, ip='', subnet='', gateway='', spi_port=-1,spi_cs_pin= - `gateway` - 以太网卡的网关地址,若值为空字符串'',表示将 `ip` 地址的最后一位替换成`1`作为网关。 - `spi_port` - 连接`DM9051`的[SPI端口](./machine.SPI.md),默认值为`-1`,表示使用上次配置的值,程序中默认配置为了 `SPI1` 端口。 - `spi_cs_pin` - 连接`DM9051`的 `SPI` 片选[GPIO管脚](./machine.Pin.md),默认值为`-1`,表示使用上次配置的值,程序中默认配置为了 `Pin.GPIO13`。 +- `extint_pin` - 连接`DM9051`的外部中断[GPIO管脚](./machine.Pin.md),默认值为`-1`,表示上次配置的值,程序中默认配置为 `Pin.GPIO19`。 +- `reset_pin` - 连接`DM9051`的重置[GPIO管脚](./machine.Pin.md),默认值为`-1`, 表示上次配置的值,程序中默认配置为 `Pin.GPIO17`。 +- `work_mode` - 以太网工作模式配置,默认为终端模式,`0`/`1` 分别表示终端模式/网关模式。终端模式表示该模块作为终端设备连接供网设备上网。网关模式表示该模块作为网关,为外部设备提供网络访问,通过`4G`上网。 + +> 默认值各个平台有差异,建议定义可用GPIO使用。 ## 方法 diff --git a/docs/API_reference/zh/stdlib/uio.md b/docs/API_reference/zh/stdlib/uio.md index e987fb9a27e88ac1fc8362f168208994c56d60ad..ccbeaa931eeb1261cabc9ebc4e8e5725301ac3c7 100644 --- a/docs/API_reference/zh/stdlib/uio.md +++ b/docs/API_reference/zh/stdlib/uio.md @@ -1,6 +1,8 @@ # uio - 输入输出流 -`uio`模块包含其他类型的stream(类文件)对象和辅助函数。该模块实现相应CPython模块的子集。更多信息请参阅阅CPython文档:[io](https://docs.python.org/3.5/library/io.html#module-io) +`uio`模块包含其他类型的stream(类文件)对象和辅助函数。该模块实现相应CPython模块的子集。更多信息请参阅CPython文档:[io](https://docs.python.org/3.5/library/io.html#module-io) + +> 支持IOBase, BytesIO,FileIO, StringIO,TextIO。 **示例**: