179 lines
4.7 KiB
C
179 lines
4.7 KiB
C
/**
|
||
******************************************************************************
|
||
* @file fonts.h
|
||
* @author MCD Application Team
|
||
* @version V1.0.0
|
||
* @date 18-February-2014
|
||
* @brief Header for fonts.c file
|
||
******************************************************************************
|
||
* @attention
|
||
*
|
||
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
||
*
|
||
* Redistribution and use in source and binary forms, with or without modification,
|
||
* are permitted provided that the following conditions are met:
|
||
* 1. Redistributions of source code must retain the above copyright notice,
|
||
* this list of conditions and the following disclaimer.
|
||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||
* this list of conditions and the following disclaimer in the documentation
|
||
* and/or other materials provided with the distribution.
|
||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||
* may be used to endorse or promote products derived from this software
|
||
* without specific prior written permission.
|
||
*
|
||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
*
|
||
******************************************************************************
|
||
*/
|
||
|
||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||
#ifndef __FONTS_H
|
||
#define __FONTS_H
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
/* Includes ------------------------------------------------------------------*/
|
||
#include <stdint.h>
|
||
|
||
/** @addtogroup Utilities
|
||
* @{
|
||
*/
|
||
|
||
/** @addtogroup STM32_EVAL
|
||
* @{
|
||
*/
|
||
|
||
/** @addtogroup Common
|
||
* @{
|
||
*/
|
||
|
||
/** @addtogroup FONTS
|
||
* @{
|
||
*/
|
||
|
||
/** @defgroup FONTS_Exported_Types
|
||
* @{
|
||
*/
|
||
typedef struct _tFont
|
||
{
|
||
const uint8_t *table;
|
||
uint16_t Width;
|
||
uint16_t Height;
|
||
|
||
} sFONT;
|
||
|
||
extern sFONT Font24;
|
||
extern sFONT Font20;
|
||
extern sFONT Font16;
|
||
extern sFONT Font12;
|
||
extern sFONT Font8;
|
||
/**
|
||
* @}
|
||
*/
|
||
|
||
/** @defgroup FONTS_Exported_Constants
|
||
* @{
|
||
*/
|
||
#define LINE(x) ((x) * (((sFONT *)LCD_GetFont())->Height))
|
||
|
||
/*******************<2A><><EFBFBD><EFBFBD>********** <20><><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>С ***************************/
|
||
#define WIDTH_CH_CHAR 24 //<2F><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
||
#define HEIGHT_CH_CHAR 24 //<2F><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>߶<EFBFBD>
|
||
|
||
//0<><30>ʾʹ<CABE><CAB9>SD<53><44><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾFLASH<53><48>ģ,<2C><><EFBFBD><EFBFBD>SD<53><44><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>ļ<EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>ٶ<EFBFBD><D9B6><EFBFBD><EFBFBD>ܶࡣ
|
||
|
||
#define GBKCODE_FLASH 1
|
||
|
||
#if GBKCODE_FLASH
|
||
/*ʹ<><CAB9>FLASH<53><48>ģ*/
|
||
/*=========================================================================================*/
|
||
/*<2A><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD><D6BF>洢<EFBFBD><E6B4A2>FLASH<53><48><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ַ*/
|
||
/*FLASH*/
|
||
//#define GBKCODE_START_ADDRESS 1360*4096
|
||
/* <20><>Դ<EFBFBD><D4B4>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>FLASH<53><48><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>Ŀ¼<C4BF><C2BC>ַ<EFBFBD><D6B7> */
|
||
#define RESOURCE_BASE_ADDR (16*1024*1024)
|
||
/* <20>洢<EFBFBD><E6B4A2>FLASH<53>е<EFBFBD><D0B5><EFBFBD>ԴĿ¼<C4BF><C2BC>С */
|
||
#define CATALOG_SIZE (8*1024)
|
||
|
||
/* <20>ֿ<EFBFBD>Ŀ¼<C4BF><C2BC>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> */
|
||
typedef struct
|
||
{
|
||
char name[40]; /* <20><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||
uint32_t size; /* <20><>Դ<EFBFBD>Ĵ<EFBFBD>С */
|
||
uint32_t offset; /* <20><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>ַ<EFBFBD><D6B7>ƫ<EFBFBD><C6AB> */
|
||
}CatalogTypeDef;
|
||
/*=========================================================================================*/
|
||
|
||
/*<2A><>ȡ<EFBFBD>ֿ<EFBFBD><D6BF>ĺ<EFBFBD><C4BA><EFBFBD>*/
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ucBufferΪ<72><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>usCharΪ<72><CEAA><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룩
|
||
#define GetGBKCode( ucBuffer, usChar ) GetGBKCode_from_EXFlash( ucBuffer, usChar )
|
||
int GetGBKCode_from_EXFlash( uint8_t * pBuffer, uint16_t c);
|
||
int GetResOffset(const char *res_name);
|
||
#else
|
||
/*ʹ<><CAB9>SD<53><44>ģ*/
|
||
|
||
|
||
/*SD<53><44><EFBFBD><EFBFBD>ģ·<C4A3><C2B7>*/
|
||
#define GBKCODE_FILE_NAME "0:/Font/GB2312_H2424.FON"
|
||
|
||
|
||
/*<2A><>ȡ<EFBFBD>ֿ<EFBFBD><D6BF>ĺ<EFBFBD><C4BA><EFBFBD>*/
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ucBufferΪ<72><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>usCharΪ<72><CEAA><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룩
|
||
|
||
#define GetGBKCode( ucBuffer, usChar ) GetGBKCode_from_sd( ucBuffer, usChar )
|
||
int GetGBKCode_from_sd ( uint8_t * pBuffer, uint16_t c);
|
||
|
||
#endif
|
||
/** @defgroup FONTS_Exported_Macros
|
||
* @{
|
||
*/
|
||
/**
|
||
* @}
|
||
*/
|
||
|
||
/** @defgroup FONTS_Exported_Functions
|
||
* @{
|
||
*/
|
||
/**
|
||
* @}
|
||
*/
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif /* __FONTS_H */
|
||
|
||
/**
|
||
* @}
|
||
*/
|
||
|
||
/**
|
||
* @}
|
||
*/
|
||
|
||
/**
|
||
* @}
|
||
*/
|
||
|
||
/**
|
||
* @}
|
||
*/
|
||
|
||
/**
|
||
* @}
|
||
*/
|
||
|
||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|