||
實(shí)驗(yàn)環(huán)境
硬件:STM32板 (STM32F207 )
LCD12864 模塊 (ST7565)
USB轉(zhuǎn)串口模塊 TTL
ST-Link V2 調(diào)試
軟件:MDK Keil v5.12
PortHelper.exe 串口調(diào)試助手
實(shí)驗(yàn)?zāi)康?/p>
在嵌入式平臺上生成QR Code,LCD顯示
實(shí)驗(yàn)步驟:
#if HAVE_CONFIG_H
# include "config.h"
#endif
改為
# include "config.h"
添加 config.h文件,添加如下信息
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 0
/* Major version number */
#define MAJOR_VERSION 3
/* Micro version number */
#define MICRO_VERSION 0
/* Minor version number */
#define MINOR_VERSION 9
/* Define to the version of this package. */
#define PACKAGE_VERSION "3.9.0"
/* Version number of package */
//#define VERSION "3.9.0"
#define LIBQRENCODE_VERSION "3.9.0"
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to 'static' if no test programs will be compiled. */
#define __STATIC
#define WITH_TESTS 1
#include "qrencode.h"
#include "qrspec.h"
#include "mqrspec.h"
#include "bitstream.h"
#include "qrinput.h"
#include "rsecc.h"
#include "split.h"
#include "mask.h"
#include "mmask.h"
QRcode*qrcode; //最后結(jié)果
qrcode= QRcode_encodeString("sissi",2, QR_ECLEVEL_L, QR_MODE_8,0);
printf("====version=%d========\r\n",qrcode->version);
for(y=0;y<qrcode->width;y++)
{
for(x=0;x<qrcode->width;x++)
{
if(qrcode->data[y*qrcode->width+x]&0x01)
{
printf("#");
// LCM_SetPixel(x,y,1);
}
else
{
printf(" ");
// LCM_SetPixel(x,y,0);
}
}
printf("\r\n");
}
printf("\r\n");
//DISPLAY_RENCODE_TO_TFT(0,0,2);
QRcode_free(qrcode);
改不了先去掉文件的只讀權(quán)限
Powered by 單片機(jī)教程網(wǎng)