单片机二维码放大程序
uint8_t m_byModuleData[][];//原数据
#define QR_WHITE_SIDE 12 // 白边
#define DATA_H_LEN (MAX_MODULESIZE - QR_WHITE_SIDE)
#define DATA_L_LEN (MAX_MODULESIZE - QR_WHITE_SIDE)
#define MULTIPLE 13 //放大倍数 13*13
void LcdFillQrCode(uint16_t xStart, uint16_t yStart){
static uint8_t DstQRCodeData[MULTIPLE][MULTIPLE*DATA_L_LEN];
uint32_t HIndex, LIndex, MultilpleHIndex, MultilpleLIndex;
BlockWrite( xStart, xStart+DATA_L_LEN*MULTIPLE-1, yStart, yStart+DATA_H_LEN*MULTIPLE-1 )
for( HIndex=0; HIndex<DATA_H_LEN; HIndex++ )
{
for( LIndex=0; LIndex<DATA_L_LEN; LIndex++ )
{
for( MultilpleHIndex=0; MultilpleHIndex<MULTIPLE; MultilpleHIndex++ )
{
for( MultilpleLIndex=0; MultilpleLIndex<MULTIPLE; MultilpleLIndex++ )
{
DstQRCodeData[MultilpleHIndex][LIndex*MULTIPLE+MultilpleLIndex] = m_byModuleData[HIndex][LIndex];
}
}
}
for( MultilpleHIndex=0; MultilpleHIndex<MULTIPLE; MultilpleHIndex++ )
{
for( MultilpleLIndex=0; MultilpleLIndex<MULTIPLE*DATA_L_LEN; MultilpleLIndex++ )
{
if( DstQRCodeData[MultilpleHIndex][MultilpleLIndex] == 0x01 )
{
*(__IO uint16_t * ) (Bank1_LCD_D) = BLACK;
}
else
{
*(__IO uint16_t * ) (Bank1_LCD_D) = WHITE;
}
}
}
}
}
|