Show the QR code on the display and save in a BMP file

Document created by jimmychan Employee on Oct 29, 2014
Version 1Show Document
  • View in full screen mode

This is an example of QR code encoding using i.MX28. The encoded QR image can show on the LCD display directly using frame buffer and the image saved as a BMP file.

 

Board : i.MX28EVK

BSP : L2.6.35_1.1.0_130130_source

 

 

QR Code Lib:  qrencode-3.4.4.tar.gz

Download from https://fukuchi.org/works/qrencode/

Libqrencode is a C library for encoding data in a QR Code symbol. This library is a free software made by Kentaro Fukuchi.

 

 

Build the QR Code Lib source code into rootfs.

1. Create a new folder in <ltib>/dist/lfs-5.1/.

    e.g. <ltib>/dist/lfs-5.1/qrencode

2. Copy the qrencode.spec to this new created folder

3. Build the source code

   ./ltib –p qrencode.spec –m prep

   ./ltib –p qrencode.spec –m scbuild

   ./ltib –p qrencode.spec –m scdeploy

 

Create and build the application in unit_test:

- I use the existing unit_test package to build my application code.

1. Extract the source code of unit_test

   ./ltib –p imx-test –m prep

2. cd <ltib>/rpm/BUILD/imx-test-2.6.35.3-1.1.0/test

3. mkdir qr_test

4. copy the Makefile and qr_test.c to qr_test folder

5. Build the unit_test

    ./ltib –p imx-test  –m scbuild

    ./ltib –p imx-test  –m scdeploy

 

After built the code successfully, the qr_test.out will be generated in the unit_test folder.

I start the board with NFS, so I can run the qr_test.out on the board directly.

 

The command is :

./qr_test.out   (the default QR encode text is “http://www.freescale.com”)

 

Or input the new text like this :

./qr_test.out –t https://community.freescale.com/community/imx

 

The QR code  show on the display:

display.jpg

 

And the BMP files will be generated in the unit_test folder.

 

qr.png

Attachments

Outcomes