哪位大神能详细解释一下# USE SPI()的用法啊?
Syntax:
#use spi (options)
Elements:
Options are separated by commas and may be:
MASTER
Set the device as the master.
SLAVE
Set the device as the slave.
BAUD=n
Target bits per second, default is as fast as possible.
CLOCK_HIGH=n
High time of clock in us (not needed of BAUD= is used).
CLOCK_LOW=n
Low time of clock in us (not needed of BAUD= is used).
DI=pin
Optional pin for incoming data.
DO=pin
Optional pin for outgoing data.
CLK=pin
Clock pin.
MODE=n
The mode to put the SPI bus.
ENABLE=pin
Optional pin to be active during data transfer.
LOAD=pin
Optional pin to be pulsed active after data is transferred.
DIAGNOSTIC=pin
Optional pin to the set high when data is sampled.
SAMPLE_RISE
Sample on rising edge.
SAMPLE_FALL
Sample on falling edge (default).
BITS=n
Max number of bits in a transfer.
SAMPLE_COUNT=n
Number of samples to take (uses majority vote).
LOAD_ACTIVE=n
Active state for LOAD pin (0, 1).
ENABLE_ACTIVE=n
Active state for ENABLE pin (0, 1).
IDLE=n
Inactive state for CLK pin (0, 1).
ENABLE_DELAY=n
Time in us to delay after ENABLE is activated.
LSB_FIRST
LSB is sent first.
MSB_FIRST
MSB is sent first.
STREAM=id
Specify a stream name for this protocol.
SPI1
Use the hardware pins for SPI Port 1
SPI2
Use the hardware pins for SPI Port 2
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
好的,谢谢了
一周热门 更多>