本文主要在上一篇显示驱动的基础上完成:https://blog.youkuaiyun.com/qq_33746993/article/details/79844659
二维码生成主要移植了libqrcode库来实现,二维码生成后再显示屏上打印出来。
环境准备:libqrcode (下载地址:https://github.com/fukuchi/libqrencode)
使用git命令克隆libqrcode库,然后将该文件夹(不包含子文件夹)下的.c和.h文件整理到一个文件夹qrencode中放在esp-open-rtos/extras文件夹下,这些就是要用到的生成二维码的文件,然后仿照esp-open-rtos/extras下的其他文件夹创建component.mk文件如下:
# Component makefile for extras/qrencode
INC_DIRS += $(ROOT)extras/qrencode
# args for passing into compile rule generation
extras/qrencode_INC_DIR = $(ROOT)extras/qrencode
extras/qrencode_SRC_DIR = $(ROOT)extras/qrencode
$(eval $(call component_compile_rules,extras/qrencode))
在主程序中包含“qrencode.h”,创建二维码使用如下函数: