Initialize from 16 pin numbers. -1 means "skip this bit position".
Definition at line 273 of file pins.cpp.hpp.
273 {
274 for (
u8 i = 0; i < 16; ++i) {
276 }
277
278
279 int port_counts[64] = {};
280 int port_ids[16] = {};
281 int num_active = 0;
282 for (
u8 i = 0; i < 16; ++i) {
284 port_ids[i] = -1;
285 continue;
286 }
288 port_ids[i] = p;
289 if (p >= 0 && p < 64) {
290 port_counts[p]++;
291 }
292 num_active++;
293 }
294
295
296 int best_port = -1;
297 int best_count = 0;
298 for (int p = 0; p < 64; ++p) {
299 if (port_counts[p] > best_count) {
300 best_count = port_counts[p];
301 best_port = p;
302 }
303 }
304
305
306 if (best_port >= 0 && best_count < num_active) {
307 for (
u8 i = 0; i < 16; ++i) {
309 continue;
310 }
311 if (port_ids[i] != best_port) {
312 FL_WARN(
"digitalMultiWrite16: pin " <<
mPins[i] <<
" (port " << port_ids[i] <<
") disabled — not on majority port " << best_port);
314 }
315 }
316 }
317
318 for (
u8 n = 0; n < 4; ++n) {
320 }
321}
void buildNibbleLut(u8 bit_offset, PinList(&set_lut)[16], PinList(&clr_lut)[16]) FL_NO_EXCEPT
int pinToPort(int pin) FL_NO_EXCEPT
Map a runtime pin number to an integer port ID using FastPin<N>::port().
References buildNibbleLut(), fl::FL_NO_EXCEPT, FL_WARN, mClrNib, mPins, mSetNib, pins, and fl::pinToPort().
Referenced by DigitalMultiWrite16(), and fl::digitalMultiWrite16().