| 48 | } |
| 49 | |
| 50 | void 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 | } |
no test coverage detected