在正点原子开发板的基础上移植的二维码例子程序,在使用的时候注意栈的大小,希望对你有帮助。
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4311 2018-06-19 19:43 二维码实验ASPqrcodeitstream.c
文件 1432 2014-07-24 12:17 二维码实验ASPqrcodeitstream.h
文件 2513 2016-11-18 01:23 二维码实验ASPqrcodeconfig.h
文件 6980 2016-11-18 00:58 二维码实验ASPqrcodemask.c
文件 1560 2014-07-04 00:43 二维码实验ASPqrcodemask.h
文件 4106 2018-06-16 18:47 二维码实验ASPqrcodemmask.c
文件 1404 2014-07-04 00:43 二维码实验ASPqrcodemmask.h
文件 7089 2014-07-04 00:43 二维码实验ASPqrcodemqrspec.c
文件 4774 2014-07-04 00:43 二维码实验ASPqrcodemqrspec.h
文件 20124 2018-06-16 18:47 二维码实验ASPqrcodeqrencode.c
文件 20916 2014-07-24 12:17 二维码实验ASPqrcodeqrencode.h
文件 2778 2014-07-04 00:43 二维码实验ASPqrcodeqrencode_inner.h
文件 38918 2018-06-14 18:05 二维码实验ASPqrcodeqrinput.c
文件 3651 2014-07-24 12:17 二维码实验ASPqrcodeqrinput.h
文件 15715 2014-07-24 12:17 二维码实验ASPqrcodeqrspec.c
文件 5832 2014-07-24 12:17 二维码实验ASPqrcodeqrspec.h
文件 9176 2018-06-16 18:46 二维码实验ASPqrcode
scode.c
文件 1468 2014-07-24 12:17 二维码实验ASPqrcode
scode.h
文件 7709 2014-07-24 12:17 二维码实验ASPqrcodesplit.c
文件 1913 2014-07-24 12:17 二维码实验ASPqrcodesplit.h
文件 109142 2014-07-17 21:52 二维码实验COREcore_cm4.h
文件 22735 2014-07-17 21:52 二维码实验COREcore_cm4_simd.h
文件 17146 2014-07-17 21:52 二维码实验COREcore_cmFunc.h
文件 20513 2014-07-17 21:52 二维码实验COREcore_cmInstr.h
文件 29605 2018-06-16 19:35 二维码实验COREstartup_stm32f40_41xxx.s
文件 6924 2014-08-01 23:18 二维码实验FWLIBincmisc.h
文件 32880 2014-08-01 23:18 二维码实验FWLIBincstm32f4xx_adc.h
文件 27318 2014-08-01 23:18 二维码实验FWLIBincstm32f4xx_can.h
文件 2416 2014-08-01 23:18 二维码实验FWLIBincstm32f4xx_crc.h
文件 14481 2014-08-01 23:18 二维码实验FWLIBincstm32f4xx_cryp.h
............此处省略189个文件信息
/*
* qrencode - QR Code encoder
*
* Binary sequence class.
* Copyright (C) 2006-2011 Kentaro Fukuchi
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License or any later version.
*
* This library is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not write to the Free Software
* Foundation Inc. 51 Franklin St Fifth Floor Boston MA 02110-1301 USA
*/
#if HAVE_CONFIG_H
# include “config.h“
#endif
#include
#include
#include
#include “bitstream.h“
BitStream *BitStream_new(void)
{
BitStream *bstream;
bstream = (BitStream *)malloc(sizeof(BitStream));
if(bstream == NULL) return NULL;
bstream->length = 0;
bstream->data = NULL;
return bstream;
}
static int BitStream_allocate(BitStream *bstream int length)
{
unsigned char *data;
if(bstream == NULL) {
return -1;
}
data = (unsigned char *)malloc(length);
if(data == NULL) {
return -1;
}
if(bstream->data) {
free(bstream->data);
}
bstream->length = length;
bstream->data = data;
return 0;
}
static BitStream *BitStream_newFromNum(int bits unsigned int num)
{
unsigned int mask;
int i;
unsigned char *p;
BitStream *bstream;
bstream = BitStream_new();
if(bstream == NULL) return NULL;
if(BitStream_allocate(bstream bits)) {
BitStream_free(bstream);
return NULL;
}
p = bstream->data;
mask = 1 << (bits - 1);
for(i=0; i if(num & mask) {
*p = 1;
} else {
*p = 0;
}
p++;
mask = mask >> 1;
}
return bstream;
}
static BitStream *BitStream_newFromBytes(int size unsigned char *data)
{
unsigned char mask;
int i j;
unsigned char *p;
BitStream *bstream;
bstream = BitStream_new();
if(bstream == NULL) return NULL;
if(BitStream_allocate(bstream size * 8)) {
BitStream_free(bstream);
return NULL;
}
p = bstream->data;
for(i=0; i mask = 0x80;
for(j=0; j<8; j++) {
if(data[i] & mask) {
*p = 1;
} else {
*p = 0;
}
p++;
mask = mask >> 1;
}
}
return bstream;
}
int BitStream_append(BitStream *bstream BitStream *arg)
{
unsigned char *data;
if(arg == NULL) {
return -1;
}
if(arg->length == 0) {
return 0;
}
if(bstream->length == 0) {
if(BitStream_allocate(bstream arg->length)) {
return -1;
}
memcpy(bstream->data arg->data arg->length);
return 0;
}
data = (unsigned char *)malloc(bstream->length + arg->length);
if(data == NULL) {
return -1;
}
memcpy(data bstream->data bstream->length);
memcpy(data + bstream->length arg->data arg->length);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4311 2018-06-19 19:43 二维码实验ASPqrcodeitstream.c
文件 1432 2014-07-24 12:17 二维码实验ASPqrcodeitstream.h
文件 2513 2016-11-18 01:23 二维码实验ASPqrcodeconfig.h
文件 6980 2016-11-18 00:58 二维码实验ASPqrcodemask.c
文件 1560 2014-07-04 00:43 二维码实验ASPqrcodemask.h
文件 4106 2018-06-16 18:47 二维码实验ASPqrcodemmask.c
文件 1404 2014-07-04 00:43 二维码实验ASPqrcodemmask.h
文件 7089 2014-07-04 00:43 二维码实验ASPqrcodemqrspec.c
文件 4774 2014-07-04 00:43 二维码实验ASPqrcodemqrspec.h
文件 20124 2018-06-16 18:47 二维码实验ASPqrcodeqrencode.c
文件 20916 2014-07-24 12:17 二维码实验ASPqrcodeqrencode.h
文件 2778 2014-07-04 00:43 二维码实验ASPqrcodeqrencode_inner.h
文件 38918 2018-06-14 18:05 二维码实验ASPqrcodeqrinput.c
文件 3651 2014-07-24 12:17 二维码实验ASPqrcodeqrinput.h
文件 15715 2014-07-24 12:17 二维码实验ASPqrcodeqrspec.c
文件 5832 2014-07-24 12:17 二维码实验ASPqrcodeqrspec.h
文件 9176 2018-06-16 18:46 二维码实验ASPqrcode
scode.c
文件 1468 2014-07-24 12:17 二维码实验ASPqrcode
scode.h
文件 7709 2014-07-24 12:17 二维码实验ASPqrcodesplit.c
文件 1913 2014-07-24 12:17 二维码实验ASPqrcodesplit.h
文件 109142 2014-07-17 21:52 二维码实验COREcore_cm4.h
文件 22735 2014-07-17 21:52 二维码实验COREcore_cm4_simd.h
文件 17146 2014-07-17 21:52 二维码实验COREcore_cmFunc.h
文件 20513 2014-07-17 21:52 二维码实验COREcore_cmInstr.h
文件 29605 2018-06-16 19:35 二维码实验COREstartup_stm32f40_41xxx.s
文件 6924 2014-08-01 23:18 二维码实验FWLIBincmisc.h
文件 32880 2014-08-01 23:18 二维码实验FWLIBincstm32f4xx_adc.h
文件 27318 2014-08-01 23:18 二维码实验FWLIBincstm32f4xx_can.h
文件 2416 2014-08-01 23:18 二维码实验FWLIBincstm32f4xx_crc.h
文件 14481 2014-08-01 23:18 二维码实验FWLIBincstm32f4xx_cryp.h
............此处省略189个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)