Initialize from 16 pin numbers. -1 means "skip this bit position".
Definition at line 272 of file pins.cpp.hpp.
272 {
273 for (
u8 i = 0; i < 16; ++i) {
275 }
276
277
278 int port_counts[64] = {};
279 int port_ids[16] = {};
280 int num_active = 0;
281 for (
u8 i = 0; i < 16; ++i) {
283 port_ids[i] = -1;
284 continue;
285 }
287 port_ids[i] = p;
288 if (p >= 0 && p < 64) {
289 port_counts[p]++;
290 }
291 num_active++;
292 }
293
294
295 int best_port = -1;
296 int best_count = 0;
297 for (int p = 0; p < 64; ++p) {
298 if (port_counts[p] > best_count) {
299 best_count = port_counts[p];
300 best_port = p;
301 }
302 }
303
304
305 if (best_port >= 0 && best_count < num_active) {
306 for (
u8 i = 0; i < 16; ++i) {
308 continue;
309 }
310 if (port_ids[i] != best_port) {
311 FL_WARN(
"digitalMultiWrite16: pin %s (port %s) disabled — not on majority port %s",
mPins[i], port_ids[i], best_port);
313 }
314 }
315 }
316
317 for (
u8 n = 0; n < 4; ++n) {
319 }
320}
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().