SPI bit-banging for Teensy 4.
This library comes from this thread. I needed to emulate the behavior of a sensor, that behaves as a SPI slave. The sensor shall reply dynamically to any request of a microcontroller, and RT1060 is not capable of this. In particular, you have to decide the contents of the reply before the message from the master arrives, and this does not suite with my needs. That's why I implemented a software SPI, that supports both master and slave modes.
In slave mode, I tried running it up to 2 Mbps and still works fine. Master mode is not tested yet, but I'm quite confident it works.
- supports master mode, with multiple slave devices
- supports slave mode, by emulating multiple slaves on a single SPI bus
- supports SPI mode 0 only (CPOL=0, CPHA=0)
- supports 8 bits messages only (no 16/32 bits)
Download the repository and follow the instructions here.
- add support for other SPI modes
- add support for other transmission sizes