在python中使用help(Spi)可以打印Spi使用的方法,主要的接口有:
| read(self, length, speed=0, bits_per_word=0, delay=0)
| Perform half-duplex Spi read as a binary string
|
| Args:
| length: Integer count of words to read
| speed: Optional temporary bitrate override in Hz. 0 (default)
| uses existing spidev speed setting.
| bits_per_word: Optional temporary bits_per_word override. 0
| (default) will use the current bits_per_word setting.
| delay: Optional delay in usecs between sending the last bit and
| deselecting the chip select line. 0 (default) for no delay.
|
| Returns:
| List of words read from device
|
| transfer(self, data, speed=0, bits_per_word=0, delay=0)
| Perform full-duplex Spi transfer
|
| Args:
| data: List of words to transmit
| speed: Optional temporary bitrate override in Hz. 0 (default)
| uses existing spidev speed setting.
| bits_per_word: Optional temporary bits_per_word override. 0
| (default) will use the current bits_per_word setting.
| delay: Optional delay in usecs between sending the last bit and
| deselecting the chip select line. 0 (default) for no delay.
|
| Returns:
| List of words read from Spi bus during transfer
|
| write(self, data, speed=0, bits_per_word=0, delay=0)
| Perform half-duplex Spi write.
|
| Args:
| data: List of words to write
| speed: Optional temporary bitrate override in Hz. 0 (default)
| uses existing spidev speed setting.
| bits_per_word: Optional temporary bits_per_word override. 0
| (default) will use the current bits_per_word setting.
| delay: Optional delay in usecs between sending the last bit and
| deselecting the chip select line. 0 (default) for no delay.