diff --git a/en/peripherals/machine.UART.md b/en/peripherals/machine.UART.md deleted file mode 100644 index 02e95b011e1bf670201f607744285dfb435dc7d1..0000000000000000000000000000000000000000 --- a/en/peripherals/machine.UART.md +++ /dev/null @@ -1,319 +0,0 @@ -# UART - Duplex Serial Communication Bus - -This class transmits data through the UART. - -## Constructor - -### `machine.UART` - -```python -class machine.UART(UART.UARTn, buadrate, databits, parity, stopbits, flowctl) -``` - -**Parameter:** - -- `UARTn` - Integer type. UART number.
`UART0` - DEBUG PORT
`UART1` - BT PORT
`UART2` - MAIN PORT
`UART3` - USB CDC PORT (BG95M3 series module does not support it.)
`UART4` - STDOUT PORT (Only EC200U/EC600U/EG915U series module supports it. ) - -- `buadrate` - Integer type. Baud rate. Some common baud rates are supported, like `4800`, `9600`, `19200`, `38400`, `57600`, `115200` and `230400`. - - EC200U/EC600U/EG912U/EG915U series support 2400、4800、9600、14400、19200、28800、33600、38400、57600、115200、230400、460800、921600、1000000. - -- `databits` - Integer type. Data bit. Range: [5–8]. EC600U/EC200U/EG915U/EC800G series module only supports 8 data bits. - -- `parity` - Integer type. Parity check. `0` – NONE, `1` – EVEN, `2` – ODD. - -- `stopbits` - Integer type. Stop bit. Range: [1–2]. - -- `flowctl` - Integer type. Hardware control flow. `0` – FC_NONE, `1` – FC_HW. - -**UART Pin Correspondences:** - -| Module | Pin | -| ------------- | ------------------------------------------------------------ | -| EC600U | UART1:
TX: pin124
RX: pin123
UART2:
TX: pin32
RX: pin31
RTS:pin34
CTS:pin33
UART4:
TX: pin103
RX: pin104 | -| EC200U | UART1:
TX: pin138
RX: pin137
UART2:
TX: pin67
RX: pin68
CTS:pin64
RTS:pin65
UART4:(EU200UXXAA not support)
TX: pin82
RX: pin81 | -| EC200A/UC200A | UART0:(advise to use other ports)
TX: pin12
RX: pin11
UART1:
TX: pin63
RX: pin66
UART2:
TX: pin67
RX: pin68 | -| EC600S/EC600N | UART0:
TX: pin71
RX: pin72
UART1:
TX: pin3
RX: pin2
UART2:
TX: pin32
RX: pin31 | -| EC100Y | UART0:
TX: pin21
RX: pin20
UART1:
TX: pin27
RX: pin28
UART2:
TX: pin50
RX: pin49 | -| EC800N | UART0:
TX: pin39
RX: pin38
UART1:
TX: pin50
RX: pin51
UART2:
TX: pin18
RX: pin17 | -| BC25 | UART1:
TX: pin29
RX: pin28 | -| BG95 | UART0:
TX: pin23
RX: pin22
UART1:
TX: pin27
RX: pin28
UART2:
TX: pin64
RX: pin65
uart4:
TX:pin35
RX:pin34 | -| EC600M | UART0:
TX: pin71
RX: pin72
UART1 (flowctl = 0):
TX: pin3
RX: pin2
UART1 (flowctl = 1):
TX: pin33
RX: pin34
UART2:
TX: pin32
RX: pin31 | -| EG915U | UART1:
TX: pin27
RX: pin28
UART2:
TX: pin35
RX: pin34
CTS:pin36
RTS:pin37
UART4:
TX: pin19
RX: pin18 | -| EC800M/EG810M | UART0:
TX: pin39
RX: pin38
UART1 (flowctl = 0):
TX: pin50
RX: pin51
UART1(flowctl = 1):
TX: pin22
RX: pin23
Note: UART1 is unavailable for EC800MCNGA、CNGD / EG810MCNGA module.
UART2:
TX: pin18
RX: pin17
uart4:
TX:pin29
RX:pin28 | -| EG800P | uart0:
TX: pin39
RX: pin38
uart1:
TX: pin22
RX: pin23
uart2:
TX:pin18
RX:pin17
RTS:pin23
CTS:pin22
uart3:
TX:pin29
RX:pin28 | -| EG912N | UART0:
TX: pin23
RX: pin22
UART1 (flowctl = 0):
TX: pin27
RX: pin28
UART1 (flowctl = 1):
TX: pin36
RX: pin37
UART2:
TX: pin35
RX: pin34 | -| EG912U | UART1:
TX: pin27
RX: pin28
UART2:
TX: pin35
RX: pin34
CTS:pin36
RTS:pin37
UART4:(EG912UGL_AA unsupported)
TX:pin19
RX:pin18 | -| FCM362K | UART1:
TX: pin35
RX: pin34
UART2:
TX: pin28
RX: pin27
| -| BC32 | UART0:
TX: pin21
RX: pin22 | -| BC92 | UART0:
TX: pin22
RX: pin21 | -| EG915N | UART0:
TX: pin23
RX: pin22
UART1 :
TX: pin27
RX: pin28
UART2 :
TX: pin35
RX: pin34
CTS:pin36
RTS:pin37
UART4:(EG915NEU_AG unsupported)
TX: pin36
RX: pin37 | - -> 1.When UART1 of EC600M/EC800M/EG912N series module is in flowctl = 1 state, modules only map UART1 to different pins but flow control is not enabled. -> -> 2.BG95 series module use UART4, need call modem.main_uart_enable_set(1) to enable UART4 and reset module to take effect,as follow: -> -> ```python -> import modem -> #get Main_UART state 1-enabled,0-disabled -> modem.main_uart_enable_get() -> #set Main_UART 1-enable,0-disable,need reset module to take effect -> modem.main_uart_enable_set(1) -> ``` -> ->3.After initialization of FCM362K UART1, the interface cannot be used. You need to execute uart1.close() in the code or restart the module to continue using the interface. - - -**Example:** - -```python ->>> # Creates a UART object ->>> from machine import UART ->>> uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0) -``` - -## Methods - -### `uart.any` - -```python -uart.any() -``` - -This method gets the size of the unread data in the receiving cache. - -**Return Value:** - -Size of data that is unread in the receiving cache. - -**Example:** - -```python ->>> uart.any() -20 # It indicates that there is 20 bytes of unread data in the receiving cache. -``` - -### `uart.read` - -```python -uart.read(nbytes) -``` - -This method reads data from the UART. - -**Parameter:** - -- `nbytes` - Integer type. Size of data to be read. - -**Return Value:** - -Size of data that has been read. - -### `uart.write` - -```python -uart.write(data) -``` - -This method sends data to the UART. - -**Parameter:** - -- `data` - Bytes type. Data to be sent. - -**Return Value:** - -Size of data that has been sent. - -### `uart.close` - -```python -uart.close() -``` - -This method disables the UART. - -**Return Value:** - -`0` - Successful execution - -`-1` - Failed execution - -### `uart.control_485` - -```python -uart.control_485(UART.GPIOn, direction) -``` - -This method controls the direction of RS-485 communication. Before and after sending data through the UART, the specified GPIO is pulled up and down to indicate the direction of RS-485 communication. - -**Parameter:** - -- `GPIOn` - Integer type. GPIO numbers to be controlled. See [class Pin - Control I/O Pins](machine.Pin.md) for pin definitions. - -- `direction` - Integer type. Pin level change.
`1` - The pin is pulled high before the data is sent through the UART, and pulled low after the data is sent.
- - `0` - The pin is pulled low before the data is sent through the UART, and pulled high after the data is sent. - -**Return Value:** - -`0` - Successful execution - -`-1` - Failed execution - -> Note: BC25 series/BG95-M3 series module does not support this method. - -**Example:** - -```python ->>> from machine import UART ->>> uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0) ->>> uart1.control_485(UART.GPIO24, 1) -``` - -### `uart.set_callback` - -```python -uart.set_callback(fun) -``` - -This method sets the callback function of the UART. This callback function will be triggered when data is received on the UART. - -**Parameter:** - -- `fun` - Callback function of the UART. Prototype: - - ``` - fun(result_list) - ``` - - Parameter of the callback function: - - - `result_list[0]`:Whether the data is received successfully. - - 0 - Received successfully - - Others - Receiving failed - - - `result_list[1]`:Port for receiving data. - - - `result_list[2]`:How much data is returned. - -**Return Value:** - -`0` - Successful execution - -`-1` - Failed execution - -**Example:** - -```python ->>> from machine import UART ->>> uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0) ->>> ->>> def uart_call(para): ->>> print(para) ->>> uart1.set_callback(uart_call) -``` - -**Example:** - -```python -""" -Runnnig this routine, you need to connect the main port on the EVB to a PC by a USB-to-Serial Port Adapter, enable the main port by a UART tool on the PC and send data to this port. Then you can see the messages sent by PC. -""" -import _thread -import utime -import log -from machine import UART - - -''' -The following two global variables are necessary. You can modify the values of these two global variables based on your project requirements. -''' -PROJECT_NAME = "QuecPython_UART_example" -PROJECT_VERSION = "1.0.1" - -''' - * Parameter1: Port - Note: For EC100Y-CN and EC600S-CN modules, descriptions of UARTn are as follows: - UART0 - DEBUG PORT - UART1 – BT PORT - UART2 – MAIN PORT - UART3 – USB CDC PORT - * Parameter2:Baud rate - * Parameter3:Data bits (5—8) - * Parameter4:Parity (0:NONE 1:EVEN 2:ODD) - * Parameter5:Stop bits (1–2) - * Parameter6:Flow control (0: FC_NONE 1: FC_HW) -''' - - -# Sets the log output level -log.basicConfig(level=log.INFO) -uart_log = log.getLogger("UART") - -class Example_uart(object): - def __init__(self, no=UART.UART2, bate=115200, data_bits=8, parity=0, stop_bits=1, flow_control=0): - self.uart = UART(no, bate, data_bits, parity, stop_bits, flow_control) - self.uart.set_callback(self.callback) - - - def callback(self, para): - uart_log.info("call para:{}".format(para)) - if(0 == para[0]): - self.uartRead(para[2]) - - - def uartWrite(self, msg): - uart_log.info("write msg:{}".format(msg)) - self.uart.write(msg) - - def uartRead(self, len): - msg = self.uart.read(len) - utf8_msg = msg.decode() - uart_log.info("UartRead msg: {}".format(utf8_msg)) - return utf8_msg - - def uartWrite_test(self): - for i in range(10): - write_msg = "Hello count={}".format(i) - self.uartWrite(write_msg) - utime.sleep(1) - -if __name__ == "__main__": - uart_test = Example_uart() - uart_test.uartWrite_test() - - -# Examples of running results -''' -INFO:UART:write msg:Hello count=0 -INFO:UART:write msg:Hello count=1 -INFO:UART:write msg:Hello count=2 -INFO:UART:write msg:Hello count=3 -INFO:UART:write msg:Hello count=4 -INFO:UART:write msg:Hello count=5 -INFO:UART:write msg:Hello count=6 -INFO:UART:write msg:Hello count=7 -INFO:UART:write msg:Hello count=8 -INFO:UART:write msg:Hello count=9 - -INFO:UART:call para:[0, 2, 15] -INFO:UART:UartRead msg: my name is XXX - - -''' - -``` - -## Constants - -| Constant | Description | -| ---------- | ----------- | -| UART.UART0 | UART0 | -| UART.UART1 | UART1 | -| UART.UART2 | UART2 | -| UART.UART3 | UART3 | -| UART.UART4 | UART4 | - diff --git a/en/peripherals/misc.ADC.md b/en/peripherals/misc.ADC.md index 50f89e88735870e313c4cc00823ec4fc3abfba05..1a908ed558265008f1ac45a4bdb6d63fc8bd93cd 100644 --- a/en/peripherals/misc.ADC.md +++ b/en/peripherals/misc.ADC.md @@ -62,13 +62,491 @@ If successful, a specified channel voltage value is returned. **Mapping Relationship Between ADC Passages and Pysical Pins:** -The corresponding pins of EC100Y series module are as follows:
ADC0 – pin39
ADC1 – pin81
The corresponding pin of EC600S/EC600N series module is as follows:
ADC0 – pin19
The corresponding pins of EC600M series module is as follows:
ADC0 – pin19
ADC1 – pin20
The corresponding pin of EC800N series module is as follows:
ADC0 – pin9
The corresponding pins of EC600U series module is as follows:
ADC0 – pin19
ADC1 – pin20
ADC2 – pin113
ADC3 – pin114
The corresponding pins of EC200U series module is as follows:
ADC0 – pin45
ADC1 – pin44
ADC2 – pin43
The corresponding pins of EC200A/UC200A series module is as follows:
ADC0 – pin45
ADC1 – pin44
The corresponding pin of BG95 series module is as follows:
ADC0 – pin24
The corresponding pins of EG915U series module is as follows:
ADC0 – pin24
ADC1 – pin2
The corresponding pins of EC800M/EG810M series module is as follows:
ADC0 – pin9
ADC1 – pin96
The corresponding pins of EG912N series module is as follows:
ADC0 – pin24
ADC1 – pin2
The corresponding pins of EG912U series module is as follows:
ADC0 – pin24
ADC1 – pin2 +
+ + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number19
-The corresponding pins of BC32 series module is as follows:
ADC0 – pin2 + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number19
ADC1Pin number20
-The corresponding pins of BC92 series module is as follows:
ADC0 – pin2 + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number9
-The corresponding pins of EG915N series module is as follows:
ADC0 – pin24
ADC1 – pin2 + + + + + + + + + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number19
ADC1Pin number20
ADC2Pin number113
ADC3Pin number114
+ + + + + + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number45
ADC1Pin number44
ADC2Pin number43
+ + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number45
ADC1Pin number44
+ + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number45
ADC1Pin number44
+ + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number24
+ + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number24
ADC1Pin number2
+ + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number9
ADC1Pin number96
+ + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number9
ADC1Pin number96
+ + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number24
ADC1Pin number2
+ + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number19
ADC1Pin number20
+ + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number9
ADC1Pin number96
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number19
ADC1Pin number20
ADC2Pin number113
ADC3Pin number114
+ + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number9
ADC1Pin number96
+ + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number24
ADC1Pin number2
+ + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number19
ADC1Pin number20
+ + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number9
ADC1Pin number96
+ + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number9
ADC1Pin number96
+ + + + + + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number8
ADC1Pin number7
ADC2Pin number6
+ + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number2
+ + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number2
+ + + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number24
ADC1Pin number2
+ + + + + + + + + + + + + + + + + + + +
ADC numberPin correspondence
ADC0Pin number9
ADC1Pin number96
+ +
### ADC.close @@ -84,9 +562,464 @@ ADC.close() ## Constants -| Constant | Description | Module | -| -------- | ------------- | ------------------------------------------------------------ | -| ADC.ADC0 | ADC channel 0 | EC600S/EC600N/EC100Y/EC600U/EC200U/BC25PA/EC800N/BG95M3/EC200A/EC600M/
EG915U/EC800M/EG912N/EG912U/BC32/BC92/EG915N | -| ADC.ADC1 | ADC channel 1 | EC600U/EC200U/EC200A/EC600M/EG915U/EC800M/EG912N/EG912U/EG915N | -| ADC.ADC2 | ADC channel 2 | EC600U/EC200U | -| ADC.ADC3 | ADC channel 3 | EC600U | \ No newline at end of file +
+ + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
+ + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
+ + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
ADC.ADC2ADC channel 2
ADC.ADC3ADC channel 3
+ + + + + + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
ADC.ADC2ADC channel 2
+ + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
+ + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
+ + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
+ + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
+ + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
+ + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
+ + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
+ + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
+ + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
+ + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
+ + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
+ + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
+ + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
+ + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
+ + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
+ + + + + + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
ADC.ADC2ADC channel 2
+ + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
+ + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
+ + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
+ + + + + + + + + + + + + + + + + + +
ConstantDescription
ADC.ADC0ADC channel 0
ADC.ADC1ADC channel 1
+ +
\ No newline at end of file diff --git a/zh/peripherals/machine.UART.md b/zh/peripherals/machine.UART.md index 22ee3fdedab97ca3ac2ad9e74ba86ffed390072c..4a6410a2c2d3ed94270f95ab9c98d3b639c07b69 100644 --- a/zh/peripherals/machine.UART.md +++ b/zh/peripherals/machine.UART.md @@ -6,25 +6,482 @@ ### `machine.UART` -```python -class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) -``` +
+
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
-**参数描述:** +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
-- `UARTn` - UART编号,int类型,UARTn说明如下:
`UART0` - DEBUG PORT
`UART1` - BT PORT
`UART2` - MAIN PORT
`UART3` - USB CDC PORT (不支持BG95M3)
`UART4` - STDOUT PORT (仅支持EC200U/EC600U/EG915U/EG915N) +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
-- `baudrate` - 波特率,int类型,支持常用波特率,如`4800`、`9600`、`19200`、`38400`、`57600`、`115200`、`230400`等; +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
- EC200U/EC600U/EG912U/EG915U系列支持2400、4800、9600、14400、19200、28800、33600、38400、57600、115200、230400、460800、921600、1000000。 +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
-- `databits` - 数据位[5 ~ 8],int类型,EC600U/EC200U/EG915U/EC800G仅支持8位。 +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
-- `parity` - 奇偶校验(`0` – NONE,`1` – EVEN,`2` – ODD),int类型。 +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
-- `stopbits` - 停止位[1 ~ 2],int类型。 +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
-- `flowctl` - 硬件控制流(`0` – FC_NONE, `1` – FC_HW),int类型。 +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
+ +
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
+
+

参数描述:

+ +
**UART引脚对应关系 :** @@ -40,25 +497,25 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart1 - 引脚号124 - 引脚号123 - - + uart1 + 引脚号124 + 引脚号123 + + - uart2 - 引脚号32 - 引脚号31 - 引脚号34 - 引脚号33 + uart2 + 引脚号32 + 引脚号31 + 引脚号34 + 引脚号33 - uart4 - 引脚号103 - 引脚号104 - - + uart4 + 引脚号103 + 引脚号104 + + @@ -74,25 +531,25 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart1 - 引脚号138 - 引脚号137 - - + uart1 + 引脚号138 + 引脚号137 + + - uart2 - 引脚号67 - 引脚号68 - 引脚号65 - 引脚号64 + uart2 + 引脚号67 + 引脚号68 + 引脚号65 + 引脚号64 - uart4 - 引脚号82(EC200UXXAA不支持) - 引脚号81 - - + uart4 + 引脚号82(EC200UXXAA不支持) + 引脚号81 + + @@ -107,22 +564,22 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0(建议使用其他uart) - 引脚号12 - 引脚号11 - + uart0(建议使用其他uart) + 引脚号12 + 引脚号11 + - uart1 - 引脚号63(EC200ACN_LA: 引脚号26) - 引脚号66(EC200ACN_LA: 引脚号27) - + uart1 + 引脚号63(EC200ACN_LA: 引脚号26) + 引脚号66(EC200ACN_LA: 引脚号27) + - uart2 - 引脚号67 - 引脚号68 - EC200ACN_LA模组uart1引脚号与其他型号不同 + uart2 + 引脚号67 + 引脚号68 + EC200ACN_LA模组uart1引脚号与其他型号不同 @@ -137,22 +594,22 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0(建议使用其他uart) - 引脚号12 - 引脚号11 - + uart0(建议使用其他uart) + 引脚号12 + 引脚号11 + - uart1 - 引脚号63(EC200ACN_LA: 引脚号26) - 引脚号66(EC200ACN_LA: 引脚号27) - EC200ACN_LA模组uart1引脚号与其他型号不同 + uart1 + 引脚号63(EC200ACN_LA: 引脚号26) + 引脚号66(EC200ACN_LA: 引脚号27) + EC200ACN_LA模组uart1引脚号与其他型号不同 - uart2 - 引脚号67 - 引脚号68 - + uart2 + 引脚号67 + 引脚号68 + @@ -166,19 +623,19 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号71 - 引脚号72 + uart0 + 引脚号71 + 引脚号72 - uart1 - 引脚号3 - 引脚号2 + uart1 + 引脚号3 + 引脚号2 - uart2 - 引脚号32 - 引脚号31 + uart2 + 引脚号32 + 引脚号31 @@ -192,19 +649,19 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号71 - 引脚号72 + uart0 + 引脚号71 + 引脚号72 - uart1 - 引脚号3 - 引脚号2 + uart1 + 引脚号3 + 引脚号2 - uart2 - 引脚号32 - 引脚号31 + uart2 + 引脚号32 + 引脚号31 @@ -218,19 +675,19 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号21 - 引脚号20 + uart0 + 引脚号21 + 引脚号20 - uart1 - 引脚号27 - 引脚号28 + uart1 + 引脚号27 + 引脚号28 - uart2 - 引脚号50 - 引脚号49 + uart2 + 引脚号50 + 引脚号49 @@ -244,19 +701,19 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号39 - 引脚号38 + uart0 + 引脚号39 + 引脚号38 - uart1 - 引脚号50 - 引脚号51 + uart1 + 引脚号50 + 引脚号51 - uart2 - 引脚号18 - 引脚号17 + uart2 + 引脚号18 + 引脚号17 @@ -270,9 +727,9 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart1 - 引脚号29 - 引脚号28 + uart1 + 引脚号29 + 引脚号28 @@ -286,24 +743,24 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号23 - 引脚号22 + uart0 + 引脚号23 + 引脚号22 - uart1 - 引脚号27 - 引脚号28 + uart1 + 引脚号27 + 引脚号28 - uart2 - 引脚号64 - 引脚号65 + uart2 + 引脚号64 + 引脚号65 - uart4 - 引脚号35 - 引脚号34 + uart4 + 引脚号35 + 引脚号34 @@ -317,24 +774,24 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号71 - 引脚号72 + uart0 + 引脚号71 + 引脚号72 - uart1(flowctl = 0) - 引脚号3 - 引脚号2 + uart1(flowctl = 0) + 引脚号3 + 引脚号2 - uart1(flowctl = 1) - 引脚号33 - 引脚号34 + uart1(flowctl = 1) + 引脚号33 + 引脚号34 - uart2 - 引脚号32 - 引脚号31 + uart2 + 引脚号32 + 引脚号31 @@ -350,25 +807,25 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart1 - 引脚号27 - 引脚号28 - - + uart1 + 引脚号27 + 引脚号28 + + - uart2 - 引脚号35 - 引脚号34 - 引脚号37 - 引脚号36 + uart2 + 引脚号35 + 引脚号34 + 引脚号37 + 引脚号36 - uart4 - 引脚号19 - 引脚号18 - - + uart4 + 引脚号19 + 引脚号18 + + @@ -383,34 +840,34 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号39 - 引脚号38 - + uart0 + 引脚号39 + 引脚号38 + - uart1(flowctl = 0) - 引脚号50 - 引脚号51 - EC800MCNGA 、CNGB、CNGD/ EG810MCNGA、CNGB 模块的 uart1 不可用 + uart1(flowctl = 0) + 引脚号50 + 引脚号51 + EC800MCNGA 、CNGB、CNGD/ EG810MCNGA、CNGB 模块的 uart1 不可用 - uart1(flowctl = 1) - 引脚号22 - 引脚号23 - + uart1(flowctl = 1) + 引脚号22 + 引脚号23 + - uart2 - 引脚号18 - 引脚号17 - + uart2 + 引脚号18 + 引脚号17 + - uart4 - 引脚号29 - 引脚号28 - + uart4 + 引脚号29 + 引脚号28 + @@ -425,34 +882,34 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号39 - 引脚号38 - + uart0 + 引脚号39 + 引脚号38 + - uart1(flowctl = 0) - 引脚号50 - 引脚号51 - EC800MCNGA 、CNGB、CNGD/ EG810MCNGA、CNGB 模块的 uart1 不可用 + uart1(flowctl = 0) + 引脚号50 + 引脚号51 + EC800MCNGA 、CNGB、CNGD/ EG810MCNGA、CNGB 模块的 uart1 不可用 - uart1(flowctl = 1) - 引脚号22 - 引脚号23 - + uart1(flowctl = 1) + 引脚号22 + 引脚号23 + - uart2 - 引脚号18 - 引脚号17 - + uart2 + 引脚号18 + 引脚号17 + - uart4 - 引脚号29 - 引脚号28 - + uart4 + 引脚号29 + 引脚号28 + @@ -466,24 +923,24 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号23 - 引脚号22 + uart0 + 引脚号23 + 引脚号22 - uart1(flowctl = 0) - 引脚号27 - 引脚号28 + uart1(flowctl = 0) + 引脚号27 + 引脚号28 - uart1(flowctl = 1) - 引脚号36 - 引脚号37 + uart1(flowctl = 1) + 引脚号36 + 引脚号37 - uart2 - 引脚号35 - 引脚号34 + uart2 + 引脚号35 + 引脚号34 @@ -497,19 +954,19 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号71 - 引脚号72 + uart0 + 引脚号71 + 引脚号72 - uart1(EC600ECN_LE&LQ不可用) - 引脚号70 - 引脚号69 + uart1(EC600ECN_LE&LQ不可用) + 引脚号70 + 引脚号69 - uart2 - 引脚号32 - 引脚号31 + uart2 + 引脚号32 + 引脚号31 @@ -523,19 +980,19 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号39 - 引脚号38 + uart0 + 引脚号39 + 引脚号38 - uart1 - 引脚号29 - 引脚号28 + uart1 + 引脚号29 + 引脚号28 - uart2 - 引脚号18 - 引脚号17 + uart2 + 引脚号18 + 引脚号17 @@ -551,39 +1008,39 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号124 - 引脚号123 - - + uart0 + 引脚号124 + 引脚号123 + + - uart2 - 引脚号32 - 引脚号31 - 引脚34 - 引脚33 + uart2 + 引脚号32 + 引脚号31 + 引脚34 + 引脚33 - uart4 - 引脚号116 - 引脚号9 - - + uart4 + 引脚号116 + 引脚号9 + + - uart5 - 引脚号125 - 引脚号126 - - + uart5 + 引脚号125 + 引脚号126 + + - uart6 - 引脚号106 - 引脚号105 - - + uart6 + 引脚号106 + 引脚号105 + + @@ -597,24 +1054,24 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart1 - 引脚号29 - 引脚号28 + uart1 + 引脚号29 + 引脚号28 - uart2 - 引脚号18 - 引脚号17 + uart2 + 引脚号18 + 引脚号17 - uart5 - 引脚号23 - 引脚号22 + uart5 + 引脚号23 + 引脚号22 - uart6 - 引脚号86 - 引脚号83 + uart6 + 引脚号86 + 引脚号83 @@ -630,25 +1087,25 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart1 - 引脚号27 - 引脚号28 - - + uart1 + 引脚号27 + 引脚号28 + + - uart2 - 引脚号35 - 引脚号34 - 引脚号37 - 引脚号36 + uart2 + 引脚号35 + 引脚号34 + 引脚号37 + 引脚号36 - uart4(EG912UGL_AA不可用) - 引脚号19 - 引脚号18 - - + uart4(EG912UGL_AA不可用) + 引脚号19 + 引脚号18 + + @@ -662,24 +1119,24 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号71 - 引脚号72 + uart0 + 引脚号71 + 引脚号72 - uart1(flowctl = 0) - 引脚号3 - 引脚号2 + uart1(flowctl = 0) + 引脚号3 + 引脚号2 - uart1(flowctl = 1) - 引脚号33 - 引脚号34 + uart1(flowctl = 1) + 引脚号33 + 引脚号34 - uart2 - 引脚号32 - 引脚号31 + uart2 + 引脚号32 + 引脚号31 @@ -694,28 +1151,28 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号39 - 引脚号38 - + uart0 + 引脚号39 + 引脚号38 + - uart1(flowctl = 0) - 引脚号50 - 引脚号51 - EG800KCN不可用 + uart1(flowctl = 0) + 引脚号50 + 引脚号51 + EG800KCN不可用 - uart1(flowctl = 1) - 引脚号22 - 引脚号23 - EG800KCN不可用 + uart1(flowctl = 1) + 引脚号22 + 引脚号23 + EG800KCN不可用 - uart2 - 引脚号18 - 引脚号17 - + uart2 + 引脚号18 + 引脚号17 + @@ -730,28 +1187,28 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号39 - 引脚号38 - + uart0 + 引脚号39 + 引脚号38 + - uart1(flowctl = 0) - 引脚号50 - 引脚号51 - EG800KCN不可用 + uart1(flowctl = 0) + 引脚号50 + 引脚号51 + EG800KCN不可用 - uart1(flowctl = 1) - 引脚号22 - 引脚号23 - EG800KCN不可用 + uart1(flowctl = 1) + 引脚号22 + 引脚号23 + EG800KCN不可用 - uart2 - 引脚号18 - 引脚号17 - + uart2 + 引脚号18 + 引脚号17 + @@ -767,32 +1224,32 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号39 - 引脚号38 - - + uart0 + 引脚号39 + 引脚号38 + + - uart1 - 引脚号22 - 引脚号23 - - + uart1 + 引脚号22 + 引脚号23 + + - uart2 - 引脚号18 - 引脚号17 - 引脚23 - 引脚22 + uart2 + 引脚号18 + 引脚号17 + 引脚23 + 引脚22 - uart3 - 引脚号29 - 引脚号28 - - + uart3 + 引脚号29 + 引脚号28 + + @@ -806,14 +1263,14 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart1 - 引脚号27 - 引脚号26 + uart1 + 引脚号27 + 引脚号26 - uart2 - 引脚号20 - 引脚号19 + uart2 + 引脚号20 + 引脚号19 @@ -827,14 +1284,14 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart1 - 引脚号35 - 引脚号34 + uart1 + 引脚号35 + 引脚号34 - uart2 - 引脚号28 - 引脚号27 + uart2 + 引脚号28 + 引脚号27 @@ -848,9 +1305,9 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号21 - 引脚号22 + uart0 + 引脚号21 + 引脚号22 @@ -864,9 +1321,9 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号22 - 引脚号21 + uart0 + 引脚号22 + 引脚号21 @@ -882,32 +1339,32 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号23 - 引脚号22 - - + uart0 + 引脚号23 + 引脚号22 + + - uart1 - 引脚号27 - 引脚号28 - - + uart1 + 引脚号27 + 引脚号28 + + - uart2 - 引脚号35 - 引脚号34 - 引脚号36 - 引脚号37 + uart2 + 引脚号35 + 引脚号34 + 引脚号36 + 引脚号37 - uart4(EG915NEU_AG不支持) - 引脚号36 - 引脚号37 - - + uart4(EG915NEU_AG不支持) + 引脚号36 + 引脚号37 + + @@ -921,40 +1378,73 @@ class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl) - uart0 - 引脚号39 - 引脚号38 + uart0 + 引脚号39 + 引脚号38 - uart1 - 引脚号29 - 引脚号28 + uart1 + 引脚号29 + 引脚号28 - uart2 - 引脚号18 - 引脚号17 + uart2 + 引脚号18 + 引脚号17
-> 1、EC600M/EC800M/EG810M/EG912N/EC600K/EC800K 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。 -> -> 2、BG95系列使用UART4需要先调用modem.main_uart_enable_set(1)使能UART4,重启生效,如下 -> -> ```python -> import modem -> #获取Main_UART使能状态 1-使能,0-不使能 -> modem.main_uart_enable_get() -> #设置Main_UART使能状态 1-使能,0-不使能,重启生效 -> modem.main_uart_enable_set(1) -> ``` -> -> 3、FCM360W UART2被初始化后交互口将无法使用,需要在代码中执行uart2.close()或者重启模组才可继续使用交互口。 -> -> 4、FCM362K UART1被初始化后交互口将无法使用,需要在代码中执行uart1.close()或者重启模组才可继续使用交互口。 +
+
+

1、BG95系列使用UART4需要先调用modem.main_uart_enable_set(1)使能UART4,重启生效,如下

+ +
+ +
+
+

1、EC600M 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

+
+ +
+
+

1、EC800M 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

+
+ +
+
+

1、EG810M 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

+
+ +
+
+

1、EG912N 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

+
+ +
+
+

1、EC600K 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

+
+ +
+
+

1、EC800K 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

+
+ +
+
+

1、FCM360W UART2被初始化后交互口将无法使用,需要在代码中执行uart2.close()或者重启模组才可继续使用交互口。

+
+ +
+
+

1、FCM362K UART1被初始化后交互口将无法使用,需要在代码中执行uart1.close()或者重启模组才可继续使用交互口。

+
**示例:** @@ -1029,25 +1519,407 @@ uart.close() 成功返回整型值`0`,失败返回整型值`-1`。 +
+
### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
-```python -uart.control_485(UART.GPIOn, direction) -``` +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
-该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。 +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
-**参数描述:** +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
-- `GPIOn` - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。 +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
-- `direction` - 引脚电平变化,int类型,说明如下:
`1`表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
`0`表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高 +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
-**返回值描述:** +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
-成功返回整型值`0`,失败返回整型值`-1`。 +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ + +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
-> BC25PA/BG95M3/FCM360W平台不支持此方法。 +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

该方法用于控制485通信方向,串口发送数据之前和之后进行拉高拉低指定GPIO,用来指示485通信的方向。

+

参数描述:

+
    +
  • GPIOn - 需要控制的GPIO引脚号,参照[Pin模块](machine.Pin.md)的引脚定义,int类型。

    +
  • +
  • direction - 引脚电平变化,int类型,说明如下:
    1表示引脚电平变化为:串口发送数据之前由低拉高、发送数据之后再由高拉低
    0表示引脚电平变化为:串口发送数据之前由高拉低、发送数据之后再由低拉高

    +
  • +
+

返回值描述:

+

成功返回整型值0,失败返回整型值-1

+
**示例:**