# qrcode [中文页](README_ZH.md) | English | [Offical](README_offical.md) ## 1 Introduction **qrcode** is a software package used to generate a QR code from a string. This software package is a port of **RT-Thread** based on [ricmoo/QRCode](https://github.com/ricmoo/QRCode) open source library. ### 1.1 Directory structure | Name | Description | | ---- | ---- | | samples | Examples directory, and some corresponding instructions | | examples | Arduino | | inc | Header file directory | | src | Source Code Directory | ### 1.2 License The `qrcode` software package extends the `QRCode` software package license agreement, please see the `qrcode/LICENSE` file. ### 1.3 Dependency - RT-Thread 3.0+ ## 2. How to open qrcode To use qrcodepackage, you need to select it in the package manager of RT-Thread. The specific path is as follows: ```shell RT-Thread online packages tools packages ---> [*] qrcode: A simple library for generating QR codes in C [*] Enable qrcode sample ``` - `Enable qrcode sample`: Enable QR code sample; Then let RT-Thread's package manager automatically update, or use the `pkgs --update` command to update the package to the BSP. ## 3. Use qrcode ### Generate QR code When using the qrcode software package, you must first define a structure to manage the QR code. ```c QRCode qrcode; ``` Then apply for dynamic memory according to the version number to save the generated QR code, ```c uint8_t *qrcodeBytes = (uint8_t *)rt_calloc(1, qrcode_getBufferSize(DEFAULT_QR_VERSION)); ``` Finally, use the QR code generation function to generate the QR code. ```c qrcode_initText(&qrcode, qrcodeBytes, DEFAULT_QR_VERSION, ECC_LOW, "HELLO WORLD"); ``` ### Print QR code The generated two-dimensional code is dot matrix data, 8 dots constitute a Byte. The following codes can be used to display the QR code ```c for (uint8_t y = 0; y