SPMA082 August 2021 TM4C1230C3PM , TM4C1230D5PM , TM4C1230E6PM , TM4C1230H6PM , TM4C1231C3PM , TM4C1231D5PM , TM4C1231D5PZ , TM4C1231E6PM , TM4C1231E6PZ , TM4C1231H6PGE , TM4C1231H6PM , TM4C1231H6PZ , TM4C1232C3PM , TM4C1232D5PM , TM4C1232E6PM , TM4C1232H6PM , TM4C1233C3PM , TM4C1233D5PM , TM4C1233D5PZ , TM4C1233E6PM , TM4C1233E6PZ , TM4C1233H6PGE , TM4C1233H6PM , TM4C1233H6PZ , TM4C1236D5PM , TM4C1236E6PM , TM4C1236H6PM , TM4C1237D5PM , TM4C1237D5PZ , TM4C1237E6PM , TM4C1237E6PZ , TM4C1237H6PGE , TM4C1237H6PM , TM4C1237H6PZ , TM4C123AE6PM , TM4C123AH6PM , TM4C123BE6PM , TM4C123BE6PZ , TM4C123BH6PGE , TM4C123BH6PM , TM4C123BH6PZ , TM4C123BH6ZRB , TM4C123FE6PM , TM4C123FH6PM , TM4C123GE6PM , TM4C123GE6PZ , TM4C123GH6PGE , TM4C123GH6PM , TM4C123GH6PZ , TM4C123GH6ZRB , TM4C1290NCPDT , TM4C1290NCZAD , TM4C1292NCPDT , TM4C1292NCZAD , TM4C1294KCPDT , TM4C1294NCPDT , TM4C1294NCZAD , TM4C1297NCZAD , TM4C1299KCZAD , TM4C1299NCZAD , TM4C129CNCPDT , TM4C129CNCZAD , TM4C129DNCPDT , TM4C129DNCZAD , TM4C129EKCPDT , TM4C129ENCPDT , TM4C129ENCZAD , TM4C129LNCZAD , TM4C129XKCZAD , TM4C129XNCZAD
#include <stdint.h>
#include <stdbool.h>
#include "driverlib/sysctl.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "grlib/grlib.h"
#include "drivers/kentec320x240x16_ssd2119.h"
#include "drivers/pinout.h"
//*****************************************************************************
// Define the custom fonts
//
//*****************************************************************************
#include "language.h"
extern const unsigned char g_pui8Custom14pt[];
extern const unsigned char g_pui8Custom20pt[];
#define FONT_20PT (const tFont *)g_pui8Custom20pt
#define FONT_14PT (const tFont *)g_pui8Custom14pt
#define GRLIB_INIT_STRUCT g_sGrLibDefaultlanguage
//*****************************************************************************
//
// A simple demonstration to show custom fonts
//
//*****************************************************************************
int
main(void)
{
tContext sContext;
uint32_t ui32SysClock;
char string[10] = {0xe6, 0xac, 0xa2, 0xe8, 0xbf, 0x8e, 0xe6, 0x82, 0xa8, 0x00}; // UTF-8 code for "欢迎您"
//
// Run from the PLL at 120 MHz.
//
ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_240), 120000000);
//
// Configure the device pins.
//
PinoutSet();
//
// Initialize the display driver.
//
Kentec320x240x16_SSD2119Init(ui32SysClock);
//
// Set graphics library text rendering defaults.
//
GrLibInit(&GRLIB_INIT_STRUCT);
//
// Initialize the graphics context.
//
GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119);
//
// Render white background
//
GrContextForegroundSet(&sContext, ClrWhite);
//
// Set font to a new custom 20pt font that supports only below characters:
// "W", "e", "l", "c", "o", "m" and
// "欢", "迎", "您"
//
GrContextFontSet(&sContext, FONT_20PT);
//
// Render the string "Welcome" on the display
//
GrStringDrawCentered(&sContext, "Welcome", -1, 160, 8, false);
//
// Render the string "abcdefghijklmnopqrstuvWxyz" on the display
//
GrStringDrawCentered(&sContext, "abcdefghijklmnopqrstuvWxyz", -1, 160, 32, false);
//
// Render the Chinese string "欢迎您" which means "Welcome" in English
//
GrStringDrawCentered(&sContext, "欢迎您", -1, 160, 56, false);
//
// Render the same Chinese string by using UFT-8 code
//
GrStringDrawCentered(&sContext, string, 8, 160, 80, false);
while(1)
{
}
}