#ifndef __QR_CODE_H
#define __QR_CODE_H

#include<string.h>
#include<stdio.h>

//ECLevl�ĺ궨��:
#define 	ECLevel_L		0
#define 	ECLevel_M		1
#define 	ECLevel_Q		2
#define 	ECLevel_H		3

//MaskNub�ĺ궨��:
#define   MaskPattern0  0
#define   MaskPattern1  1
#define   MaskPattern2  2
#define   MaskPattern3  3
#define   MaskPattern4  4
#define   MaskPattern5  5
#define   MaskPattern6  6
#define   MaskPattern7  7
//CodeMode�ĺ궨��:
#define 	Mode_Unicode	10
#define 	Mode_GBK 		11
#define 	Mode_KSC5601	12
#define 	Mode_SHIFT_JIS	13
 //�ú����ο� spi�ο��ļ�
extern unsigned char r_dat_bat(unsigned long address,unsigned long DataLen,unsigned char *pBuff);
extern unsigned char versionN;			//�ڲ�����, QR�汾��
extern unsigned char QRDataBuf[4072]; 		//���ж���, ��ά��ͼ������
extern unsigned char QRCodeDataBuf[3706];	//���ж���


unsigned char qrcode_get(unsigned char CodeMode,unsigned char ECLevel,unsigned char MaskNub, unsigned char *str,long unsigned int length);

#if 0
//��������
unsigned char QRCodeUnicode[]=
{
	/*��ת��baiduҳ��   https://www.baidu.com/ */
	0x00,0x68,0x00,0x74,0x00,0x74,0x00,0x70,0x00,0x73,0x00,0x3A,0x00,0x2f,
	0x00,0x2f,0x00,0x77,0x00,0x77,0x00,0x77,0x00,0x2e,0x00,0x62,0x00,0x61,
	0x00,0x69,0x00,0x64,0x00,0x75,0x00,0x2E,0x00,0x63,0x00,0x6f,0x00,0x6d,
	0x00,0x2f,

	/* ����Unicode���ֲ��� */
//	0x4e,0x00,0x4e,0x01,0x4e,0x02,0x4e,0x03,0x4e,0x04,0x4e,0x05,0x4e,0x06,0x4e,0x07,0x4e,0x08,0x4e,0x09,
//	0x4e,0x0a,0x4e,0x0b,0x4e,0x0c,0x4e,0x0d,0x4e,0x0e,0x4e,0x0f,0x4e,0x10,0x4e,0x11,0x4e,0x12,0x4e,0x13,
//	0x4e,0x14,0x4e,0x15,0x4e,0x16,0x4e,0x17,0x4e,0x18,0x4e,0x19,0x4e,0x1a,0x4e,0x1b,0x4e,0x1c,0x4e,0x1d,
//	0x4e,0x1e,0x4e,0x1f,0x4e,0x20,0x4e,0x21,0x4e,0x22,0x4e,0x23,0x4e,0x24,0x4e,0x25,0x4e,0x26,0x4e,0x27,
// 	0x4e,0x28,0x4e,0x29,0x4e,0x2a,0x4e,0x2b,0x4e,0x2c,0x4e,0x2d,0x4e,0x2e,0x4e,0x2f,0x4e,0x30,0x4e,0x31,
// 	0x4e,0x32,0x4e,0x33,0x4e,0x34,0x4e,0x35,0x4e,0x36,0x4e,0x37,0x4e,0x38,0x4e,0x39,0x4e,0x3a,0x4e,0x3b,
// 	0x4e,0x3c,0x4e,0x3d,0x4e,0x3e,0x4e,0x3f,0x4e,0x40,0x4e,0x41,0x4e,0x42,0x4e,0x43,0x4e,0x44,0x4e,0x45,

};

void main() {
	qrcode_get(Mode_Unicode,ECLevel_H,MaskPattern4,QRCodeUnicode,sizeof(QRCodeUnicode));
	w=4*versionN+17; h_byte = (w+7)/8;
	//���ú��� ת ���ú��� ��ʾ
	DisZK_DZ_Y(50,50,w,h_byte*8,BLACK,WHITE,QRDataBuf,1);	//�ο�spi�����ļ�
}
#endif

#endif
