From 087fd70276929a68bfa117f1547176c2ed361672 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 3 Mar 2022 16:11:31 +0000 Subject: [PATCH 1/6] Add QRCode MicroPython module --- .gitmodules | 3 +++ micropython/modules/badger2040-micropython.cmake | 1 + micropython/modules/qrcode | 1 + 3 files changed, 5 insertions(+) create mode 160000 micropython/modules/qrcode diff --git a/.gitmodules b/.gitmodules index 87e37f064..474f7d55e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,3 +14,6 @@ [submodule "drivers/scd4x/src"] path = drivers/scd4x/src url = https://github.com/Sensirion/embedded-i2c-scd4x +[submodule "micropython/modules/qrcode"] + path = micropython/modules/qrcode + url = https://github.com/pimoroni/QR-Code-Generator diff --git a/micropython/modules/badger2040-micropython.cmake b/micropython/modules/badger2040-micropython.cmake index fd3f12fc8..274e651c9 100644 --- a/micropython/modules/badger2040-micropython.cmake +++ b/micropython/modules/badger2040-micropython.cmake @@ -34,3 +34,4 @@ include(badger2040/micropython) include(micropython/examples/badger2040/micropython-builtins) include(plasma/micropython) include(ulab/code/micropython) +include(qrcode/micropython/micropython) diff --git a/micropython/modules/qrcode b/micropython/modules/qrcode new file mode 160000 index 000000000..2576e6118 --- /dev/null +++ b/micropython/modules/qrcode @@ -0,0 +1 @@ +Subproject commit 2576e61183612055791dda446c0791714f8067b4 From 89172578acd5d73407193636cb498f3ad8085c96 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 3 Mar 2022 22:10:22 +0000 Subject: [PATCH 2/6] qrcode: Bind ECC and Mask controls --- micropython/modules/qrcode | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micropython/modules/qrcode b/micropython/modules/qrcode index 2576e6118..b5afd3c03 160000 --- a/micropython/modules/qrcode +++ b/micropython/modules/qrcode @@ -1 +1 @@ -Subproject commit 2576e61183612055791dda446c0791714f8067b4 +Subproject commit b5afd3c031c3f6ddd89e73833a1c8e551134e291 From 3c70a3847e078dee9db0ace8c4bbe44b8c522d13 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Fri, 4 Mar 2022 18:07:10 +0000 Subject: [PATCH 3/6] qrcode: Add example to badgerOS --- .../badger2040/assets/launchericons.png | Bin 10083 -> 9981 bytes micropython/examples/badger2040/launcher.py | 6 ++- .../badger2040/micropython-builtins.cmake | 1 + micropython/examples/badger2040/qr_code.py | 35 ++++++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 micropython/examples/badger2040/qr_code.py diff --git a/micropython/examples/badger2040/assets/launchericons.png b/micropython/examples/badger2040/assets/launchericons.png index 6b5364232552c1eaa7d43a901d4bf5635f695587..da93e0a097067040a6afe167156a29c8425514aa 100644 GIT binary patch delta 6553 zcmV;K8D{3=PW?@PiBL{Q4GJ0x0000DNk~Le0006&0000$2nGNE0P+RM9{>OkIeJuB zbW&k=AaHVTW@&6?Aar?fWgumEX=VTbc-pO*Yi^`Fjzs@!6|)3U5=Ck`dIG(JS^gZR z?V5Y5tAPf(ov<@2ANnLlFd~?h?*IPdrT^il_Eu6;^FDfi&-}E}MwvYD{Pi+dg&?<*AlZK3ZA z)!0$&?R+mZz89+H>jn8?-|^%CASip(6Xwpw#~L zj>HpxFJ}LB|HtP=|6Kg^De+&fT=(~*^7rST=l%O}etzFOp5D7(r<<))(*Av@pCf)A z@y12T>*r&goAIkWw$E*F^8|Z0=p3%MxNR9yfaOVllOt1}+|T`%%@$j^#kenJm->0m ztCdl9%?X@Z+~gIjqn_#@wt=_uZ27ep`CNB=F1N+G@DbiwgvI0w{_@|s{mX^ki`t4r zG35&Y_EmzYY$K41zq|`T`rYVCmIC9ch9Og`@| zTE3n}vj9SCr=1*tCRjCu4gOejI5f3tQ`N4fu0v->`nvYst%vwctJX}do0;3N>D8O7 zcQ^Os!{;cYB91!xu;F8jIl1U$<;kZfZ@p^U8%vw_Uyc+Vwl`d{FJx*Pg!q?D-pS{z6UC7p(tu`}a|kAJobRsd%IP zLXD4_{VX9NCmNW6SZM;{76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_-6EuLIdXCNOlee^^}nz2)COTL15DyesUcbbpL5CPp{@ z_UB_~m)f=s4FGhDxL8t#{{NS2Q>z(YChZ<;tpDFSye7U50Jkhd1&wd|wBNd5g%!sE z6<^F++s0p+_rhFtbni_GjsOB8BE=MtN4f}0L7K*wweDCM3P5kmd_H{GJ1v*``iyN1 zXgwxq>EC&Yo+p^@*6J zlYR}z>J7Y_F}9$?s$zdqmfJTlVwvq}H4_1s;?mllJ9 zGsu^SF$)9`KgONkn14R+W>9N~YrkziT;*w)5_t#=z$mJ3>UGIGeYwieVdD=!**h`b zZae}2pi%}h(lxK9bG2&yZ8eV(Rhh9#q#kh^eiDrkoVM1^b~Xl`Y+O|KN4sA*Te-^a zkvhY=)-U@5Eb(peBXm}!(Xp4OCL7jvw+6KqI~4!`(5!4?5`V|pG_>*_y-Uu_Nz|=p zCh-gaV9kJCdBU3cPqn6YdL)hj0GQQum4(}18j$^QrFbU2(}9S?`$ z)$jze{(gVnj3&F@UsINrbhqD`z&gg4U{~Y7FQ|KM`+sWgbk6gc3z9N>W|K=n@t~~i zqSQUrJkl!bpj}5mkglv#i)53H(r{*dk<%#@0xaLx_6PAm_CNf4`w4l}l_qy5I3>IG zkm|`Ybkg|u58lR?_AA;Z>)w@`K1foO9PYn(4+#OS@Iih*_K_5C+o-@3&0J^P#xo4W}ry@cN$EnIeLtD>EzI7YS`_|P!Z#8R-_K>bw_Fj zxUu?%#e3>9bh+_ciD$fE;}HM=fQQ0%&;S4k y0000W0001h000000ssI22mk;8AOHXWkdl93pvf Date: Thu, 10 Mar 2022 15:14:56 +0000 Subject: [PATCH 4/6] qrcode: Rename & improve example --- micropython/examples/badger2040/launcher.py | 2 +- .../badger2040/micropython-builtins.cmake | 2 +- .../badger2040/{qr_code.py => qrgen.py} | 41 +++++++++++++++++-- 3 files changed, 40 insertions(+), 5 deletions(-) rename micropython/examples/badger2040/{qr_code.py => qrgen.py} (50%) diff --git a/micropython/examples/badger2040/launcher.py b/micropython/examples/badger2040/launcher.py index 2c1119c47..aecf043f5 100644 --- a/micropython/examples/badger2040/launcher.py +++ b/micropython/examples/badger2040/launcher.py @@ -25,7 +25,7 @@ ("_image", 3), ("_list", 4), ("_badge", 5), - ("_qr_code", 8), + ("_qrgen", 8), ("_info", 6), ("_help", 7) ] diff --git a/micropython/examples/badger2040/micropython-builtins.cmake b/micropython/examples/badger2040/micropython-builtins.cmake index ad4260d94..1e748026f 100644 --- a/micropython/examples/badger2040/micropython-builtins.cmake +++ b/micropython/examples/badger2040/micropython-builtins.cmake @@ -51,4 +51,4 @@ copy_module(usermod_badger2040 ${CMAKE_CURRENT_LIST_DIR}/list.py _list) copy_module(usermod_badger2040 ${CMAKE_CURRENT_LIST_DIR}/badge.py _badge) copy_module(usermod_badger2040 ${CMAKE_CURRENT_LIST_DIR}/help.py _help) copy_module(usermod_badger2040 ${CMAKE_CURRENT_LIST_DIR}/info.py _info) -copy_module(usermod_badger2040 ${CMAKE_CURRENT_LIST_DIR}/qr_code.py _qr_code) +copy_module(usermod_badger2040 ${CMAKE_CURRENT_LIST_DIR}/qrgen.py _qrgen) diff --git a/micropython/examples/badger2040/qr_code.py b/micropython/examples/badger2040/qrgen.py similarity index 50% rename from micropython/examples/badger2040/qr_code.py rename to micropython/examples/badger2040/qrgen.py index b5c2b1efd..1c980c1ea 100644 --- a/micropython/examples/badger2040/qr_code.py +++ b/micropython/examples/badger2040/qrgen.py @@ -2,6 +2,31 @@ import qrcode import time + +# Open the qrcode file +try: + text = open("qrcode.txt", "r") +except OSError: + text = open("qrcode.txt", "w") + text.write("""https://pimoroni.com/badger2040 +Badger 2040 +* 296x128 1-bit e-ink +* six user buttons +* user LED +* 2MB QSPI flash + +Scan this code to learn +more about Badger 2040. +""") + text.flush() + text.seek(0) + + +lines = text.read().strip().split("\n") +code_text = lines.pop(0) +title_text = lines.pop(0) +detail_text = lines + display = badger2040.Badger2040() code = qrcode.QRCode() @@ -23,12 +48,22 @@ def draw_qr_code(ox, oy, size, code): display.rectangle(ox + x * module_size, oy + y * module_size, module_size, module_size) -code.set_text("pimoroni.com/badger2040") +code.set_text(code_text) size, _ = measure_qr_code(128, code) -left = int((badger2040.WIDTH / 2) - (size / 2)) -top = int((badger2040.HEIGHT / 2) - (size / 2)) +left = top = int((badger2040.HEIGHT / 2) - (size / 2)) draw_qr_code(left, top, 128, code) +left = 128 + 5 + +display.thickness(2) +display.text(title_text, left, 20, 0.5) +display.thickness(1) + +top = 40 +for line in detail_text: + display.text(line, left, top, 0.4) + top += 10 + display.update() while True: From d20af57ddabcb4690b341221d2b39328d07bc2ef Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 10 Mar 2022 15:16:23 +0000 Subject: [PATCH 5/6] qrcode: Add to regular MicroPython build --- micropython/modules/micropython.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/micropython/modules/micropython.cmake b/micropython/modules/micropython.cmake index 4f2ea23bc..f8010f9e9 100644 --- a/micropython/modules/micropython.cmake +++ b/micropython/modules/micropython.cmake @@ -42,5 +42,6 @@ include(pico_wireless/micropython) include(plasma/micropython) include(hub75/micropython) include(ulab/code/micropython) +include(qrcode/micropython/micropython) -include(modules_py/modules_py) \ No newline at end of file +include(modules_py/modules_py) From 421d1edf846663fb7818fafb15b5a9de30c7157e Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 10 Mar 2022 15:57:27 +0000 Subject: [PATCH 6/6] qrcode: Basic MicroPython example for PicoDisplay --- .../examples/pico_display/basic_qrcode.py | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 micropython/examples/pico_display/basic_qrcode.py diff --git a/micropython/examples/pico_display/basic_qrcode.py b/micropython/examples/pico_display/basic_qrcode.py new file mode 100644 index 000000000..72ac1af87 --- /dev/null +++ b/micropython/examples/pico_display/basic_qrcode.py @@ -0,0 +1,43 @@ +import picodisplay as display # Comment this line out to use PicoDisplay2 +# import picodisplay2 as display # Uncomment this line to use PicoDisplay2 +import qrcode + + +def measure_qr_code(size, code): + w, h = code.get_size() + module_size = int(size / w) + return module_size * w, module_size + + +def draw_qr_code(ox, oy, size, code): + size, module_size = measure_qr_code(size, code) + display.set_pen(128, 128, 128) + display.rectangle(ox, oy, size, size) + display.set_pen(0, 0, 0) + for x in range(size): + for y in range(size): + if code.get_module(x, y): + display.rectangle(ox + x * module_size, oy + y * module_size, module_size, module_size) + + +width = display.get_width() +height = display.get_height() + +code = qrcode.QRCode() +code.set_text("shop.pimoroni.com") + +display.init(bytearray(width * height * 2)) + +display.set_pen(128, 128, 128) +display.clear() +display.set_pen(0, 0, 0) + +size, module_size = measure_qr_code(height, code) +left = int((width // 2) - (size // 2)) +top = int((height // 2) - (size // 2)) +draw_qr_code(left, top, height, code) + +display.update() + +while True: + pass