|
- #include "W25QXX.h" //modify v1.1
- #if !_USE_LFN || _CODE_PAGE != 936
- #error This file is not needed in current configuration. Remove from the project.
- #endif
- //modify v1.1
- #define __SPI_CC936 1
- #define UNI2OEM ((u32)2404)
- #define UNI2OEMEND ((u32)89576)
- #define OEM2UNI ((u32)89577)
- #define OEM2UNIEND ((u32)176749)
- #ifdef __SPI_CC936
- const WCHAR uni2oem;
- const WCHAR oem2uni;
- //add v1.1
- ULONG SizeOfTableuni2oem(void)
- {
- return UNI2OEMEND-UNI2OEM;
- }
- ULONG SizeOfTableoem2uni(void)
- {
- return OEM2UNIEND-OEM2UNI;
- }
- //modify v1.1
- WCHAR ff_convert ( /* Converted code, 0 means conversion error */
- WCHAR chr, /* Character code to be converted */
- UINT dir /* 0: Unicode to OEMCP, 1: OEMCP to Unicode */
- )
- {
- //modify v1.1 const WCHAR *p;
- WCHAR c;
- int i, n, li, hi;
- u32 p;//add v1.1
- WCHAR tem[2];
- if (chr < 0x80) { /* ASCII */
- c = chr;
- } else {
- if (dir) { /* OEMCP to unicode */
- p = OEM2UNI;
- hi = SizeOfTableoem2uni() / 4 - 1;
- } else { /* Unicode to OEMCP */
- p = UNI2OEM;
- hi = SizeOfTableuni2oem() / 4 - 1;
- }
- li = 0;
- for (n = 16; n; n--) {
- i = li + (hi - li) / 2;
- W25Q128_BufferRead((u8 *)tem,p+(i * 2),2);
- if (chr == (*(u16*)tem) ) break;
- if (chr > (*(u16*)tem) )
- li = i;
- else
- hi = i;
- }
- W25Q128_BufferRead((u8 *)tem, p+(i * 2 + 1),2);
- c = n ? (*(u16*)tem) : 0;
- }
- return c;
- }
复制代码
cc936.c.txt
(708.77 KB, 下载次数: 29)
|
|