FastLED 3.9.15
Loading...
Searching...
No Matches

◆ CheckPin()

template<uint8_t PIN>
void CheckPin ( )
Examples
Pintest.ino.

Definition at line 96 of file Pintest.ino.

97{
98 CheckPin<PIN - 1>();
99
100 void *systemThinksPortIs = (void*)portOutputRegister(digitalPinToPort(PIN));
101 RwReg systemThinksMaskIs = digitalPinToBitMask(PIN);
102
103 Serial.print("Pin "); Serial.print(PIN); Serial.print(": Port ");
104
105 if(systemThinksPortIs == (void*)FastPin<PIN>::port()) {
106 Serial.print("valid & mask ");
107 } else {
108 Serial.print("invalid, is "); Serial.print(getPort((void*)FastPin<PIN>::port())); Serial.print(" should be ");
109 Serial.print(getPort((void*)systemThinksPortIs));
110 Serial.print(" & mask ");
111 }
112
113 if(systemThinksMaskIs == FastPin<PIN>::mask()) {
114 Serial.println("valid.");
115 } else {
116 Serial.print("invalid, is "); Serial.print(FastPin<PIN>::mask()); Serial.print(" should be "); Serial.println(systemThinksMaskIs);
117 }
118}
#define PIN
Definition PinMode.ino:7
const char * getPort(void *portRef)
Definition Pintest.ino:9
void CheckPin()
Definition Pintest.ino:96
static port_t mask()
Get the pin mask.
Definition fastpin.h:266
static port_ptr_t port()
Get the output state of the port.
Definition fastpin.h:264

References CheckPin(), getPort(), FastPin< PIN >::mask(), PIN, and FastPin< PIN >::port().

Referenced by CheckPin(), and loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: