Пример #1
0
    def transaction(self, dataToSend, receiveSize):
        """Generic transaction.

        This is a lower-level interface to the I2C hardware giving you more
        control over each transaction.

        :param dataToSend: Buffer of data to send as part of the transaction.
        :type dataToSend: iterable of bytes
        :param receiveSize: Number of bytes to read from the device.
        :type receiveSize: int
        :returns: Data received from the device.
        :rtype: iterable of bytes
        """
        return hal.transactionI2C(self.port, self.deviceAddress, dataToSend,
                                  receiveSize)
Пример #2
0
    def transaction(self, dataToSend, receiveSize):
        """Generic transaction.

        This is a lower-level interface to the I2C hardware giving you more
        control over each transaction.

        :param dataToSend: Buffer of data to send as part of the transaction.
        :type dataToSend: iterable of bytes
        :param receiveSize: Number of bytes to read from the device.
        :type receiveSize: int
        :returns: Data received from the device.
        :rtype: iterable of bytes
        """
        return hal.transactionI2C(self.port, self.deviceAddress,
                                  dataToSend, receiveSize)
Пример #3
0
    def transaction(self, dataToSend, receiveSize):
        """Generic transaction.

        This is a lower-level interface to the I2C hardware giving you more
        control over each transaction. If you intend to write multiple bytes
        in the same transaction and do not plan to receive anything back, use
        writeBulk() instead. Calling this with a receiveSize of 0 will
        result in an error.

        :param dataToSend: Buffer of data to send as part of the transaction.
        :type dataToSend: iterable of bytes
        :param receiveSize: Number of bytes to read from the device.
        :type receiveSize: int
        :returns: Data received from the device.
        :rtype: iterable of bytes
        """
        return hal.transactionI2C(self.port, self.deviceAddress, dataToSend,
                                  receiveSize)
Пример #4
0
    def transaction(
        self, dataToSend: Union[bytes, List[int]], receiveSize: int
    ) -> bytes:
        """Generic transaction.

        This is a lower-level interface to the I2C hardware giving you more
        control over each transaction. If you intend to write multiple bytes
        in the same transaction and do not plan to receive anything back, use
        writeBulk() instead. Calling this with a receiveSize of 0 will
        result in an error.

        :param dataToSend: Buffer of data to send as part of the transaction.
        :param receiveSize: Number of bytes to read from the device.
        :returns: Data received from the device.
        """
        return hal.transactionI2C(
            self.port, self.deviceAddress, dataToSend, receiveSize
        )