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