Esempio n. 1
0
    def write(self, dataToSend: Union[bytes, Sequence[int]]) -> int:
        """Write data to the slave device.  Blocks until there is space in the
        output FIFO.

        If not running in output only mode, also saves the data received
        on the MISO input during the transfer into the receive FIFO.

        :param dataToSend: Data to send

        :returns: Number of bytes written

        Usage::

            # send byte string
            writeCount = spi.write(b'stuff')

            # send list of integers
            writeCount = spi.write([0x01, 0x02])
        """
        return hal.writeSPI(self.port, dataToSend)
Esempio n. 2
0
    def write(self, dataToSend: Union[bytes, Sequence[int]]) -> int:
        """Write data to the slave device.  Blocks until there is space in the
        output FIFO.

        If not running in output only mode, also saves the data received
        on the MISO input during the transfer into the receive FIFO.

        :param dataToSend: Data to send

        :returns: Number of bytes written

        Usage::

            # send byte string
            writeCount = spi.write(b'stuff')

            # send list of integers
            writeCount = spi.write([0x01, 0x02])
        """
        return hal.writeSPI(self.port, dataToSend)