FastLED 3.10.8
Loading...
Searching...
No Matches

◆ allSamePort()

bool fl::DigitalMultiWrite8::allSamePort ( ) const

Check whether all active pins (non -1) share the same GPIO port.

Returns true if fewer than 2 active pins exist (trivially same port).

Definition at line 217 of file pins.cpp.hpp.

217 {
218 int first_port = -1;
219 for (u8 i = 0; i < 8; ++i) {
220 if (mPins[i] < 0) {
221 continue;
222 }
223 int port = fl::pinToPort(mPins[i]);
224 if (first_port < 0) {
225 first_port = port;
226 } else if (port != first_port) {
227 return false;
228 }
229 }
230 return true;
231}
unsigned char u8
Definition stdint.h:131
int pinToPort(int pin) FL_NO_EXCEPT
Map a runtime pin number to an integer port ID using FastPin<N>::port().
Definition pins.cpp.hpp:151

References fl::FL_NO_EXCEPT, mPins, and fl::pinToPort().

+ Here is the call graph for this function: