研究生
最后登录1970-1-1
在线时间 小时
注册时间2015-4-2
|
- void LCD_DispCH(uint16_t x, uint16_t y, const uint8_t *pstr, uint16_t color)
- {
- uint8_t page , column;
- uint8_t buffer[64*64/8];
- uint16_t tmp_char=0;
-
- LCD_OpenWindow(x, y, CH_WIDTH, CH_HEIGHT);
- LCD_ILI9341_CMD(0X2C);
-
- GetGBKCode_from_sd(buffer,pstr); /* è¡×ÖÄ£êy¾Y */
-
- for(page=0; page< CH_HEIGHT; page++)
- {
- /* è¡3öὸö×Ö½úμÄêy¾Y£¬Ôúlcdéϼ′êÇò»¸öoo×ÖμÄò»DD */
- tmp_char=buffer[page*8];
- tmp_char=(tmp_char<<8);
- tmp_char|=buffer[8*page+1];
-
- for (column=0; column< CH_WIDTH; column++)
- {
- if ( tmp_char & (0x01<<15) ) /* ¸ßλÔúÇ° */
- {
- LCD_WR_Data(color);
- }
- else
- {
- LCD_WR_Data(BACKGROUND);
- }
- tmp_char <<= 1;
- }
- }
- }
复制代码
- int GetGBKCode_from_sd(unsigned char* pBuffer,const unsigned char * c)
- {
- unsigned char High8bit,Low8bit;
- unsigned int pos;
- High8bit=*c; /* 衸ß8λêy¾Y */
- Low8bit=*(c+1); /* è¡μí8λêy¾Y */
-
- // printf("%d ,%d\r\n",High8bit,Low8bit);
- // printf("%x ,%x\r\n",High8bit,Low8bit);
-
- //pos = ((High8bit-0xb0)*94+Low8bit-0xa0-1)*2*16;
- pos = ((High8bit-0xa0-16)*94+Low8bit-0xa0-1)*512;
-
- f_mount(0, &myfs[0]);
- myres = f_open(&myfsrc , "0:/font.dat", FA_OPEN_EXISTING | FA_READ);
-
- if ( myres == FR_OK )
- {
- f_lseek (&myfsrc, pos); //Ö¸ÕëÆ«òÆ
- myres = f_read( &myfsrc, pBuffer, 512, &mybr ); //16*16′óD¡μÄoo×Ö Æä×ÖÄ£ Õ¼óÃ16*2¸ö×Ö½ú
-
- f_close(&myfsrc);
-
- return 0;
- }
- else
- return -1;
- }
复制代码
#define CH_WIDTH 64 /* oo×Ö¿í¶è */
#define CH_HEIGHT 64 /* oo×ָ߶è */ |
|