Initialize from 8 pin numbers. -1 means "skip this bit position".
Definition at line 158 of file pins.cpp.hpp.
158 {
159 for (
u8 i = 0; i < 8; ++i) {
161 }
162
163
164 int port_counts[32] = {};
165 int port_ids[8] = {};
166 int num_active = 0;
167 for (
u8 i = 0; i < 8; ++i) {
169 port_ids[i] = -1;
170 continue;
171 }
173 port_ids[i] = p;
174 if (p >= 0 && p < 32) {
175 port_counts[p]++;
176 }
177 num_active++;
178 }
179
180
181 int best_port = -1;
182 int best_count = 0;
183 for (int p = 0; p < 32; ++p) {
184 if (port_counts[p] > best_count) {
185 best_count = port_counts[p];
186 best_port = p;
187 }
188 }
189
190
191 if (best_port >= 0 && best_count < num_active) {
192 for (
u8 i = 0; i < 8; ++i) {
194 continue;
195 }
196 if (port_ids[i] != best_port) {
197 FL_WARN(
"digitalMultiWrite8: pin " <<
mPins[i] <<
" (port " << port_ids[i] <<
") disabled — not on majority port " << best_port);
199 }
200 }
201 }
202
205}
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, mClrHi, mClrLo, mPins, mSetHi, mSetLo, pins, and fl::pinToPort().
Referenced by DigitalMultiWrite8(), and fl::digitalMultiWrite8().