 #ifdef PORTL
 	if(portPtr == (void*)&PORTL) { return "PORTL"; }
 #endif
+
+// Teensy 3.x port checks
 #ifdef GPIO_A_PDOR
 	if(portPtr == (void*)&GPIO_A_PDOR) { return "GPIO_A_PDOR"; }
 #endif


#include <FastSPI_LED.h>

const char *getPort(void *portPtr) {
#ifdef PORTA
	if(portPtr == (void*)&PORTA) { return "PORTA"; }
#endif


	RwReg *systemThinksPortIs = portOutputRegister(digitalPinToPort(PIN));
	RwReg systemThinksMaskIs = digitalPinToBitMask(PIN);

	Serial.print("Pin "); Serial.print(PIN); Serial.print(": Port ");

	if(systemThinksPortIs == FastPin<PIN>::port()) {
		Serial.print("valid & mask ");
	} else {
		Serial.print("invalid, is "); Serial.print(getPort((void*)FastPin<PIN>::port())); Serial.print(" should be ");
		Serial.print(getPort((void*)systemThinksPortIs));
		Serial.print(" & mask ");
	}

	if(systemThinksMaskIs == FastPin<PIN>::mask()) {
		Serial.println("valid.");
	} else {
		Serial.print("invalid, is "); Serial.print(FastPin<PIN>::mask()); Serial.print(" should be "); Serial.println(systemThinksMaskIs);
	}
}

template<> void CheckPin<-1> () {}

void setup() {
	delay(5000);
    Serial.begin(38400);
    Serial.println("resetting!");
}

void loop() {
	CheckPin<MAX_PIN>();
	delay(100000);

	Serial.print("GPIO_1_DR is: "); Serial.print(getPort((void*)&(GPIO1_DR)));
}
