MCPcopy Create free account
hub / github.com/BruceDevices/firmware / fillframe

Function fillframe

lib/TFT_eSPI_QRcode/src/qrencode.c:225–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225void fillframe(void)
226{
227 unsigned i;
228 unsigned char d, j;
229 unsigned char x, y, ffdecy, ffgohv;
230
231 memcpy_P(qrframe, framebase, WDB * WD);
232 x = y = WD - 1;
233 ffdecy = 1; // up, minus
234 ffgohv = 1;
235
236 /* inteleaved data and ecc codes */
237 for (i = 0; i < ((datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2); i++) {
238 d = strinbuf[i];
239 for (j = 0; j < 8; j++, d <<= 1) {
240 if (0x80 & d)
241 SETQRBIT(x, y);
242 do { // find next fill position
243 if (ffgohv)
244 x--;
245 else {
246 x++;
247 if (ffdecy) {
248 if (y != 0)
249 y--;
250 else {
251 x -= 2;
252 ffdecy = !ffdecy;
253 if (x == 6) {
254 x--;
255 y = 9;
256 }
257 }
258 } else {
259 if (y != WD - 1)
260 y++;
261 else {
262 x -= 2;
263 ffdecy = !ffdecy;
264 if (x == 6) {
265 x--;
266 y -= 8;
267 }
268 }
269 }
270 }
271 ffgohv = !ffgohv;
272 } while (ismasked(x, y));
273 }
274 }
275
276}
277
278//========================================================================
279// Masking

Callers 1

qrencodeFunction · 0.85

Calls 1

ismaskedFunction · 0.85

Tested by

no test coverage detected