QRCode.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef __QR_CODE_H
  2. #define __QR_CODE_H
  3. #include<string.h>
  4. #include<stdio.h>
  5. //ECLevl�ĺ궨��:
  6. #define ECLevel_L 0
  7. #define ECLevel_M 1
  8. #define ECLevel_Q 2
  9. #define ECLevel_H 3
  10. //MaskNub�ĺ궨��:
  11. #define MaskPattern0 0
  12. #define MaskPattern1 1
  13. #define MaskPattern2 2
  14. #define MaskPattern3 3
  15. #define MaskPattern4 4
  16. #define MaskPattern5 5
  17. #define MaskPattern6 6
  18. #define MaskPattern7 7
  19. //CodeMode�ĺ궨��:
  20. #define Mode_Unicode 10
  21. #define Mode_GBK 11
  22. #define Mode_KSC5601 12
  23. #define Mode_SHIFT_JIS 13
  24. //�ú����ο� spi�ο��ļ�
  25. extern unsigned char r_dat_bat(unsigned long address,unsigned long DataLen,unsigned char *pBuff);
  26. extern unsigned char versionN; //�ڲ�����, QR�汾��
  27. extern unsigned char QRDataBuf[4072]; //���ж���, ��ά��ͼ������
  28. extern unsigned char QRCodeDataBuf[3706]; //�����
  29. unsigned char qrcode_get(unsigned char CodeMode,unsigned char ECLevel,unsigned char MaskNub, unsigned char *str,long unsigned int length);
  30. #if 0
  31. //��������
  32. unsigned char QRCodeUnicode[]=
  33. {
  34. /*��ת��baiduҳ�� https://www.baidu.com/ */
  35. 0x00,0x68,0x00,0x74,0x00,0x74,0x00,0x70,0x00,0x73,0x00,0x3A,0x00,0x2f,
  36. 0x00,0x2f,0x00,0x77,0x00,0x77,0x00,0x77,0x00,0x2e,0x00,0x62,0x00,0x61,
  37. 0x00,0x69,0x00,0x64,0x00,0x75,0x00,0x2E,0x00,0x63,0x00,0x6f,0x00,0x6d,
  38. 0x00,0x2f,
  39. /* ����Unicode���ֲ��� */
  40. // 0x4e,0x00,0x4e,0x01,0x4e,0x02,0x4e,0x03,0x4e,0x04,0x4e,0x05,0x4e,0x06,0x4e,0x07,0x4e,0x08,0x4e,0x09,
  41. // 0x4e,0x0a,0x4e,0x0b,0x4e,0x0c,0x4e,0x0d,0x4e,0x0e,0x4e,0x0f,0x4e,0x10,0x4e,0x11,0x4e,0x12,0x4e,0x13,
  42. // 0x4e,0x14,0x4e,0x15,0x4e,0x16,0x4e,0x17,0x4e,0x18,0x4e,0x19,0x4e,0x1a,0x4e,0x1b,0x4e,0x1c,0x4e,0x1d,
  43. // 0x4e,0x1e,0x4e,0x1f,0x4e,0x20,0x4e,0x21,0x4e,0x22,0x4e,0x23,0x4e,0x24,0x4e,0x25,0x4e,0x26,0x4e,0x27,
  44. // 0x4e,0x28,0x4e,0x29,0x4e,0x2a,0x4e,0x2b,0x4e,0x2c,0x4e,0x2d,0x4e,0x2e,0x4e,0x2f,0x4e,0x30,0x4e,0x31,
  45. // 0x4e,0x32,0x4e,0x33,0x4e,0x34,0x4e,0x35,0x4e,0x36,0x4e,0x37,0x4e,0x38,0x4e,0x39,0x4e,0x3a,0x4e,0x3b,
  46. // 0x4e,0x3c,0x4e,0x3d,0x4e,0x3e,0x4e,0x3f,0x4e,0x40,0x4e,0x41,0x4e,0x42,0x4e,0x43,0x4e,0x44,0x4e,0x45,
  47. };
  48. void main() {
  49. qrcode_get(Mode_Unicode,ECLevel_H,MaskPattern4,QRCodeUnicode,sizeof(QRCodeUnicode));
  50. w=4*versionN+17; h_byte = (w+7)/8;
  51. //���ú��� ת ���ú��� ��ʾ
  52. DisZK_DZ_Y(50,50,w,h_byte*8,BLACK,WHITE,QRDataBuf,1); //�ο�spi�����ļ�
  53. }
  54. #endif
  55. #endif