Tcl Raspberry Pi I/O


The spi command


spi subcommand ?arg ...?


The spi command lets you manipulate the Raspberry Pi spi interfaces. The legal values of subcommand are listed below. Note that you can abbreviate the subcommands.

spi open device
Open the spi port. This command returns a channel identifier that may be used in future invocations of the standard Tcl I/O commands like read, puts, and close.
spi transfer channelId data
Perform full duplex communication. This command transmits the specified data. At the same time it receives an equal amount of data, which is returned to the caller.

Configuration options

The chan configure command can be used to query and set several configuration options for spi channels:
-bpw bits
Set the number of bits per word.
-delay usecs
Specify the delay between two words.
-mode mode
Control the clock polarity and phase.
-speed speed
Modify the connection speed.