platypush/plugins/esp/__init__.py
def spi_open(self, id=1, baudrate: int = 1000000, polarity: int = 0, phase: int = 0,
                 bits: int = 8, sck: Optional[int] = None, mosi: Optional[int] = None,
                 miso: Optional[int] = None, **kwargs):
        """
        Open a connection to an SPI port.
        Note that ``sck``, ``mosi`` and ``miso`` parameters are only allowed if you're setting up a software
        managed SPI connection. If you're using the hardware SPI implementation then those PINs are
        pre-defined depending on the model of your board.

        :param id: Values of id depend on a particular port and its hardware. Values 0, 1, etc. are commonly used to
            select hardware SPI block #0, #1, etc. Value -1 can be used for bit-banging (software) implementation of
            SPI (if supported by a port).
        :param baudrate: Port baudrate/SCK clock rate (default: 1 MHz).
        :param polarity: It can be 0 or 1, and is the level the idle clock line sits at.
        :param phase: It can be 0 or 1 to sample data on the first or second clock edge respectively.
        :param bits: Number of bits per character. It can be 7, 8 or 9.
        :param sck: SCK PIN number.
        :param mosi: MOSI PIN number.
        :param miso: MISO PIN number.
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.execute`.
        """
        code = '''
args = {
    'baudrate': {baudrate},
    'polarity': {polarity},
    'phase': {phase},
    'bits': {bits},
}
'''.format(baudrate=baudrate, polarity=polarity, phase=phase, bits=bits)

        self.execute(code, **kwargs)
        code = '''
import machine

if {sck}:
    args['sck'] = machine.Pin({sck})
if {mosi}:
    args['mosi'] = machine.Pin({mosi})
if {miso}:
    args['miso'] = machine.Pin({miso})
'''.format(sck=sck, mosi=mosi, miso=miso)

        self.execute(code, **kwargs)
        code = 'spi = machine.SPI({id}, **args)'.format(id=id)
        self.execute(code, **kwargs)

        Open a connection to an SPI port.
        Note that ``sck``, ``mosi`` and ``miso`` parameters are only allowed if you're setting up a software
        managed SPI connection. If you're using the hardware SPI implementation then those PINs are
        pre-defined depending on the model of your board.

        :param id: Values of id depend on a particular port and its hardware. Values 0, 1, etc. are commonly used to
            select hardware SPI block #0, #1, etc. Value -1 can be used for bit-banging (software) implementation of
            SPI (if supported by a port).
        :param baudrate: Port baudrate/SCK clock rate (default: 1 MHz).
        :param polarity: It can be 0 or 1, and is the level the idle clock line sits at.
        :param phase: It can be 0 or 1 to sample data on the first or second clock edge respectively.
        :param bits: Number of bits per character. It can be 7, 8 or 9.
        :param sck: SCK PIN number.
        :param mosi: MOSI PIN number.
        :param miso: MISO PIN number.
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.execute`.
        
Open a connection to an SPI port.
Open a connection to an SPI port .
def spi_open(self, id=1, baudrate: int = 1000000, polarity: int = 0, phase: int = 0,
                 bits: int = 8, sck: Optional[int] = None, mosi: Optional[int] = None,
                 miso: Optional[int] = None, **kwargs):
        code = '''
args = {
    'baudrate': {baudrate},
    'polarity': {polarity},
    'phase': {phase},
    'bits': {bits},
}
'''.format(baudrate=baudrate, polarity=polarity, phase=phase, bits=bits)
        self.execute(code, **kwargs)
        code = '''
import machine
if {sck}:
    args['sck'] = machine.Pin({sck})
if {mosi}:
    args['mosi'] = machine.Pin({mosi})
if {miso}:
    args['miso'] = machine.Pin({miso})
'''.format(sck=sck, mosi=mosi, miso=miso)
        self.execute(code, **kwargs)
        code = 'spi = machine.SPI({id}, **args)'.format(id=id)
        self.execute(code, **kwargs)
def spi_open ( self , id = 1 , baudrate : int = 1000000 , polarity : int = 0 , phase : int = 0 , bits : int = 8 , sck : Optional [ int ] = None , mosi : Optional [ int ] = None , miso : Optional [ int ] = None , ** kwargs ) : code = '''
args = {
    'baudrate': {baudrate},
    'polarity': {polarity},
    'phase': {phase},
    'bits': {bits},
}
''' . format ( baudrate = baudrate , polarity = polarity , phase = phase , bits = bits ) self . execute ( code , ** kwargs ) code = '''
import machine

if {sck}:
    args['sck'] = machine.Pin({sck})
if {mosi}:
    args['mosi'] = machine.Pin({mosi})
if {miso}:
    args['miso'] = machine.Pin({miso})
''' . format ( sck = sck , mosi = mosi , miso = miso ) self . execute ( code , ** kwargs ) code = 'spi = machine.SPI({id}, **args)' . format ( id = id ) self . execute ( code , ** kwargs )
Open a connection to an SPI port.
Open a connection to an SPI port .
"""
        Open a connection to an SPI port.
        Note that ``sck``, ``mosi`` and ``miso`` parameters are only allowed if you're setting up a software
        managed SPI connection. If you're using the hardware SPI implementation then those PINs are
        pre-defined depending on the model of your board.

        :param id: Values of id depend on a particular port and its hardware. Values 0, 1, etc. are commonly used to
            select hardware SPI block #0, #1, etc. Value -1 can be used for bit-banging (software) implementation of
            SPI (if supported by a port).
        :param baudrate: Port baudrate/SCK clock rate (default: 1 MHz).
        :param polarity: It can be 0 or 1, and is the level the idle clock line sits at.
        :param phase: It can be 0 or 1 to sample data on the first or second clock edge respectively.
        :param bits: Number of bits per character. It can be 7, 8 or 9.
        :param sck: SCK PIN number.
        :param mosi: MOSI PIN number.
        :param miso: MISO PIN number.
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.execute`.
        """
self
id
Values of id depend on a particular port and its hardware. Values 0, 1, etc. are commonly used to
select hardware SPI block #0, #1, etc. Value -1 can be used for bit-banging (software) implementation of
SPI (if supported by a port).
Values of id depend on a particular port and its hardware . Values 0 1 etc . are commonly used to select hardware SPI block #0 #1 etc . Value - 1 can be used for bit - banging ( software ) implementation of SPI ( if supported by a port ) .
baudrate
int
Port baudrate/SCK clock rate (default: 1 MHz).
Port baudrate / SCK clock rate ( default : 1 MHz ) .
polarity
int
It can be 0 or 1, and is the level the idle clock line sits at.
It can be 0 or 1 and is the level the idle clock line sits at .
phase
int
It can be 0 or 1 to sample data on the first or second clock edge respectively.
It can be 0 or 1 to sample data on the first or second clock edge respectively .
bits
int
Number of bits per character.
Number of bits per character .
sck
Optional[int]
SCK PIN number.
SCK PIN number .
mosi
Optional[int]
MOSI PIN number.
MOSI PIN number .
miso
Optional[int]
MISO PIN number.
MISO PIN number .
kwargs
Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.execute`.
Parameters to pass to : meth : ` platypush . plugins . esp . EspPlugin . execute ` .