embeddedsw
embeddedsw copied to clipboard
TWI mode implemented
TWI mode implemented. Solution of #107 This version is backward compatible with origin.
The TWI is the half duplex variant of the SPI, where the MOSI and the MISO is common and usually named as SDIO.
This implementation added two variables added to XSpi structure. First is the DirectionSwitcher
which is a function pointer to a user implemented function, which has to handle the tri-state pin of the SDIO pin.
The second new variable is the SwitchDirectionAfter
, which is a byte counter, which tells the driver the when to switch the direction.
The driver sends SwitchDirectionAfter
bytes, then waits to done of these bytes. (There is no wait in non-TWI mode.) Then the driver call DirectionSwitcher
then sends other bytes.
Polled mode supported only. (Interrupt mode is not supported).
See the new example for more usage details.
+1, it would be great to see this functionality supported!