完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
通过裁剪Zint条码生成库,由于运行生成条码的代码时需要很大的RAM,所以在这里我将代码编译到外部SDRAM实现,EMWIN内存设备实现绘图显示。内容有点多,,有兴趣的朋友可以找我,,,,绝对不是键盘侠!!!
|
|
相关推荐
6个回答
|
|
Q270933662 注明目的
|
|
|
|
LR_IROM1 0x08000000 0x00100000 { ; load region size_region
ER_IROM1 0x08000000 0x00100000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_EXRAM1 0xC1E0C000 0x1F4000 { ;2of5.o (+RW +ZI) ;auspost.o (+RW +ZI) ;aztec.o (+RW +ZI) ;code.o (+RW +ZI) ;code1.o (+RW +ZI) ;code16k.o (+RW +ZI) ;code49.o (+RW +ZI) code128.o (+RW +ZI) qr.o (+RW +ZI) upcean.o (+RW +ZI) ;common.o (+RW +ZI) ;composite.o (+RW +ZI) ;dllversion.o (+RW +ZI) .ANY1 (+RW +ZI) } RW_IRAM1 0x20000000 0x00030000 { ; RW data startup_stm32f429xx.o(STACK) .ANY2 (+RW +ZI) } } 这是 SCT链接脚本代码 |
|
|
|
static WM_HMEM GetBarcodeImage(DATAFORMAT *Msg)
{ GUI_RECT ImageSize; struct zint_symbol* my_symbol = ZBarcode_Create(); int fd; U32 len; int i; U16 x1=0,y1=0; char *barCodeData; WM_HMEM hMem; switch(Msg->GeneralPara0) { case 0: my_symbol->symbology = BARCODE_CODE128; break; case 1: my_symbol->symbology = BARCODE_EANX; break; case 2: my_symbol->symbology = BARCODE_QRCODE; break; } fd = ZBarcode_Encode(my_symbol,Msg->DispProp,0); Msg->GeneralPara4 = my_symbol->rows; len = my_symbol->rows*(1 + my_symbol->width); barCodeData = (char*)mymalloc(SRAMIN,len); for (int r = 0; r < my_symbol->rows; r++) { for (i = 0; i < my_symbol->width; i++) { barCodeData[r*(my_symbol->width + 1) + i] = module_is_set(my_symbol, r, i) ? '1' : '0'; } barCodeData[r*(my_symbol->width + 1) + i] = ','; } ImageSize.x0 = 0; ImageSize.y0 = 0; if(Msg->GeneralPara4 == 0){ #if DEBUG printf("Code error"); #endif ImageSize.x1 = 120; ImageSize.y1 = 30; } else if(Msg->GeneralPara4 == 1) { ImageSize.x1 = (my_symbol->width+1)*Msg->GeneralPara2; ImageSize.y1 = Msg->GeneralPara1; } else { ImageSize.x1 = my_symbol->width*Msg->GeneralPara1; ImageSize.y1 = Msg->GeneralPara2*my_symbol->rows*Msg->GeneralPara1; if(ImageSize.y1 > 154) ImageSize.y1 = 154; } ZBarcode_Delete(my_symbol); hMem = GUI_MEMDEV_CreateFixed(0, 0, ImageSize.x1, ImageSize.y1, GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUI_COLOR_CONV_888); GUI_MEMDEV_Select(hMem); GUI_SetBkColor(GUI_WHITE); GUI_Clear(); if(Msg->GeneralPara4 == 0) { GUI_SetFont(System24_Font); GUI_SetTextMode(GUI_TM_TRANS); GUI_SetColor(GUI_BLACK); GUI_DispStringAt(tr("Code error"),2,2); } else if(Msg->GeneralPara4 == 1) //画条码 { for(int i=0; i if(barCodeData == '1') { GUI_SetColor(GUI_BLACK); } else if(barCodeData == '0') { GUI_SetColor(GUI_WHITE); } x1 += Msg->GeneralPara2; GUI_FillRect(x1, y1, x1 + Msg->GeneralPara2, y1 + Msg->GeneralPara1); } } else //画二维码 { for(int i=0; i if(barCodeData == '1') { GUI_SetColor(GUI_BLACK); } else if(barCodeData == '0') { GUI_SetColor(GUI_WHITE); } if(barCodeData==',') { x1 = 0; y1 += Msg->GeneralPara1* Msg->GeneralPara2; } else { GUI_FillRect(x1, y1, x1 + Msg->GeneralPara1, y1 + Msg->GeneralPara1* Msg->GeneralPara2); x1 += Msg->GeneralPara1; } } } GUI_MEMDEV_Select(0); myfree(SRAMIN,barCodeData); Msg->XSize = ImageSize.x1; Msg->YSize = ImageSize.y1; return hMem; } 这是绘制条码二维码的代码,更改或添加SWITCH中的条码类,即可添加所想要的条码类 |
|
|
|
|
|
|
|
你好,原码可以公开一下吗?最近也在研究用STM32生成二维码显示,谢谢了
|
|
|
|
条码二维码生成源码就是我上边提供的,在你的源文件添加上Zint条码库所需包含文件就可以了
|
|
|
|
只有小组成员才能发言,加入小组>>
800 浏览 0 评论
1156 浏览 1 评论
2531 浏览 5 评论
2863 浏览 9 评论
移植了freeRTOS到STMf103之后显示没有定义的原因?
2714 浏览 6 评论
keil5中manage run-time environment怎么是灰色,不可以操作吗?
1089浏览 3评论
195浏览 2评论
461浏览 2评论
374浏览 2评论
M0518 PWM的电压输出只有2V左右,没有3.3V是怎么回事?
456浏览 1评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-24 21:36 , Processed in 1.159876 second(s), Total 90, Slave 71 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号