Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
tz
committed
Nov 30, 2017
0 parents
commit f96547f
Showing
19 changed files
with
3,256 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CFLAGS:=-Wall -g -O6 | ||
#CC=avr-gcc -mmcu=atmega328p | ||
CC=gcc | ||
|
||
all: qrencode qrjpeg | ||
|
||
qrjpeg: qrjpeg.o qrencode.o qrframe.o | ||
|
||
dofbit: dofbit.o qrframe.o | ||
|
||
qrencode: qrenc.o qrencode.o qrframe.o | ||
|
||
clean: | ||
rm -rf qrencode *.o qrjpeg dofbit | ||
|
||
realclean: clean | ||
rm -rf *~ \#* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
HOSTGCC=gcc | ||
|
||
all: lcd.hex oled.hex qrjpeg.hex | ||
|
||
.SUFFIXES: .elf .hex .eep .lss .sym .upload .dsm | ||
|
||
#CPU=m328p | ||
CPU=atmega328p | ||
PORT=/dev/ttyUSB0 | ||
|
||
XTAL=8000000 #Arduino 3.3v Pro | ||
CFLAGS=-g -DF_CPU=$(XTAL) -I ../uart -DTXBUFBITS=8 -DRXBUFBITS=8 -O | ||
|
||
.elf.dsm: | ||
avr-objdump --disassemble -S $^ >$@ | ||
|
||
.c.s: | ||
avr-gcc $(CFLAGS) -Wall -mmcu=$(CPU) -S $^ -o $@ | ||
|
||
MAP=-Wl,"-Map" -Wl,"$@.map" -Wl,"--cref" | ||
|
||
.c.o: | ||
avr-gcc $(CFLAGS) -Wall -mmcu=$(CPU) $< -o $@ -c | ||
|
||
.elf.hex: | ||
avr-objcopy -O ihex -R .eeprom $< $@ | ||
|
||
.hex.upload: | ||
avrdude -F -p $(CPU) -P $(PORT) -c arduino -b 57600 -U $^ | ||
|
||
lcd.elf: lcd.o qrencode.o qrv6l1.o #qrframe.o | ||
avr-gcc $(CFLAGS) -Wall -mmcu=$(CPU) $^ -o $@ | ||
|
||
oled.elf: oled.o qrencode.o qrv6l1.o #qrframe.o | ||
avr-gcc $(CFLAGS) -Wall -mmcu=$(CPU) $^ -o $@ $(MAP) | ||
|
||
qrjpeg.elf: qrjpeg.o qrencode.o qrframe.o | ||
avr-gcc $(CFLAGS) -Wall -mmcu=$(CPU) $^ -o $@ $(MAP) | ||
|
||
clean: | ||
rm -rf qrencode *.o *.elf dofbit qrv6l1.* *.map | ||
|
||
qrv6l1.c: dofbit | ||
./dofbit 6 1 >qrv6l1.c | ||
|
||
dofbit: dofbit.c qrframe.c | ||
$(HOSTGCC) $^ -o $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
EMBEDDED QR CODE GENERATOR | ||
|
||
Copyright 2010, tz@execpc.com. | ||
|
||
Relased under ther terms of the GNU General Public License v3. | ||
|
||
Targetd toward limited RAM systems - it tends to use more code and is slower but fits within an Arduino. | ||
|
||
For linux/posix, type make. For arduino, type make -f Makefile.avr. | ||
|
||
qrenc defaults to version 6, level L ecc, but you can specify the version, or the version and the error level. | ||
|
||
dofbits will generate a C file with the frame for one version/ecc level which will save a lot of RAM. This file will link with qrencode.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#include <string.h> | ||
|
||
extern void initframe(void); | ||
extern void initecc(unsigned char, unsigned char); | ||
extern unsigned char neccblk1; | ||
extern unsigned char neccblk2 ; | ||
extern unsigned char datablkw; | ||
extern unsigned char eccblkwid; | ||
extern unsigned char VERSION; | ||
extern unsigned char ECCLEVEL; | ||
extern unsigned char WD, WDB; // filled in from verison by initframe | ||
extern unsigned char *framebase; | ||
extern unsigned char *framask; | ||
|
||
#ifndef __AVR__ | ||
#define PROGMEM | ||
#define memcpy_P memcpy | ||
#define __LPM(x) x | ||
#else | ||
#include <avr/pgmspace.h> | ||
#endif | ||
|
||
#include "ecctable.h" | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
unsigned char i, j, b; | ||
|
||
if( argc != 3 ) | ||
printf( "params: Version (1-40) ECC-level (1-4)" ); | ||
|
||
unsigned ecc = atoi(argv[2]); | ||
if( ecc < 1 || ecc > 4 ) | ||
return -1; | ||
unsigned char vers = atoi(argv[1]); | ||
if( vers > 40 ) | ||
return -1; | ||
|
||
initecc(ecc, vers); | ||
|
||
printf( "const unsigned char neccblk1 = %d;\n", neccblk1 ); | ||
printf( "const unsigned char neccblk2 = %d;\n", neccblk2 ); | ||
printf( "const unsigned char datablkw = %d;\n", datablkw ); | ||
printf( "const unsigned char eccblkwid = %d;\n", eccblkwid ); | ||
printf( "const unsigned char VERSION = %d;\n", VERSION ); | ||
printf( "const unsigned char ECCLEVEL = %d;\n", ECCLEVEL ); | ||
printf( "const unsigned char WD = %d;\n", WD ); | ||
printf( "const unsigned char WDB = %d;\n", WDB ); | ||
printf( "unsigned char strinbuf[%d];\n", WD*WDB );//(datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2 ); | ||
printf( "unsigned char qrframe[%d];\n", WD*WDB < 600? 600 : WD*WDB ); | ||
printf( "unsigned char rlens[%d];\n", WD+1 ); | ||
|
||
printf( "#ifndef __AVR__\n#define PROGMEM\n#define memcpy_P memcpy\n#define __LPM(x) *x\n#else\n" | ||
"#include <avr/pgmspace.h>\n#endif\nconst unsigned char framebase[] PROGMEM = {\n" ); | ||
|
||
initframe(); | ||
|
||
for (j = 0; j < WD; j++) { | ||
for (i = 0; i < WDB; i++) { | ||
b = framebase[j*WDB+i]; | ||
printf("0x%02x,", b ); | ||
} | ||
printf("\n"); | ||
} | ||
printf( "};\n\nconst unsigned char framask[] PROGMEM = {" ); | ||
unsigned tt, tri = WD*(WD+1)/2; | ||
tri = (tri+7)/8; | ||
for( tt = 0; tt < tri; tt++ ) { | ||
if( !(tt % WDB) ) | ||
printf("\n"); | ||
printf("0x%02x,", framask[tt] ); | ||
} | ||
printf( "\n};\n" ); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
static const unsigned char eccblocks[] PROGMEM = { | ||
1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17, | ||
1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28, | ||
1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22, | ||
1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16, | ||
1, 0,108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22, | ||
2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28, | ||
2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26, | ||
2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26, | ||
2, 0,116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24, | ||
2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28, | ||
4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24, | ||
2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28, | ||
4, 0,107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22, | ||
3, 1,115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24, | ||
5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24, | ||
5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3,13, 15, 30, | ||
1, 5,107, 28, 10, 1, 46, 28, 1,15, 22, 28, 2,17, 14, 28, | ||
5, 1,120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2,19, 14, 28, | ||
3, 4,113, 28, 3,11, 44, 26, 17, 4, 21, 26, 9,16, 13, 26, | ||
3, 5,107, 28, 3,13, 41, 26, 15, 5, 24, 30, 15,10, 15, 28, | ||
4, 4,116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30, | ||
2, 7,111, 28, 17, 0, 46, 28, 7,16, 24, 30, 34, 0, 13, 24, | ||
4, 5,121, 30, 4,14, 47, 28, 11,14, 24, 30, 16,14, 15, 30, | ||
6, 4,117, 30, 6,14, 45, 28, 11,16, 24, 30, 30, 2, 16, 30, | ||
8, 4,106, 26, 8,13, 47, 28, 7,22, 24, 30, 22,13, 15, 30, | ||
10, 2,114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30, | ||
8, 4,122, 30, 22, 3, 45, 28, 8,26, 23, 30, 12,28, 15, 30, | ||
3,10,117, 30, 3,23, 45, 28, 4,31, 24, 30, 11,31, 15, 30, | ||
7, 7,116, 30, 21, 7, 45, 28, 1,37, 23, 30, 19,26, 15, 30, | ||
5,10,115, 30, 19,10, 47, 28, 15,25, 24, 30, 23,25, 15, 30, | ||
13, 3,115, 30, 2,29, 46, 28, 42, 1, 24, 30, 23,28, 15, 30, | ||
17, 0,115, 30, 10,23, 46, 28, 10,35, 24, 30, 19,35, 15, 30, | ||
17, 1,115, 30, 14,21, 46, 28, 29,19, 24, 30, 11,46, 15, 30, | ||
13, 6,115, 30, 14,23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30, | ||
12, 7,121, 30, 12,26, 47, 28, 39,14, 24, 30, 22,41, 15, 30, | ||
6,14,121, 30, 6,34, 47, 28, 46,10, 24, 30, 2,64, 15, 30, | ||
17, 4,122, 30, 29,14, 46, 28, 49,10, 24, 30, 24,46, 15, 30, | ||
4,18,122, 30, 13,32, 46, 28, 48,14, 24, 30, 42,32, 15, 30, | ||
20, 4,117, 30, 40, 7, 47, 28, 43,22, 24, 30, 10,67, 15, 30, | ||
19, 6,118, 30, 18,31, 47, 28, 34,34, 24, 30, 20,61, 15, 30, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
all: hist finder quickie | ||
|
||
CFLAGS = -g -O6 -Wall -U_FORTIFY_SOURCE | ||
|
||
clean: | ||
rm -f hist finder quickie |
Oops, something went wrong.