SPISlave_T4 has been released!
You may download it at https://github.com/tonton81/SPISlave_T4
An example is supplied as well.
It is based on TSPISlave for Teensy 3.x, except it has an additional feature. Not using a callback will print out data being received to serial monitor.
So far Teensy 4.0/4.1 are supported for SPI only on pins 10, 11, 12, 13. No additional pins needed (well, common ground is obviously a plus).
I don't have the SPI1 or SPI2 pins broken out, but the library can easily support them as I am accessing the memory blocks directly with calculated offsets, rather than independant register names. Until then, SPI. is only supported.
My setup consisted of a Teensy LC SPI master sending data to a Teensy 4.0 slave.
Slave mode on Teensy 4 supports 8, 16, and 32bit transfers selectable in the constructor. Note that if you set 16 or 32bits, you need to send all the bits. Like for 16 bit you need to send 2x8bit transfers or one transfer16, or 4x 8bit transfers for 32bit or 2x transfer16's for 32bit.
Enjoy!
You may download it at https://github.com/tonton81/SPISlave_T4
An example is supplied as well.
It is based on TSPISlave for Teensy 3.x, except it has an additional feature. Not using a callback will print out data being received to serial monitor.
So far Teensy 4.0/4.1 are supported for SPI only on pins 10, 11, 12, 13. No additional pins needed (well, common ground is obviously a plus).
I don't have the SPI1 or SPI2 pins broken out, but the library can easily support them as I am accessing the memory blocks directly with calculated offsets, rather than independant register names. Until then, SPI. is only supported.
My setup consisted of a Teensy LC SPI master sending data to a Teensy 4.0 slave.
Code:
Pin layout for SPI:
[U][B]LC[/B][/U] [U][B]T4[/B][/U]
12 11
11 12
10 10
13 13
No alternate pins are broken out for SPI on Teensy 4.0/4.1.
Slave mode on Teensy 4 supports 8, 16, and 32bit transfers selectable in the constructor. Note that if you set 16 or 32bits, you need to send all the bits. Like for 16 bit you need to send 2x8bit transfers or one transfer16, or 4x 8bit transfers for 32bit or 2x transfer16's for 32bit.
Enjoy!
Last edited: