Skip to content

Commit 02665fd

Browse files
authored
Merge pull request #96 from KurtE/t4x_neutered
T4.x - Software SPI - don't use FAST_PINIO
2 parents b949d28 + 17cf18b commit 02665fd

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Adafruit_SPIDevice.h

+13-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,19 @@ typedef enum _BitOrder {
3939
typedef BitOrder BusIOBitOrder;
4040
#endif
4141

42-
#if defined(__AVR__) || defined(TEENSYDUINO)
42+
#if defined(__IMXRT1062__) // Teensy 4.x
43+
// *Warning* I disabled the usage of FAST_PINIO as the set/clear operations
44+
// used in the cpp file are not atomic and can effect multiple IO pins
45+
// and if an interrupt happens in between the time the code reads the register
46+
// and writes out the updated value, that changes one or more other IO pins
47+
// on that same IO port, those change will be clobbered when the updated
48+
// values are written back. A fast version can be implemented that uses the
49+
// ports set and clear registers which are atomic.
50+
// typedef volatile uint32_t BusIO_PortReg;
51+
// typedef uint32_t BusIO_PortMask;
52+
//#define BUSIO_USE_FAST_PINIO
53+
54+
#elif defined(__AVR__) || defined(TEENSYDUINO)
4355
typedef volatile uint8_t BusIO_PortReg;
4456
typedef uint8_t BusIO_PortMask;
4557
#define BUSIO_USE_FAST_PINIO

0 commit comments

Comments
 (0)