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