From 70ceca80d69622c1713a83cf3500eb75ce58f867 Mon Sep 17 00:00:00 2001 From: Mike Szczys Date: Sat, 28 Dec 2013 10:14:04 -0600 Subject: [PATCH] Unique generator now outputs C header file --- .gitignore | 2 ++ unique-string-gen/unique-string-gen.py | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..528d679 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +unique-string-gen/uniqueSet.h +unique-string-gen/uniqueSet.pkl diff --git a/unique-string-gen/unique-string-gen.py b/unique-string-gen/unique-string-gen.py index 5b71fd8..813d3ce 100644 --- a/unique-string-gen/unique-string-gen.py +++ b/unique-string-gen/unique-string-gen.py @@ -28,5 +28,13 @@ print "Saved to uniqueSet.pkl" print - +print "Generating PROGMEM array as uniqueSet.h" +with open('uniqueSet.h', 'w') as f: + f.write("unsigned int uniqueSet[" + str(setSize) + "] PROGMEM = {\n") + for i in range(setSize/5): + if i == (setSize/5)-1: + f.write(str(uniqueSet[0+(i*5):]).replace('[','').replace(']','') + "\n") + else: + f.write(str(uniqueSet[0+(i*5):5+(i*5)]).replace('[','').replace(']','') + ",\n") + f.write("};\n")