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

Method create

lib/TFT_eSPI_QRcode/src/qrcode.cpp:50–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50void QRcode::create(String message)
51{
52 // create QR code
53 tft->fillScreen(TFT_WHITE);
54 message.toCharArray((char *)strinbuf, 260);
55 qrencode();
56 // print QR Code
57 for (byte x = 0; x < WD; x += 2)
58 {
59 for (byte y = 0; y < WD; y++)
60 {
61 if (QRBIT(x, y) && QRBIT((x + 1), y))
62 {
63 // black square on top of black square
64 render(x, y, 1);
65 render((x + 1), y, 1);
66 }
67 if (!QRBIT(x, y) && QRBIT((x + 1), y))
68 {
69 // white square on top of black square
70 render(x, y, 0);
71 render((x + 1), y, 1);
72 }
73 if (QRBIT(x, y) && !QRBIT((x + 1), y))
74 {
75 // black square on top of white square
76 render(x, y, 1);
77 render((x + 1), y, 0);
78 }
79 if (!QRBIT(x, y) && !QRBIT((x + 1), y))
80 {
81 // white square on top of white square
82 render(x, y, 0);
83 render((x + 1), y, 0);
84 }
85 }
86 }
87}

Callers 1

qrcode_displayFunction · 0.80

Calls 3

qrencodeFunction · 0.85
renderFunction · 0.85
fillScreenMethod · 0.45

Tested by

no test coverage detected