Skip to content

Commit 306c661

Browse files
committed
v2.1.0 - more QR VERSIONS available
1 parent 6b4e0dc commit 306c661

File tree

13 files changed

+833
-92
lines changed

13 files changed

+833
-92
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ Each subclass have its own repository with its own dependencies. This library ha
1616

1717
If you do not find match for your display model feel free to contribute with a new subclasss or file an Issue here.
1818

19+
# How to select a different QR version
20+
21+
By default the QR version is 7 and ECC 1. If you wanna use a different version you have to define in your project QRCODEVERSION with a number from 1 to 10.
22+
We have chosen this conditional compilation to reduce the library footprint for small devices. Frame files courtesy of @slavendam.
23+
1924
## Breaking changes in version 2.0.0
2025
To avoid conflict with other libraries we have renamed the file qrcode.h to qrcodedisplay.h, so all the subclasses have to do the same change.
2126

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "QRcodeDisplay",
3-
"version": "2.0.2",
3+
"version": "2.1.0",
44
"keywords": "qr code, ESP32, ESP8266, TFT display, OLED Display, E-ink display",
55
"description": "Base clase for generating QRCodes on ESP devices with different kind of displays",
66
"repository":

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=QRcodeDisplay
2-
version=2.0.2
2+
version=2.1.0
33
author=Jose Antonio Espinosa <[email protected]>
44
maintainer=Jose Antonio Espinosa <[email protected]>
55
sentence=Base code for displaying QRcodes on ESP based MCU with OLED, TFT or E-Ink displays

src/frame-v1.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#if defined(QRCODEVERSION) && QRCODEVERSION == 1
2+
const unsigned char neccblk1 = 1;
3+
const unsigned char neccblk2 = 0;
4+
const unsigned char datablkw = 19;
5+
const unsigned char eccblkwid = 7;
6+
const unsigned char VERSION = 1;
7+
const unsigned char ECCLEVEL = 1;
8+
const unsigned char WD = 21;
9+
const unsigned char WDB = 3;
10+
unsigned char strinbuf[63];
11+
unsigned char qrframe[600];
12+
unsigned char rlens[22];
13+
#ifndef __AVR__
14+
#define PROGMEM
15+
#define memcpy_P memcpy
16+
#define __LPM(x) *x
17+
#else
18+
#include <avr/pgmspace.h>
19+
#endif
20+
const unsigned char framebase[] PROGMEM = {
21+
0xfe,0x03,0xf8,
22+
0x82,0x02,0x08,
23+
0xba,0x02,0xe8,
24+
0xba,0x02,0xe8,
25+
0xba,0x02,0xe8,
26+
0x82,0x02,0x08,
27+
0xfe,0xab,0xf8,
28+
0x00,0x00,0x00,
29+
0x02,0x00,0x00,
30+
0x00,0x00,0x00,
31+
0x02,0x00,0x00,
32+
0x00,0x00,0x00,
33+
0x02,0x00,0x00,
34+
0x00,0x80,0x00,
35+
0xfe,0x00,0x00,
36+
0x82,0x00,0x00,
37+
0xba,0x00,0x00,
38+
0xba,0x00,0x00,
39+
0xba,0x00,0x00,
40+
0x82,0x00,0x00,
41+
0xfe,0x00,0x00,
42+
};
43+
44+
const unsigned char framask[] PROGMEM = {
45+
0xff,0xff,0xff,
46+
0xff,0xff,0xf8,
47+
0x10,0x04,0x00,
48+
0x80,0x08,0x1f,
49+
0xf0,0x7f,0xc0,
50+
0xff,0x80,0xff,
51+
0x80,0x7f,0xc0,
52+
0x1f,0xf0,0x03,
53+
0xfe,0x00,0x3f,
54+
0xe0,0x00,
55+
};
56+
#endif

src/frame-v10.c

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#if defined(QRCODEVERSION) && QRCODEVERSION == 10
2+
const unsigned char neccblk1 = 2;
3+
const unsigned char neccblk2 = 2;
4+
const unsigned char datablkw = 68;
5+
const unsigned char eccblkwid = 18;
6+
const unsigned char VERSION = 10;
7+
const unsigned char ECCLEVEL = 1;
8+
const unsigned char WD = 57;
9+
const unsigned char WDB = 8;
10+
unsigned char strinbuf[456];
11+
unsigned char qrframe[600];
12+
unsigned char rlens[58];
13+
#ifndef AVR
14+
#define PROGMEM
15+
#define memcpy_P memcpy
16+
#define __LPM(x) *x
17+
#else
18+
#include <avr/pgmspace.h>
19+
#endif
20+
const unsigned char framebase[] PROGMEM = {
21+
0xfe,0x00,0x00,0x00,0x00,0x03,0x3f,0x80,
22+
0x82,0x00,0x00,0x00,0x00,0x01,0x20,0x80,
23+
0xba,0x00,0x00,0x00,0x00,0x03,0x2e,0x80,
24+
0xba,0x00,0x00,0x00,0x00,0x01,0x2e,0x80,
25+
0xba,0x00,0x00,0x3e,0x00,0x01,0x2e,0x80,
26+
0x82,0x00,0x00,0x22,0x00,0x02,0x20,0x80,
27+
0xfe,0xaa,0xaa,0xaa,0xaa,0xaa,0xbf,0x80,
28+
0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x00,
29+
0x02,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,
30+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
31+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
32+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
33+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
34+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
35+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
36+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
37+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
38+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
39+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
40+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
41+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
42+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
43+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
44+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
45+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
46+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
47+
0x0f,0x80,0x00,0x3e,0x00,0x00,0xf8,0x00,
48+
0x08,0x80,0x00,0x22,0x00,0x00,0x88,0x00,
49+
0x0a,0x80,0x00,0x2a,0x00,0x00,0xa8,0x00,
50+
0x08,0x80,0x00,0x22,0x00,0x00,0x88,0x00,
51+
0x0f,0x80,0x00,0x3e,0x00,0x00,0xf8,0x00,
52+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
53+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
54+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
55+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
56+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
57+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
58+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
59+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
60+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
61+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
62+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
63+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
64+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
65+
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
66+
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
67+
0xa6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
68+
0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
69+
0x02,0x00,0x00,0x3e,0x00,0x00,0xf8,0x00,
70+
0x00,0x80,0x00,0x22,0x00,0x00,0x88,0x00,
71+
0xfe,0x00,0x00,0x2a,0x00,0x00,0xa8,0x00,
72+
0x82,0x00,0x00,0x22,0x00,0x00,0x88,0x00,
73+
0xba,0x00,0x00,0x3e,0x00,0x00,0xf8,0x00,
74+
0xba,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
75+
0xba,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
76+
0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
77+
0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
78+
};
79+
80+
const unsigned char framask[] PROGMEM = {
81+
0xff,0xff,0xff,0xff,0xff,0xf8,0x10,0x04,
82+
0x00,0x80,0x08,0x00,0x40,0x01,0x00,0x02,
83+
0x00,0x02,0x00,0x01,0x00,0x00,0x40,0x00,
84+
0x08,0x00,0x00,0x80,0x00,0x04,0x00,0x00,
85+
0x10,0x00,0x00,0x20,0x00,0x00,0x20,0x00,
86+
0x00,0x10,0x00,0x00,0x1f,0x00,0x00,0x43,
87+
0xe0,0x00,0x0c,0x3e,0x00,0x00,0xe1,0xf0,
88+
0x00,0x07,0x87,0xc0,0x00,0x1f,0x02,0x00,
89+
0x00,0x00,0x02,0x00,0x00,0x00,0x01,0x00,
90+
0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x08,
91+
0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
92+
0x04,0x00,0x00,0x00,0x00,0x10,0x00,0x00,
93+
0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x20,
94+
0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
95+
0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x80,
96+
0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
97+
0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x7f,
98+
0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00,
99+
0x00,0x00,0x00,0xfe,0x00,0x00,0x3e,0x00,
100+
0x00,0xff,0xc0,0x00,0x1f,0x00,0x00,0x7f,
101+
0xf0,0x00,0x07,0xc0,0x00,0x1f,0xfe,0x00,
102+
0x00,0xf8,0x00,0x03,0xff,0xe0,0x00,0x0f,
103+
0x80,0x00,0x3f,0xff,0x00,0x00,0x00,0x00,
104+
0x00,0x07,0xfc,0x00,0x00,0x00,0x00,0x00,
105+
0x0f,0xf8,0x00,0x00,0x00,0x00,0x00,0x0f,
106+
0xf8,0x00,0x00,0x00,0x00,0x00,0x00,
107+
};
108+
#endif

src/frame-v2.c

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#if defined(QRCODEVERSION) && QRCODEVERSION == 2
2+
const unsigned char neccblk1 = 1;
3+
const unsigned char neccblk2 = 0;
4+
const unsigned char datablkw = 34;
5+
const unsigned char eccblkwid = 10;
6+
const unsigned char VERSION = 2;
7+
const unsigned char ECCLEVEL = 1;
8+
const unsigned char WD = 25;
9+
const unsigned char WDB = 4;
10+
unsigned char strinbuf[100];
11+
unsigned char qrframe[600];
12+
unsigned char rlens[26];
13+
#ifndef __AVR__
14+
#define PROGMEM
15+
#define memcpy_P memcpy
16+
#define __LPM(x) *x
17+
#else
18+
#include <avr/pgmspace.h>
19+
#endif
20+
const unsigned char framebase[] PROGMEM = {
21+
0xfe,0x00,0x3f,0x80,
22+
0x82,0x00,0x20,0x80,
23+
0xba,0x00,0x2e,0x80,
24+
0xba,0x00,0x2e,0x80,
25+
0xba,0x00,0x2e,0x80,
26+
0x82,0x00,0x20,0x80,
27+
0xfe,0xaa,0xbf,0x80,
28+
0x00,0x00,0x00,0x00,
29+
0x02,0x00,0x00,0x00,
30+
0x00,0x00,0x00,0x00,
31+
0x02,0x00,0x00,0x00,
32+
0x00,0x00,0x00,0x00,
33+
0x02,0x00,0x00,0x00,
34+
0x00,0x00,0x00,0x00,
35+
0x02,0x00,0x00,0x00,
36+
0x00,0x00,0x00,0x00,
37+
0x02,0x00,0xf8,0x00,
38+
0x00,0x80,0x88,0x00,
39+
0xfe,0x00,0xa8,0x00,
40+
0x82,0x00,0x88,0x00,
41+
0xba,0x00,0xf8,0x00,
42+
0xba,0x00,0x00,0x00,
43+
0xba,0x00,0x00,0x00,
44+
0x82,0x00,0x00,0x00,
45+
0xfe,0x00,0x00,0x00,
46+
};
47+
48+
const unsigned char framask[] PROGMEM = {
49+
0xff,0xff,0xff,0xff,
50+
0xff,0xf8,0x10,0x04,
51+
0x00,0x80,0x08,0x00,
52+
0x40,0x01,0x00,0x02,
53+
0x00,0x02,0x00,0xff,
54+
0xc0,0x7f,0xf0,0x1f,
55+
0xfe,0x03,0xff,0xe0,
56+
0x3f,0xff,0x00,0x07,
57+
0xfc,0x00,0x0f,0xf8,
58+
0x00,0x0f,0xf8,0x00,
59+
0x00,
60+
};
61+
#endif

src/frame-v3.c

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#if defined(QRCODEVERSION) && QRCODEVERSION == 3
2+
const unsigned char neccblk1 = 1;
3+
const unsigned char neccblk2 = 0;
4+
const unsigned char datablkw = 55;
5+
const unsigned char eccblkwid = 15;
6+
const unsigned char VERSION = 3;
7+
const unsigned char ECCLEVEL = 1;
8+
const unsigned char WD = 29;
9+
const unsigned char WDB = 4;
10+
unsigned char strinbuf[116];
11+
unsigned char qrframe[600];
12+
unsigned char rlens[30];
13+
#ifndef __AVR__
14+
#define PROGMEM
15+
#define memcpy_P memcpy
16+
#define __LPM(x) *x
17+
#else
18+
#include <avr/pgmspace.h>
19+
#endif
20+
const unsigned char framebase[] PROGMEM = {
21+
0xfe,0x00,0x03,0xf8,
22+
0x82,0x00,0x02,0x08,
23+
0xba,0x00,0x02,0xe8,
24+
0xba,0x00,0x02,0xe8,
25+
0xba,0x00,0x02,0xe8,
26+
0x82,0x00,0x02,0x08,
27+
0xfe,0xaa,0xab,0xf8,
28+
0x00,0x00,0x00,0x00,
29+
0x02,0x00,0x00,0x00,
30+
0x00,0x00,0x00,0x00,
31+
0x02,0x00,0x00,0x00,
32+
0x00,0x00,0x00,0x00,
33+
0x02,0x00,0x00,0x00,
34+
0x00,0x00,0x00,0x00,
35+
0x02,0x00,0x00,0x00,
36+
0x00,0x00,0x00,0x00,
37+
0x02,0x00,0x00,0x00,
38+
0x00,0x00,0x00,0x00,
39+
0x02,0x00,0x00,0x00,
40+
0x00,0x00,0x00,0x00,
41+
0x02,0x00,0x0f,0x80,
42+
0x00,0x80,0x08,0x80,
43+
0xfe,0x00,0x0a,0x80,
44+
0x82,0x00,0x08,0x80,
45+
0xba,0x00,0x0f,0x80,
46+
0xba,0x00,0x00,0x00,
47+
0xba,0x00,0x00,0x00,
48+
0x82,0x00,0x00,0x00,
49+
0xfe,0x00,0x00,0x00,
50+
};
51+
52+
const unsigned char framask[] PROGMEM = {
53+
0xff,0xff,0xff,0xff,
54+
0xff,0xf8,0x10,0x04,
55+
0x00,0x80,0x08,0x00,
56+
0x40,0x01,0x00,0x02,
57+
0x00,0x02,0x00,0x01,
58+
0x00,0x00,0x40,0x00,
59+
0x08,0x00,0x00,0x80,
60+
0x03,0xff,0x00,0x1f,
61+
0xfc,0x00,0x7f,0xf8,
62+
0x00,0xff,0xf8,0x00,
63+
0xff,0xfc,0x00,0x01,
64+
0xff,0x00,0x00,0x3f,
65+
0xe0,0x00,0x03,0xfe,
66+
0x00,0x00,0x00,
67+
};
68+
#endif

0 commit comments

Comments
 (0)