2626
2727
2828class ModbusRTU (Modbus ):
29- INV_RX = UART .INV_RX # Include in class so they can be used when creating the object
29+ # Include in class so they can be used when creating the object
30+ INV_RX = UART .INV_RX
3031 INV_TX = UART .INV_TX
31-
32+
3233 """
3334 Modbus RTU client class
3435
@@ -61,7 +62,7 @@ def __init__(self,
6162 pins : List [Union [int , Pin ], Union [int , Pin ]] = None ,
6263 ctrl_pin : int = None ,
6364 uart_id : int = 1 ,
64- invert : int = None ):
65+ invert : int = 0 ):
6566 super ().__init__ (
6667 # set itf to Serial object, addr_list to [addr]
6768 Serial (uart_id = uart_id ,
@@ -77,9 +78,10 @@ def __init__(self,
7778
7879
7980class Serial (CommonModbusFunctions ):
80- INV_RX = UART .INV_RX # Include in class so they can be used when creating the object
81+ # Include in class so they can be used when creating the object
82+ INV_RX = UART .INV_RX
8183 INV_TX = UART .INV_TX
82-
84+
8385 def __init__ (self ,
8486 uart_id : int = 1 ,
8587 baudrate : int = 9600 ,
@@ -88,7 +90,7 @@ def __init__(self,
8890 parity = None ,
8991 pins : List [Union [int , Pin ], Union [int , Pin ]] = None ,
9092 ctrl_pin : int = None ,
91- invert : int = None ):
93+ invert : int = 0 ):
9294 """
9395 Setup Serial/RTU Modbus
9496
@@ -106,6 +108,8 @@ def __init__(self,
106108 :type pins: List[Union[int, Pin], Union[int, Pin]]
107109 :param ctrl_pin: The control pin
108110 :type ctrl_pin: int
111+ :param invert: Invert TX and/or RX pins
112+ :type invert: int
109113 """
110114 # UART flush function is introduced in Micropython v1.20.0
111115 self ._has_uart_flush = callable (getattr (UART , "flush" , None ))
0 commit comments