MCPcopy Create free account
hub / github.com/FastLED/FastLED / CheckPin

Function CheckPin

examples/Pintest/Pintest.h:99–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97
98
99template<uint8_t PIN> void CheckPin()
100{
101 CheckPin<PIN - 1>();
102
103 void *systemThinksPortIs = (void*)portOutputRegister(digitalPinToPort(PIN));
104 RwReg systemThinksMaskIs = digitalPinToBitMask(PIN);
105
106 Serial.print("Pin "); Serial.print(PIN); Serial.print(": Port ");
107
108 if(systemThinksPortIs == (void*)FastPin<PIN>::port()) {
109 Serial.print("valid & mask ");
110 } else {
111 Serial.print("invalid, is "); Serial.print(getPort((void*)FastPin<PIN>::port())); Serial.print(" should be ");
112 Serial.print(getPort((void*)systemThinksPortIs));
113 Serial.print(" & mask ");
114 }
115
116 if(systemThinksMaskIs == FastPin<PIN>::mask()) {
117 Serial.println("valid.");
118 } else {
119 Serial.print("invalid, is "); Serial.print(FastPin<PIN>::mask()); Serial.print(" should be "); Serial.println(systemThinksMaskIs);
120 }
121}
122
123template<> void CheckPin<255> () {}
124template<> void CheckPin<0> () {} // Base case to prevent recursion to -1

Callers

nothing calls this directly

Calls 5

getPortFunction · 0.85
portFunction · 0.50
maskFunction · 0.50
printMethod · 0.45
printlnMethod · 0.45

Tested by

no test coverage detected