SPI
SpiByte(byte) - sends a byte
byte: - value 0 to 255
Return: Read byte valueSpiCfg(mode,frequency)
mode: - 0 to 3
frequency: - 200 to 20000 (200KHz to 20MHz)
# Send 0x55 and read the returned byte into x
x = SpiByte(0x55)
Note
Streams are not coded directly using DUE Script, see Streams
- SpiStream(writeCount, readCount, cs) - Streams data directly to the SPI device
writeCount: The number of bytes to write
readCount: The number of bytes to read
cs: Chip select pin. Set to -1 if not needed
The command is followed by the data stream. The stream starts with host sending "writeCount" of bytes and then the host must read the "readCount". If either count is zero then that step can be skipped. This is a full-duplex transaction, meaning a byte is written while a byte is read. If write count is less than read count, the device will send zeros internally to keep reading the requested read count.