platypush/plugins/esp/__init__.py
def uart_open(self, id=1, baudrate: Optional[int] = 9600, bits: Optional[int] = 8, parity: Optional[int] = None,
                  stop: int = 1, tx_pin: Optional[int] = None, rx_pin: Optional[int] = None,
                  timeout: Optional[float] = None, timeout_char: Optional[float] = None, **kwargs):
        """
        Open a connection to a UART port.

        :param id: Bus ID (default: 1).
        :param baudrate: Port baudrate (default: 9600).
        :param bits: Number of bits per character. It can be 7, 8 or 9.
        :param parity: Parity configuration. It can be None (no parity), 0 (even) or 1 (odd).
        :param stop: Number of stop bits. It can be 1 or 2.
        :param tx_pin: Specify the TX PIN to use.
        :param rx_pin: Specify the RX PIN to use.
        :param timeout: Specify the time to wait for the first character in seconds.
        :param timeout_char: Specify the time to wait between characters in seconds.
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.execute`.
        """
        code = '''
args = {
    'bits': {bits},
    'parity': {parity},
    'stop': {stop},
}

if {tx_pin}:
    args['tx'] = {tx_pin}
if {rx_pin}:
    args['rx'] = {rx_pin}
if {timeout}:
    args['timeout'] = {timeout}
if {timeout_char}:
    args['timeout_char'] = {timeout_char}
'''.format(bits=bits, parity=parity, stop=stop, tx_pin=tx_pin, rx_pin=rx_pin,
           timeout=timeout, timeout_char=timeout_char)

        self.execute(code, **kwargs)

        code = '''
import machine
uart = machine.UART({id}, {baudrate}, **args)
'''.format(id=id, baudrate=baudrate)

        self.execute(code, **kwargs)

        Open a connection to a UART port.

        :param id: Bus ID (default: 1).
        :param baudrate: Port baudrate (default: 9600).
        :param bits: Number of bits per character. It can be 7, 8 or 9.
        :param parity: Parity configuration. It can be None (no parity), 0 (even) or 1 (odd).
        :param stop: Number of stop bits. It can be 1 or 2.
        :param tx_pin: Specify the TX PIN to use.
        :param rx_pin: Specify the RX PIN to use.
        :param timeout: Specify the time to wait for the first character in seconds.
        :param timeout_char: Specify the time to wait between characters in seconds.
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.execute`.
        
Open a connection to a UART port.
Open a connection to a UART port .
def uart_open(self, id=1, baudrate: Optional[int] = 9600, bits: Optional[int] = 8, parity: Optional[int] = None,
                  stop: int = 1, tx_pin: Optional[int] = None, rx_pin: Optional[int] = None,
                  timeout: Optional[float] = None, timeout_char: Optional[float] = None, **kwargs):
        code = '''
args = {
    'bits': {bits},
    'parity': {parity},
    'stop': {stop},
}
if {tx_pin}:
    args['tx'] = {tx_pin}
if {rx_pin}:
    args['rx'] = {rx_pin}
if {timeout}:
    args['timeout'] = {timeout}
if {timeout_char}:
    args['timeout_char'] = {timeout_char}
'''.format(bits=bits, parity=parity, stop=stop, tx_pin=tx_pin, rx_pin=rx_pin,
           timeout=timeout, timeout_char=timeout_char)
        self.execute(code, **kwargs)
        code = '''
import machine
uart = machine.UART({id}, {baudrate}, **args)
'''.format(id=id, baudrate=baudrate)
        self.execute(code, **kwargs)
def uart_open ( self , id = 1 , baudrate : Optional [ int ] = 9600 , bits : Optional [ int ] = 8 , parity : Optional [ int ] = None , stop : int = 1 , tx_pin : Optional [ int ] = None , rx_pin : Optional [ int ] = None , timeout : Optional [ float ] = None , timeout_char : Optional [ float ] = None , ** kwargs ) : code = '''
args = {
    'bits': {bits},
    'parity': {parity},
    'stop': {stop},
}

if {tx_pin}:
    args['tx'] = {tx_pin}
if {rx_pin}:
    args['rx'] = {rx_pin}
if {timeout}:
    args['timeout'] = {timeout}
if {timeout_char}:
    args['timeout_char'] = {timeout_char}
''' . format ( bits = bits , parity = parity , stop = stop , tx_pin = tx_pin , rx_pin = rx_pin , timeout = timeout , timeout_char = timeout_char ) self . execute ( code , ** kwargs ) code = '''
import machine
uart = machine.UART({id}, {baudrate}, **args)
''' . format ( id = id , baudrate = baudrate ) self . execute ( code , ** kwargs )
Open a connection to a UART port.
Open a connection to a UART port .
"""
        Open a connection to a UART port.

        :param id: Bus ID (default: 1).
        :param baudrate: Port baudrate (default: 9600).
        :param bits: Number of bits per character. It can be 7, 8 or 9.
        :param parity: Parity configuration. It can be None (no parity), 0 (even) or 1 (odd).
        :param stop: Number of stop bits. It can be 1 or 2.
        :param tx_pin: Specify the TX PIN to use.
        :param rx_pin: Specify the RX PIN to use.
        :param timeout: Specify the time to wait for the first character in seconds.
        :param timeout_char: Specify the time to wait between characters in seconds.
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.execute`.
        """
self
id
Bus ID (default: 1).
Bus ID ( default : 1 ) .
baudrate
Optional[int]
Port baudrate (default: 9600).
Port baudrate ( default : 9600 ) .
bits
Optional[int]
Number of bits per character.
Number of bits per character .
parity
Optional[int]
Parity configuration. It can be None (no parity), 0 (even) or 1 (odd).
Parity configuration . It can be None ( no parity ) 0 ( even ) or 1 ( odd ) .
stop
int
Number of stop bits. It can be 1 or 2.
Number of stop bits . It can be 1 or 2 .
tx_pin
Optional[int]
Specify the TX PIN to use.
Specify the TX PIN to use .
rx_pin
Optional[int]
Specify the RX PIN to use.
Specify the RX PIN to use .
timeout
Optional[float]
Specify the time to wait for the first character in seconds.
Specify the time to wait for the first character in seconds .
timeout_char
Optional[float]
Specify the time to wait between characters in seconds.
Specify the time to wait between characters in seconds .
kwargs
Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.execute`.
Parameters to pass to : meth : ` platypush . plugins . esp . EspPlugin . execute ` .