This commit is contained in:
2025-10-18 16:51:59 +08:00
commit 94d1a033df
3200 changed files with 540911 additions and 0 deletions

View File

@@ -0,0 +1,214 @@
/*!
\file lcd_font.h
\brief the header file of LCD font
\version 2025-02-10, V2.4.0, demo for GD32E23x
*/
/*
Copyright (c) 2025, GigaDevice Semiconductor Inc.
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 the copyright holder 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.
*/
#ifndef LCD_FONT_H
#define LCD_FONT_H
#define USE_ONCHIP_FLASH_FONT 1
const unsigned char asc16[] = {
#if USE_ONCHIP_FLASH_FONT
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* " " */
0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, /* "!" */
0x00, 0x00, 0x6C, 0x6C, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, /* """ */
0x00, 0x24, 0x24, 0x24, 0x24, 0xFE, 0x48, 0x48, 0x48, 0x48, 0xFC, 0x90, 0x90, 0x90, 0x90, 0x00, /* "#" */
0x00, 0x10, 0x3C, 0x54, 0x92, 0x90, 0x50, 0x38, 0x14, 0x12, 0x12, 0x92, 0x54, 0x78, 0x10, 0x00, /* "$" */
0x00, 0x00, 0x22, 0x5C, 0x94, 0xA8, 0x48, 0x10, 0x10, 0x24, 0x2A, 0x52, 0x54, 0x88, 0x00, 0x00, /* "%" */
0x00, 0x00, 0x30, 0x48, 0x48, 0x50, 0x20, 0x6E, 0x54, 0x94, 0x8C, 0x88, 0x8A, 0x74, 0x00, 0x00, /* "&" */
0x00, 0x00, 0x30, 0x30, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* "'" */
0x00, 0x04, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x08, 0x04, 0x00, /* "(" */
0x00, 0x80, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x80, 0x00, /* ")" */
0x00, 0x00, 0x00, 0x00, 0x10, 0x54, 0x38, 0x10, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, /* "*" */
0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0xFE, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, /* "+" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, /* "," */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* "-" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, /* "." */
0x00, 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, /* "/" */
0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, /* "0" */
0x00, 0x00, 0x10, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7C, 0x00, 0x00, /* "1" */
0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x04, 0x08, 0x10, 0x20, 0x40, 0x82, 0x84, 0xFC, 0x00, 0x00, /* "2" */
0x00, 0x00, 0x38, 0x44, 0x82, 0x02, 0x04, 0x38, 0x04, 0x02, 0x02, 0x82, 0x44, 0x38, 0x00, 0x00, /* "3" */
0x00, 0x00, 0x04, 0x0C, 0x14, 0x14, 0x24, 0x24, 0x44, 0x44, 0xFE, 0x04, 0x04, 0x0E, 0x00, 0x00, /* "4" */
0x00, 0x00, 0xFC, 0x80, 0x80, 0x80, 0xB8, 0xC4, 0x82, 0x02, 0x02, 0x82, 0x84, 0x78, 0x00, 0x00, /* "5" */
0x00, 0x00, 0x3C, 0x42, 0x82, 0x80, 0xB8, 0xC4, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, /* "6" */
0x00, 0x00, 0x7E, 0x42, 0x82, 0x04, 0x04, 0x08, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, /* "7" */
0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x44, 0x38, 0x44, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, /* "8" */
0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x46, 0x3A, 0x02, 0x82, 0x44, 0x38, 0x00, 0x00, /* "9" */
0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, /* ":" */
0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, /* ";" */
0x00, 0x00, 0x00, 0x00, 0x06, 0x18, 0x60, 0x80, 0x60, 0x18, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, /* "<" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* "=" */
0x00, 0x00, 0x00, 0x00, 0xC0, 0x30, 0x0C, 0x02, 0x0C, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, /* ">" */
0x00, 0x38, 0x44, 0x82, 0x82, 0x02, 0x04, 0x08, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, /* "?" */
0x00, 0x00, 0x38, 0x44, 0x82, 0x9A, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x96, 0x80, 0x42, 0x3C, 0x00, /* "@" */
0x00, 0x00, 0x10, 0x10, 0x10, 0x28, 0x28, 0x28, 0x44, 0x44, 0x7C, 0x44, 0x44, 0xEE, 0x00, 0x00, /* "A" */
0x00, 0x00, 0xFC, 0x42, 0x42, 0x42, 0x42, 0x7C, 0x42, 0x42, 0x42, 0x42, 0x42, 0xFC, 0x00, 0x00, /* "B" */
0x00, 0x00, 0x3C, 0x44, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, /* "C" */
0x00, 0x00, 0xF8, 0x44, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x44, 0xF8, 0x00, 0x00, /* "D" */
0x00, 0x00, 0xFC, 0x44, 0x42, 0x40, 0x44, 0x7C, 0x44, 0x40, 0x40, 0x42, 0x44, 0xFC, 0x00, 0x00, /* "E" */
0x00, 0x00, 0xFC, 0x44, 0x42, 0x40, 0x44, 0x7C, 0x44, 0x40, 0x40, 0x40, 0x40, 0xF0, 0x00, 0x00, /* "F" */
0x00, 0x00, 0x34, 0x4C, 0x82, 0x80, 0x80, 0x80, 0x8E, 0x84, 0x84, 0x84, 0x4C, 0x34, 0x00, 0x00, /* "G" */
0x00, 0x00, 0xEE, 0x44, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x44, 0x44, 0xEE, 0x00, 0x00, /* "H" */
0x00, 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7C, 0x00, 0x00, /* "I" */
0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x88, 0x88, 0x70, 0x00, 0x00, /* "J" */
0x00, 0x00, 0xEE, 0x44, 0x48, 0x48, 0x50, 0x60, 0x50, 0x48, 0x48, 0x44, 0x44, 0xEE, 0x00, 0x00, /* "K" */
0x00, 0x00, 0xE0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x42, 0x44, 0xFC, 0x00, 0x00, /* "L" */
0x00, 0x00, 0xC6, 0x44, 0x6C, 0x6C, 0x6C, 0x54, 0x54, 0x54, 0x44, 0x44, 0x44, 0xEE, 0x00, 0x00, /* "M" */
0x00, 0x00, 0xCE, 0x44, 0x64, 0x64, 0x64, 0x54, 0x54, 0x4C, 0x4C, 0x4C, 0x44, 0xE4, 0x00, 0x00, /* "N" */
0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, /* "O" */
0x00, 0x00, 0xF8, 0x44, 0x42, 0x42, 0x42, 0x44, 0x78, 0x40, 0x40, 0x40, 0x40, 0xE0, 0x00, 0x00, /* "P" */
0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xBA, 0x44, 0x3C, 0x02, 0x00, /* "Q" */
0x00, 0x00, 0xF0, 0x48, 0x44, 0x44, 0x44, 0x48, 0x70, 0x48, 0x44, 0x44, 0x44, 0xE6, 0x00, 0x00, /* "R" */
0x00, 0x00, 0x3C, 0x44, 0x82, 0x80, 0x40, 0x30, 0x0C, 0x02, 0x02, 0x82, 0x44, 0x78, 0x00, 0x00, /* "S" */
0x00, 0x00, 0x7C, 0x54, 0x92, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, /* "T" */
0x00, 0x00, 0xEE, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, /* "U" */
0x00, 0x00, 0xEE, 0x44, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x00, 0x00, /* "V" */
0x00, 0x00, 0xEE, 0x44, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, /* "W" */
0x00, 0x00, 0xEE, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x28, 0x28, 0x44, 0x44, 0xEE, 0x00, 0x00, /* "X" */
0x00, 0x00, 0xEE, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, /* "Y" */
0x00, 0x00, 0x7E, 0x44, 0x84, 0x08, 0x08, 0x10, 0x20, 0x20, 0x40, 0x82, 0x84, 0xFC, 0x00, 0x00, /* "Z" */
0x00, 0x1C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1C, 0x00, /* "[" */
0x00, 0x00, 0xEE, 0x44, 0x54, 0x54, 0xFE, 0x54, 0x54, 0x54, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, /* "\" */
0x00, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00, /* "]" */
0x00, 0x30, 0x48, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* "^" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, /* "_" */
0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* "`" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x84, 0x04, 0x7C, 0x84, 0x84, 0x8C, 0x76, 0x00, 0x00, /* "a" */
0x00, 0x00, 0xC0, 0x40, 0x40, 0x40, 0x58, 0x64, 0x42, 0x42, 0x42, 0x42, 0x64, 0x58, 0x00, 0x00, /* "b" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x80, 0x80, 0x80, 0x80, 0x44, 0x38, 0x00, 0x00, /* "c" */
0x00, 0x00, 0x0C, 0x04, 0x04, 0x04, 0x34, 0x4C, 0x84, 0x84, 0x84, 0x84, 0x4C, 0x36, 0x00, 0x00, /* "d" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x84, 0x84, 0xFC, 0x80, 0x80, 0x84, 0x78, 0x00, 0x00, /* "e" */
0x00, 0x00, 0x18, 0x24, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, /* "f" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x44, 0x44, 0x78, 0x80, 0x7C, 0x82, 0x82, 0x7C, 0x00, /* "g" */
0x00, 0x00, 0xC0, 0x40, 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0x44, 0x44, 0xEE, 0x00, 0x00, /* "h" */
0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, /* "i" */
0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x90, 0x60, 0x00, /* "j" */
0x00, 0x00, 0xC0, 0x40, 0x40, 0x40, 0x5C, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0xEE, 0x00, 0x00, /* "k" */
0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x11, 0x10, 0x10, 0x10, 0x10, 0x10, 0x39, 0x00, 0x00, /* "l" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAC, 0xD2, 0x92, 0x92, 0x92, 0x92, 0x92, 0xD6, 0x00, 0x00, /* "m" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0xE4, 0x44, 0x44, 0x44, 0x44, 0x44, 0xEE, 0x00, 0x00, /* "n" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, /* "o" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x64, 0x42, 0x42, 0x42, 0x64, 0x58, 0x40, 0xE0, 0x00, /* "p" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x4C, 0x84, 0x84, 0x84, 0x4C, 0x34, 0x04, 0x0E, 0x00, /* "q" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x30, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, /* "r" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x88, 0x84, 0x60, 0x18, 0x84, 0x44, 0x78, 0x00, 0x00, /* "s" */
0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x24, 0x18, 0x00, 0x00, /* "t" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00, /* "u" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEE, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, /* "v" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEE, 0x44, 0x44, 0x54, 0x54, 0x28, 0x28, 0x28, 0x00, 0x00, /* "w" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEE, 0x44, 0x28, 0x10, 0x10, 0x28, 0x44, 0xEE, 0x00, 0x00, /* "x" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEE, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0xA0, 0xC0, 0x00, /* "y" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x44, 0x88, 0x10, 0x20, 0x42, 0x84, 0xFC, 0x00, 0x00, /* "z" */
0x00, 0x0C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0C, 0x00, /* "{" */
0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, /* "|" */
0x00, 0xC0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x18, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xC0, 0x00, /* "}" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* "~" */
#endif
0x00,
};
/* Digital tube font */
const unsigned char sz32[] = {
#if USE_ONCHIP_FLASH_FONT
/* "0" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x01, 0x80, 0x06, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x01, 0x80, 0x06, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x1F, 0xE0, 0x00,
/* "1" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
/* "2" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x01, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x1F, 0xE3, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x1F, 0xF0, 0x00, 0x00, 0x3F, 0xF8, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x1F, 0xFE, 0x00,
/* "3" */
0x00, 0x00, 0x00, 0x00, 0x03, 0xFF, 0x80, 0x00, 0x01, 0xFF, 0xC0, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x7F, 0x8C, 0x00, 0x01, 0xFF, 0xE0, 0x00, 0x01, 0xFF, 0xF0, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x01, 0xFF, 0xC0, 0x00, 0x03, 0xFF, 0x80, 0x00,
/* "4" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x80, 0x07, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0x1F, 0xE3, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0x7F, 0xFC, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
/* "5" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFC, 0x00, 0x00, 0x3F, 0xF8, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x01, 0x80, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0x1F, 0xE0, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x3F, 0xE0, 0x00, 0x00, 0x7F, 0xF0, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x01, 0xFF, 0xE0, 0x00,
/* "6" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFC, 0x00, 0x00, 0x3F, 0xF8, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x01, 0x80, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0x1F, 0xE0, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0x7F, 0xFC, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x01, 0x80, 0x06, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x1F, 0xE0, 0x00,
/* "7" */
0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xE0, 0x00, 0x03, 0xFF, 0xC0, 0x00, 0x01, 0xFF, 0x88, 0x00, 0x00, 0xFF, 0x18, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
/* "8" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x01, 0x80, 0x06, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0x1F, 0xE3, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0x7F, 0xFC, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x01, 0x80, 0x06, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x1F, 0xE0, 0x00,
/* "9" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x01, 0x80, 0x06, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0xC0, 0x0F, 0x00, 0x03, 0x1F, 0xE3, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0x7F, 0xFC, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x7F, 0xF0, 0x00, 0x00, 0xFF, 0xE0, 0x00,
/* "." */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* ":" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* "%" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC0, 0x06, 0x00, 0x0F, 0xE0, 0x06, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x30, 0x18, 0x18, 0x00, 0x30, 0x18, 0x18, 0x00, 0x30, 0x18, 0x30, 0x00, 0x30, 0x18, 0x30, 0x00, 0x30, 0x18, 0x60, 0x00, 0x30, 0x08, 0xC0, 0x00, 0x07, 0xC0, 0xC0, 0x00, 0x0F, 0xE0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xE0, 0x00, 0x06, 0x07, 0xC0, 0x00, 0x06, 0x30, 0x18, 0x00, 0x0C, 0x30, 0x18, 0x00, 0x0C, 0x30, 0x18, 0x00, 0x18, 0x30, 0x18, 0x00, 0x30, 0x30, 0x18, 0x00, 0x30, 0x30, 0x18, 0x00, 0x60, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0xE0, 0x00, 0xC0, 0x07, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* "℃" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0xE0, 0x00, 0x08, 0x87, 0xFC, 0x00, 0x08, 0x8E, 0x03, 0x00, 0x08, 0x98, 0x01, 0x80, 0x07, 0x18, 0x00, 0x80, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x18, 0x01, 0x00, 0x00, 0x0C, 0x03, 0x00, 0x00, 0x07, 0xFC, 0x00, 0x00, 0x01, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* "-" */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x7F, 0xF0, 0x00, 0x00, 0x7F, 0xE0, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
#endif
0x00,
};
struct typFNT_GB162 {
unsigned char Index[3];
char Msk[32];
};
#define hz16_num 100
const struct typFNT_GB162 hz16[] = {
#if USE_ONCHIP_FLASH_FONT
"", 0x00, 0x00, 0x1F, 0xF0, 0x10, 0x10, 0x10, 0x10, 0x1F, 0xF0, 0x10, 0x10, 0x10, 0x10, 0x1F, 0xF0, 0x04, 0x40, 0x44, 0x44, 0x24, 0x44, 0x14, 0x48, 0x14, 0x50, 0x04, 0x40, 0xFF, 0xFE, 0x00, 0x00,
"", 0x00, 0x00, 0x3F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x01, 0x00, 0x01, 0x00, 0x11, 0x10, 0x11, 0x08, 0x21, 0x04, 0x41, 0x02, 0x81, 0x02, 0x05, 0x00, 0x02, 0x00,
"", 0x00, 0x04, 0x27, 0xC4, 0x14, 0x44, 0x14, 0x54, 0x85, 0x54, 0x45, 0x54, 0x45, 0x54, 0x15, 0x54, 0x15, 0x54, 0x25, 0x54, 0xE5, 0x54, 0x21, 0x04, 0x22, 0x84, 0x22, 0x44, 0x24, 0x14, 0x08, 0x08,
"", 0x00, 0x28, 0x20, 0x24, 0x10, 0x24, 0x10, 0x20, 0x07, 0xFE, 0x00, 0x20, 0xF0, 0x20, 0x17, 0xE0, 0x11, 0x20, 0x11, 0x10, 0x11, 0x10, 0x15, 0x10, 0x19, 0xCA, 0x17, 0x0A, 0x02, 0x06, 0x00, 0x02,
#endif
0x00,
};
struct typFNT_GB242 {
unsigned char Index[3];
char Msk[72];
};
#define hz24_num 100
/* Song typeface Bold Small 2 font */
const struct typFNT_GB242 hz24[] = {
#if USE_ONCHIP_FLASH_FONT
"", 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0x00, 0x0F, 0x03, 0xC0, 0x0C, 0x00, 0x40, 0x1F, 0xF8, 0x60, 0x18, 0x00, 0x60, 0x08, 0x00, 0x40, 0x0E, 0x01, 0xC0, 0x07, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x01, 0x84, 0x00, 0x01, 0x84, 0x00, 0x19, 0x87, 0x80, 0x0F, 0x8C, 0xE0, 0x07, 0x8C, 0x20, 0x00, 0xCC, 0x00, 0x03, 0xFF, 0xE0, 0x1F, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
"", 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x1F, 0xFF, 0xC0, 0x00, 0x7F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xC0, 0x3F, 0xFF, 0xE0, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x06, 0x13, 0x00, 0x0C, 0x13, 0xC0, 0x0C, 0x18, 0xF0, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
"", 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x39, 0xFC, 0x30, 0x1F, 0xCC, 0x30, 0x07, 0x06, 0xB0, 0x0F, 0x06, 0xF0, 0x19, 0x07, 0xB0, 0x31, 0x37, 0xB0, 0x31, 0x36, 0xF0, 0x1F, 0x27, 0xF0, 0x01, 0x67, 0xF0, 0x01, 0xE5, 0xF0, 0x01, 0xE1, 0xF0, 0x00, 0x41, 0xF0, 0x0C, 0xF8, 0xB0, 0x3C, 0xD8, 0x30, 0x00, 0x8C, 0x30, 0x00, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
"", 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x60, 0x0C, 0x03, 0x70, 0x0C, 0x03, 0x30, 0x00, 0x3F, 0xE0, 0x00, 0x3F, 0x80, 0x08, 0x01, 0x00, 0x3C, 0x01, 0x80, 0x04, 0x7F, 0x80, 0x04, 0x7D, 0x80, 0x0C, 0x00, 0x80, 0x0C, 0x10, 0xC0, 0x0C, 0x10, 0xC0, 0x0C, 0x18, 0x40, 0x0C, 0x1C, 0x60, 0x0F, 0x7E, 0x60, 0x06, 0x70, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
#endif
0x00,
};
#endif /* LCD_FONT_H */

View File

@@ -0,0 +1,122 @@
/*!
\file lcd_log.c
\brief LCD log driver
\version 2025-02-10, V2.4.0, demo for GD32E23x
*/
/*
Copyright (c) 2025, GigaDevice Semiconductor Inc.
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 the copyright holder 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.
*/
#include "lcd_log.h"
/*!
\brief initialize the LCD log module
\param[in] none
\param[out] none
\retval none
*/
void lcd_log_init(void)
{
lcd_clear(BLACK);
}
/*!
\brief de-initialize the LCD log module
\param[in] none
\param[out] none
\retval none
*/
void lcd_log_deinit(void)
{
}
/*!
\brief display the application header (title) on the LCD screen
\param[in] p_title: pointer to the string to be displayed
\param[in] start_x: the start x position
\param[out] none
\retval none
*/
void lcd_log_header_set(uint8_t *pTitle, uint16_t StartX)
{
lcd_rect_color_draw(0, 0, 240, 40, BLUE);
lcd_draw_font_gbk16(StartX, 10, RED, BLUE, (char *)pTitle);
}
/*!
\brief display the application footer (status) on the LCD screen
\param[in] p_status: pointer to the string to be displayed
\param[in] start_x: the start x position
\param[out] none
\retval none
*/
void lcd_log_footer_set(uint8_t *pStatus, uint16_t StartX)
{
lcd_rect_color_draw(0, 280, 240, 320, BLUE);
lcd_draw_font_gbk16(StartX, 290, RED, BLUE, (char *)pStatus);
}
/**
* @brief Clear the Text Zone
* @param None
* @retval None
*/
void lcd_log_text_zone_clear(uint16_t StartX,
uint16_t StartY,
uint16_t EndX,
uint16_t EndY)
{
lcd_rect_color_draw(StartX, StartY, EndX, EndY, BLACK);
}
/**
* @brief Redirect the printf to the lcd
* @param pStr: pointer to string to be displayed
* @param Len: string length
* @retval None
*/
void lcd_log_print(uint8_t *pStr,
uint16_t *pLine,
uint16_t CharColor,
uint16_t BackColor)
{
if(*pLine >= 280) {
*pLine = 40;
lcd_rect_color_draw(0, 40, 240, 280, BLACK);
}
lcd_draw_font_gbk16(2, *pLine, CharColor, BackColor, (char *)pStr);
*pLine += 20;
}

View File

@@ -0,0 +1,54 @@
/*!
\file lcd_log.h
\brief the header file of LCD log
\version 2025-02-10, V2.4.0, demo for GD32E23x
*/
/*
Copyright (c) 2025, GigaDevice Semiconductor Inc.
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 the copyright holder 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.
*/
#ifndef LCD_LOG_H
#define LCD_LOG_H
#include "gd32e230c_lcd_eval.h"
/* initialize the LCD log module */
void lcd_log_init(void);
/* de-initialize the LCD log module */
void lcd_log_deinit(void);
/* display the application header (title) on the LCD screen */
void lcd_log_header_set(uint8_t *p_title, uint16_t start_x);
/* display the application footer (status) on the LCD screen */
void lcd_log_footer_set(uint8_t *p_status, uint16_t start_x);
/* redirect the printf to the lcd */
void lcd_log_print(uint8_t *pStr, uint16_t *pLine, uint16_t CharColor, uint16_t BackColor);
/* clear the text zone */
void lcd_log_text_zone_clear(uint16_t StartX, uint16_t StartY, uint16_t EndX, uint16_t EndY);
#endif /* LCD_LOG_H */

243
Utilities/gd32e230c_eval.c Normal file
View File

@@ -0,0 +1,243 @@
/*!
\file gd32e230c_eval.c
\brief firmware functions to manage leds, keys, COM ports
\version 2025-02-10, V2.4.0, demo for GD32E23x
*/
/*
Copyright (c) 2025, GigaDevice Semiconductor Inc.
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 the copyright holder 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.
*/
#include "gd32e230c_eval.h"
/* private variables */
static const uint32_t GPIO_PORT[LEDn] = {LED1_GPIO_PORT,
LED2_GPIO_PORT,
LED3_GPIO_PORT,
LED4_GPIO_PORT
};
static const uint32_t GPIO_PIN[LEDn] = {LED1_PIN,
LED2_PIN,
LED3_PIN,
LED4_PIN
};
static const rcu_periph_enum COM_CLK[COMn] = {EVAL_COM_CLK};
static const uint32_t COM_TX_PIN[COMn] = {EVAL_COM_TX_PIN};
static const uint32_t COM_RX_PIN[COMn] = {EVAL_COM_RX_PIN};
static const rcu_periph_enum GPIO_CLK[LEDn] = {LED1_GPIO_CLK,
LED2_GPIO_CLK,
LED3_GPIO_CLK,
LED4_GPIO_CLK
};
static const uint32_t KEY_PORT[KEYn] = {WAKEUP_KEY_GPIO_PORT,
TAMPER_KEY_GPIO_PORT
};
static const uint32_t KEY_PIN[KEYn] = {WAKEUP_KEY_PIN,
TAMPER_KEY_PIN
};
static const rcu_periph_enum KEY_CLK[KEYn] = {WAKEUP_KEY_GPIO_CLK,
TAMPER_KEY_GPIO_CLK
};
static const exti_line_enum KEY_EXTI_LINE[KEYn] = {WAKEUP_KEY_EXTI_LINE,
TAMPER_KEY_EXTI_LINE
};
static const uint8_t KEY_PORT_SOURCE[KEYn] = {WAKEUP_KEY_EXTI_PORT_SOURCE,
TAMPER_KEY_EXTI_PORT_SOURCE
};
static const uint8_t KEY_PIN_SOURCE[KEYn] = {WAKEUP_KEY_EXTI_PIN_SOURCE,
TAMPER_KEY_EXTI_PIN_SOURCE
};
static const IRQn_Type KEY_IRQn[KEYn] = {WAKEUP_KEY_EXTI_IRQn,
TAMPER_KEY_EXTI_IRQn
};
/* eval board low layer private functions */
/*!
\brief configure led GPIO
\param[in] lednum: specify the led to be configured
\arg LED1
\arg LED2
\arg LED3
\arg LED4
\param[out] none
\retval none
*/
void gd_eval_led_init(led_typedef_enum lednum)
{
/* enable the led clock */
rcu_periph_clock_enable(GPIO_CLK[lednum]);
/* configure led GPIO port */
gpio_mode_set(GPIO_PORT[lednum], GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN[lednum]);
gpio_output_options_set(GPIO_PORT[lednum], GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN[lednum]);
GPIO_BC(GPIO_PORT[lednum]) = GPIO_PIN[lednum];
}
/*!
\brief turn on selected led
\param[in] lednum: specify the led to be turned on
\arg LED1
\arg LED2
\arg LED3
\arg LED4
\param[out] none
\retval none
*/
void gd_eval_led_on(led_typedef_enum lednum)
{
GPIO_BOP(GPIO_PORT[lednum]) = GPIO_PIN[lednum];
}
/*!
\brief turn off selected led
\param[in] lednum: specify the led to be turned off
\arg LED1
\arg LED2
\arg LED3
\arg LED4
\param[out] none
\retval none
*/
void gd_eval_led_off(led_typedef_enum lednum)
{
GPIO_BC(GPIO_PORT[lednum]) = GPIO_PIN[lednum];
}
/*!
\brief toggle selected led
\param[in] lednum: specify the led to be toggled
\arg LED1
\arg LED2
\arg LED3
\arg LED4
\param[out] none
\retval none
*/
void gd_eval_led_toggle(led_typedef_enum lednum)
{
GPIO_TG(GPIO_PORT[lednum]) = GPIO_PIN[lednum];
}
/*!
\brief configure key
\param[in] keynum: specify the key to be configured
\arg KEY_TAMPER: tamper key
\arg KEY_WAKEUP: wakeup key
\param[in] keymode: specify button mode
\arg KEY_MODE_GPIO: key will be used as simple IO
\arg KEY_MODE_EXTI: key will be connected to EXTI line with interrupt
\param[out] none
\retval none
*/
void gd_eval_key_init(key_typedef_enum keynum, keymode_typedef_enum keymode)
{
/* enable the key clock */
rcu_periph_clock_enable(KEY_CLK[keynum]);
rcu_periph_clock_enable(RCU_CFGCMP);
/* configure button pin as input */
gpio_mode_set(KEY_PORT[keynum], GPIO_MODE_INPUT, GPIO_PUPD_NONE, KEY_PIN[keynum]);
if(keymode == KEY_MODE_EXTI) {
/* enable and set key EXTI interrupt to the lowest priority */
nvic_irq_enable(KEY_IRQn[keynum], 2U);
/* connect key EXTI line to key GPIO pin */
syscfg_exti_line_config(KEY_PORT_SOURCE[keynum], KEY_PIN_SOURCE[keynum]);
/* configure key EXTI line */
exti_init(KEY_EXTI_LINE[keynum], EXTI_INTERRUPT, EXTI_TRIG_FALLING);
exti_interrupt_flag_clear(KEY_EXTI_LINE[keynum]);
}
}
/*!
\brief return the selected key state
\param[in] keynum: specify the key to be checked
\arg KEY_TAMPER: tamper key
\arg KEY_WAKEUP: wakeup key
\param[out] none
\retval the key's GPIO pin value
*/
uint8_t gd_eval_key_state_get(key_typedef_enum keynum)
{
return gpio_input_bit_get(KEY_PORT[keynum], KEY_PIN[keynum]);
}
/*!
\brief configure COM port
\param[in] com: COM on the board
\arg EVAL_COM: COM on the board
\param[out] none
\retval none
*/
void gd_eval_com_init(uint32_t com)
{
uint32_t COM_ID;
COM_ID = 0U;
/* enable COM GPIO clock */
rcu_periph_clock_enable(EVAL_COM_GPIO_CLK);
/* enable USART clock */
rcu_periph_clock_enable(COM_CLK[COM_ID]);
/* connect port to USARTx_Tx */
gpio_af_set(EVAL_COM_GPIO_PORT, EVAL_COM_AF, COM_TX_PIN[COM_ID]);
/* connect port to USARTx_Rx */
gpio_af_set(EVAL_COM_GPIO_PORT, EVAL_COM_AF, COM_RX_PIN[COM_ID]);
/* configure USART Tx as alternate function push-pull */
gpio_mode_set(EVAL_COM_GPIO_PORT, GPIO_MODE_AF, GPIO_PUPD_PULLUP, COM_TX_PIN[COM_ID]);
gpio_output_options_set(EVAL_COM_GPIO_PORT, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, COM_TX_PIN[COM_ID]);
/* configure USART Rx as alternate function push-pull */
gpio_mode_set(EVAL_COM_GPIO_PORT, GPIO_MODE_AF, GPIO_PUPD_PULLUP, COM_RX_PIN[COM_ID]);
gpio_output_options_set(EVAL_COM_GPIO_PORT, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, COM_RX_PIN[COM_ID]);
/* USART configure */
usart_deinit(com);
usart_baudrate_set(com, 115200U);
usart_receive_config(com, USART_RECEIVE_ENABLE);
usart_transmit_config(com, USART_TRANSMIT_ENABLE);
usart_enable(com);
}

138
Utilities/gd32e230c_eval.h Normal file
View File

@@ -0,0 +1,138 @@
/*!
\file gd32e230c_eval.h
\brief definitions for GD32E230C_EVAL's leds, keys and COM ports hardware resources
\version 2025-02-10, V2.4.0, demo for GD32E23x
*/
/*
Copyright (c) 2025, GigaDevice Semiconductor Inc.
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 the copyright holder 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.
*/
#ifndef GD32E230C_EVAL_H
#define GD32E230C_EVAL_H
#ifdef __cplusplus
extern "C" {
#endif
#include "gd32e23x.h"
/* exported types */
typedef enum {
LED1 = 0,
LED2 = 1,
LED3 = 2,
LED4 = 3
} led_typedef_enum;
typedef enum {
KEY_WAKEUP = 0,
KEY_TAMPER = 1
} key_typedef_enum;
typedef enum {
KEY_MODE_GPIO = 0,
KEY_MODE_EXTI = 1
} keymode_typedef_enum;
/* eval board low layer led */
#define LEDn 4U
#define LED1_PIN GPIO_PIN_1
#define LED1_GPIO_PORT GPIOB
#define LED1_GPIO_CLK RCU_GPIOB
#define LED2_PIN GPIO_PIN_0
#define LED2_GPIO_PORT GPIOB
#define LED2_GPIO_CLK RCU_GPIOB
#define LED3_PIN GPIO_PIN_7
#define LED3_GPIO_PORT GPIOA
#define LED3_GPIO_CLK RCU_GPIOA
#define LED4_PIN GPIO_PIN_6
#define LED4_GPIO_PORT GPIOA
#define LED4_GPIO_CLK RCU_GPIOA
/* eval board low layer button */
#define KEYn 2U
/* wakeup push-button */
#define WAKEUP_KEY_PIN GPIO_PIN_0
#define WAKEUP_KEY_GPIO_PORT GPIOA
#define WAKEUP_KEY_GPIO_CLK RCU_GPIOA
#define WAKEUP_KEY_EXTI_LINE EXTI_0
#define WAKEUP_KEY_EXTI_PORT_SOURCE EXTI_SOURCE_GPIOA
#define WAKEUP_KEY_EXTI_PIN_SOURCE EXTI_SOURCE_PIN0
#define WAKEUP_KEY_EXTI_IRQn EXTI0_1_IRQn
/* tamper push-button */
#define TAMPER_KEY_PIN GPIO_PIN_13
#define TAMPER_KEY_GPIO_PORT GPIOC
#define TAMPER_KEY_GPIO_CLK RCU_GPIOC
#define TAMPER_KEY_EXTI_LINE EXTI_13
#define TAMPER_KEY_EXTI_PORT_SOURCE EXTI_SOURCE_GPIOC
#define TAMPER_KEY_EXTI_PIN_SOURCE EXTI_SOURCE_PIN13
#define TAMPER_KEY_EXTI_IRQn EXTI4_15_IRQn
/* eval board low layer COM */
#define COMn 1U
/* definition for COM, connected to USART0 */
#define EVAL_COM USART0
#define EVAL_COM_CLK RCU_USART0
#define EVAL_COM_TX_PIN GPIO_PIN_9
#define EVAL_COM_RX_PIN GPIO_PIN_10
#define EVAL_COM_GPIO_PORT GPIOA
#define EVAL_COM_GPIO_CLK RCU_GPIOA
#define EVAL_COM_AF GPIO_AF_1
/* function declarations */
/* configure led GPIO */
void gd_eval_led_init(led_typedef_enum lednum);
/* turn on selected led */
void gd_eval_led_on(led_typedef_enum lednum);
/* turn off selected led */
void gd_eval_led_off(led_typedef_enum lednum);
/* toggle the selected led */
void gd_eval_led_toggle(led_typedef_enum lednum);
/* configure key */
void gd_eval_key_init(key_typedef_enum keynum, keymode_typedef_enum keymode);
/* return the selected key state */
uint8_t gd_eval_key_state_get(key_typedef_enum keynum);
/* configure COM port */
void gd_eval_com_init(uint32_t com);
#ifdef __cplusplus
}
#endif
#endif /* GD32E230C_EVAL_H */

View File

@@ -0,0 +1,925 @@
/*!
\file gd32e230_lcd_eval.c
\brief LCD driver functions (LCD_ILI9320)
\version 2025-02-10, V2.4.0, demo for GD32E23x
*/
/*
Copyright (c) 2025, GigaDevice Semiconductor Inc.
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 the copyright holder 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.
*/
#include "lcd_font.h"
#include "gd32e230c_lcd_eval.h"
#include "systick.h"
#ifdef H_VIEW
#define X_MAX_PIXEL 320
#define Y_MAX_PIXEL 240
#else
#define X_MAX_PIXEL 240
#define Y_MAX_PIXEL 320
#endif
static uint8_t spi_write_byte(uint32_t spi_periph, uint8_t byte);
static void spi1_init(void);
static void lcd_write_index(uint8_t index);
static void lcd_write_data(uint8_t data);
static void lcd_write_data_16bit(uint8_t datah, uint8_t datal);
static void lcd_reset(void);
/*!
\brief write an unsigned 8-bit bytes
\param[in] spi_periph: SPIx(x=0,1,2)
\param[in] byte: write byte
\param[out] none
\retval none
*/
static uint8_t spi_write_byte(uint32_t spi_periph, uint8_t byte)
{
SPI_CTL1(spi_periph) |= SPI_CTL1_BYTEN;
while(RESET == (SPI_STAT(spi_periph)&SPI_FLAG_TBE));
SPI_DATA(spi_periph) = byte;
while(RESET == (SPI_STAT(spi_periph)&SPI_FLAG_RBNE));
return(SPI_DATA(spi_periph));
}
/*!
\brief init SPI1
\param[in] none
\param[out] none
\retval none
*/
static void spi1_init(void)
{
spi_parameter_struct spi_init_struct;
/* enable the gpio clock */
rcu_periph_clock_enable(RCU_GPIOB);
rcu_periph_clock_enable(RCU_SPI1);
/* GPIOB config, PB13(SPI1_SCK), PB14(SPI1_MISO), PB15(LCD_SPI1_MOSI) */
gpio_af_set(GPIOB, GPIO_AF_0, GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
gpio_mode_set(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
/* GPIOB config */
gpio_mode_set(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2);
gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2);
/* SPI1 parameter config */
spi_init_struct.trans_mode = SPI_TRANSMODE_FULLDUPLEX;
spi_init_struct.device_mode = SPI_MASTER;
spi_init_struct.frame_size = SPI_FRAMESIZE_8BIT;
spi_init_struct.clock_polarity_phase = SPI_CK_PL_HIGH_PH_2EDGE;
spi_init_struct.nss = SPI_NSS_SOFT;
spi_init_struct.prescale = SPI_PSC_2;
spi_init_struct.endian = SPI_ENDIAN_MSB;
spi_init(SPI1, &spi_init_struct);
/* set crc polynomial */
spi_enable(SPI1);
}
/*!
\brief write the register address
\param[in] index: register address
\param[out] none
\retval none
*/
static void lcd_write_index(uint8_t index)
{
LCD_RS_CLR;
spi_write_byte(SPI1, index);
}
/*!
\brief write the register data
\param[in] data: register data
\param[out] none
\retval none
*/
static void lcd_write_data(uint8_t data)
{
LCD_RS_SET;
spi_write_byte(SPI1, data);
}
/*!
\brief write the register data(an unsigned 16-bit data)
\param[in] datah: register data high 8bit
\param[in] datal: register data low 8bit
\param[out] none
\retval none
*/
static void lcd_write_data_16bit(uint8_t datah, uint8_t datal)
{
lcd_write_data(datah);
lcd_write_data(datal);
}
/*!
\brief lcd reset
\param[in] none
\param[out] none
\retval none
*/
static void lcd_reset(void)
{
LCD_RST_CLR;
delay_ms(100);
LCD_RST_SET;
delay_ms(50);
}
/*!
\brief lcd init
\param[in] none
\param[out] none
\retval none
*/
void lcd_init(void)
{
spi1_init();
LCD_CS_CLR;
lcd_reset();
/* write the register address 0xCB*/
lcd_write_index(0xCB);
lcd_write_data(0x39);
lcd_write_data(0x2C);
lcd_write_data(0x00);
lcd_write_data(0x34);
lcd_write_data(0x02);
/* write the register address 0xCF*/
lcd_write_index(0xCF);
lcd_write_data(0x00);
lcd_write_data(0XC1);
lcd_write_data(0X30);
/* write the register address 0xE8*/
lcd_write_index(0xE8);
lcd_write_data(0x85);
lcd_write_data(0x00);
lcd_write_data(0x78);
/* write the register address 0xEA*/
lcd_write_index(0xEA);
lcd_write_data(0x00);
lcd_write_data(0x00);
/* write the register address 0xED*/
lcd_write_index(0xED);
lcd_write_data(0x64);
lcd_write_data(0x03);
lcd_write_data(0X12);
lcd_write_data(0X81);
/* write the register address 0xF7*/
lcd_write_index(0xF7);
lcd_write_data(0x20);
/* power control VRH[5:0] */
lcd_write_index(0xC0);
lcd_write_data(0x23);
/* power control SAP[2:0];BT[3:0] */
lcd_write_index(0xC1);
lcd_write_data(0x10);
/* vcm control */
lcd_write_index(0xC5);
lcd_write_data(0x3e);
lcd_write_data(0x28);
/* vcm control2 */
lcd_write_index(0xC7);
lcd_write_data(0x86);
lcd_write_index(0x36);
#ifdef H_VIEW
lcd_write_data(0xE8);
#else
lcd_write_data(0x48);
#endif
/* write the register address 0x3A*/
lcd_write_index(0x3A);
lcd_write_data(0x55);
/* write the register address 0xB1*/
lcd_write_index(0xB1);
lcd_write_data(0x00);
lcd_write_data(0x18);
/* display function control */
lcd_write_index(0xB6);
lcd_write_data(0x08);
lcd_write_data(0x82);
lcd_write_data(0x27);
/* 3gamma function disable */
lcd_write_index(0xF2);
lcd_write_data(0x00);
/* gamma curve selected */
lcd_write_index(0x26);
lcd_write_data(0x01);
/* set gamma */
lcd_write_index(0xE0);
lcd_write_data(0x0F);
lcd_write_data(0x31);
lcd_write_data(0x2B);
lcd_write_data(0x0C);
lcd_write_data(0x0E);
lcd_write_data(0x08);
lcd_write_data(0x4E);
lcd_write_data(0xF1);
lcd_write_data(0x37);
lcd_write_data(0x07);
lcd_write_data(0x10);
lcd_write_data(0x03);
lcd_write_data(0x0E);
lcd_write_data(0x09);
lcd_write_data(0x00);
/* set gamma */
lcd_write_index(0XE1);
lcd_write_data(0x00);
lcd_write_data(0x0E);
lcd_write_data(0x14);
lcd_write_data(0x03);
lcd_write_data(0x11);
lcd_write_data(0x07);
lcd_write_data(0x31);
lcd_write_data(0xC1);
lcd_write_data(0x48);
lcd_write_data(0x08);
lcd_write_data(0x0F);
lcd_write_data(0x0C);
lcd_write_data(0x31);
lcd_write_data(0x36);
lcd_write_data(0x0F);
/* exit sleep */
lcd_write_index(0x11);
delay_ms(120);
/* display on */
lcd_write_index(0x29);
lcd_write_index(0x2c);
LCD_CS_SET;
}
/*!
\brief set lcd display region
\param[in] x_start: the x position of the start point
\param[in] y_start: the y position of the start point
\param[in] x_end: the x position of the end point
\param[in] y_end: the y position of the end point
\param[out] none
\retval none
*/
void lcd_set_region(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end)
{
LCD_CS_CLR;
/* write the register address 0x2A*/
lcd_write_index(0x2A);
lcd_write_data_16bit(x_start >> 8, x_start);
lcd_write_data_16bit(x_end >> 8, x_end);
/* write the register address 0x2B*/
lcd_write_index(0x2B);
lcd_write_data_16bit(y_start >> 8, y_start);
lcd_write_data_16bit(y_end >> 8, y_end);
/* write the register address 0x2C*/
lcd_write_index(0x2C);
LCD_CS_SET;
}
/*!
\brief set the start display point of lcd
\param[in] x: the x position of the start point
\param[in] y: the y position of the start point
\param[out] none
\retval none
*/
void lcd_set_xy(uint16_t x, uint16_t y)
{
/* write the register address 0x2A*/
lcd_write_index(0x2A);
lcd_write_data_16bit(x >> 8, x);
/* write the register address 0x2B*/
lcd_write_index(0x2B);
lcd_write_data_16bit(y >> 8, y);
/* write the register address 0x2C*/
lcd_write_index(0x2C);
}
/*!
\brief draw a point on the lcd
\param[in] x: the x position of the point
\param[in] y: the y position of the point
\param[in] data: write the register data
\param[out] none
\retval none
*/
void lcd_draw_point(uint16_t x, uint16_t y, uint16_t data)
{
lcd_set_xy(x, y);
lcd_write_data(data >> 8);
lcd_write_data(data);
}
/*!
\brief clear the lcd
\param[in] color: lcd display color
\param[out] none
\retval none
*/
void lcd_clear(uint16_t color)
{
unsigned int i, m;
/* set lcd display region */
lcd_set_region(0, 0, X_MAX_PIXEL - 1, Y_MAX_PIXEL - 1);
LCD_RS_SET;
LCD_CS_CLR;
for(i = 0; i < Y_MAX_PIXEL; i ++) {
for(m = 0; m < X_MAX_PIXEL; m ++) {
spi_write_byte(SPI1, color >> 8);
spi_write_byte(SPI1, color);
}
}
LCD_CS_SET;
}
/*!
\brief bgr to rgb format conversion
\param[in] c: bgr color value
\param[out] none
\retval rgb color value
*/
uint16_t lcd_bgr2rgb(uint16_t c)
{
uint16_t r, g, b, rgb;
b = (c >> 0) & 0x1f;
g = (c >> 5) & 0x3f;
r = (c >> 11) & 0x1f;
rgb = (b << 11) + (g << 5) + (r << 0);
return(rgb);
}
/*!
\brief gui circle
\param[in] x: the x position of the start point
\param[in] y: the y position of the start point
\param[in] r: the radius of circle
\param[in] fc: display color of font
\param[out] none
\retval none
*/
void lcd_circle_draw(uint16_t x, uint16_t y, uint16_t r, uint16_t fc)
{
unsigned short a, b;
int c;
a = 0;
b = r;
c = 3 - 2 * r;
LCD_CS_CLR;
while(a < b) {
/* draw points on the lcd */
lcd_draw_point(x + a, y + b, fc);
lcd_draw_point(x - a, y + b, fc);
lcd_draw_point(x + a, y - b, fc);
lcd_draw_point(x - a, y - b, fc);
lcd_draw_point(x + b, y + a, fc);
lcd_draw_point(x - b, y + a, fc);
lcd_draw_point(x + b, y - a, fc);
lcd_draw_point(x - b, y - a, fc);
if(c < 0) {
c = c + 4 * a + 6;
} else {
c = c + 4 * (a - b) + 10;
b -= 1;
}
a += 1;
}
if(a == b) {
/* draw points on the lcd */
lcd_draw_point(x + a, y + b, fc);
lcd_draw_point(x + a, y + b, fc);
lcd_draw_point(x + a, y - b, fc);
lcd_draw_point(x - a, y - b, fc);
lcd_draw_point(x + b, y + a, fc);
lcd_draw_point(x - b, y + a, fc);
lcd_draw_point(x + b, y - a, fc);
lcd_draw_point(x - b, y - a, fc);
}
LCD_CS_SET;
}
/*!
\brief gui draw line
\param[in] x0: the x position of the start point
\param[in] y0: the y position of the start point
\param[in] x1: the x position of the end point
\param[in] y1: the y position of the end point
\param[in] color: lcd display color
\param[out] none
\retval none
*/
void lcd_line_draw(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color)
{
/* - difference in x's
- difference in y's
- dx,dy * 2
- amount in pixel space to move during drawing
- amount in pixel space to move during drawing
- the discriminant i.e. error i.e. decision variable
- used for looping */
int dx, dy, dx2, dy2, x_inc, y_inc, error, index;
LCD_CS_CLR;
lcd_set_xy(x0, y0);
/* calculate x distance */
dx = x1 - x0;
/* calculate y distance */
dy = y1 - y0;
if(dx >= 0) {
x_inc = 1;
} else {
x_inc = -1;
dx = -dx;
}
if(dy >= 0) {
y_inc = 1;
} else {
y_inc = -1;
dy = -dy;
}
dx2 = dx << 1;
dy2 = dy << 1;
if(dx > dy) {
/* initialize error */
error = dy2 - dx;
/* draw the line */
for(index = 0; index <= dx; index ++) {
lcd_draw_point(x0, y0, color);
/* test if error has overflowed */
if(0 <= error) {
error -= dx2;
/* move to next line */
y0 += y_inc;
}
/* adjust the error term */
error += dy2;
/* move to the next pixel */
x0 += x_inc;
}
} else {
/* initialize error term */
error = dx2 - dy;
/* draw the linedraw the line*/
for(index = 0; index <= dy; index ++) {
/* set the pixel */
lcd_draw_point(x0, y0, color);
/* test if error overflowed */
if(0 <= error) {
error -= dy2;
/* move to next line */
x0 += x_inc;
}
/* adjust the error term */
error += dx2;
/* move to the next pixel */
y0 += y_inc;
}
}
LCD_CS_SET;
}
/*!
\brief gui box
\param[in] x: the x position of the start point
\param[in] y: the y position of the start point
\param[in] w: the width of the box
\param[in] h: the high of the box
\param[in] bc: display background color
\param[out] none
\retval none
*/
void lcd_rect_draw(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t line_color)
{
LCD_CS_CLR;
/* gui draw line*/
lcd_line_draw(x, y, x + w, y, line_color);
lcd_line_draw(x + w, y, x + w, y + h, line_color);
lcd_line_draw(x, y + h, x + w, y + h, line_color);
lcd_line_draw(x, y, x, y + h, line_color);
LCD_CS_SET;
}
/*!
\brief lcd box
\param[in] x: the x position of the start point
\param[in] y: the y position of the start point
\param[in] w: the width of the box
\param[in] h: the high of the box
\param[in] bc: display background color
\param[out] none
\retval none
*/
void lcd_box(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t bc)
{
LCD_CS_CLR;
/* gui draw line*/
lcd_line_draw(x, y, x + w, y, 0xEF7D);
lcd_line_draw(x + w - 1, y + 1, x + w - 1, y + 1 + h, 0x2965);
lcd_line_draw(x, y + h, x + w, y + h, 0x2965);
lcd_line_draw(x, y, x, y + h, 0xEF7D);
lcd_line_draw(x + 1, y + 1, x + 1 + w - 2, y + 1 + h - 2, bc);
LCD_CS_SET;
}
/*!
\brief lcd box2
\param[in] x: the x position of the start point
\param[in] y: the y position of the start point
\param[in] w: the width of the box
\param[in] h: the high of the box
\param[in] mode: display color combination mode
\param[out] none
\retval none
*/
void lcd_box2(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t mode)
{
LCD_CS_CLR;
/* gui box2 display mode0 */
if(0 == mode) {
lcd_line_draw(x, y, x + w, y, 0xEF7D);
lcd_line_draw(x + w - 1, y + 1, x + w - 1, y + 1 + h, 0x2965);
lcd_line_draw(x, y + h, x + w, y + h, 0x2965);
lcd_line_draw(x, y, x, y + h, 0xEF7D);
}
/* gui box2 display mode1 */
if(1 == mode) {
lcd_line_draw(x, y, x + w, y, 0x2965);
lcd_line_draw(x + w - 1, y + 1, x + w - 1, y + 1 + h, 0xEF7D);
lcd_line_draw(x, y + h, x + w, y + h, 0xEF7D);
lcd_line_draw(x, y, x, y + h, 0x2965);
}
/* gui box2 display mode2 */
if(2 == mode) {
lcd_line_draw(x, y, x + w, y, 0xffff);
lcd_line_draw(x + w - 1, y + 1, x + w - 1, y + 1 + h, 0xffff);
lcd_line_draw(x, y + h, x + w, y + h, 0xffff);
lcd_line_draw(x, y, x, y + h, 0xffff);
}
LCD_CS_SET;
}
/*!
\brief gui rect
\param[in] x1: the x position of the start point
\param[in] y1: the y position of the start point
\param[in] x2: the x position of the end point
\param[in] y2: the y position of the end point
\param[in] fc: display color of font
\param[out] none
\retval none
*/
void lcd_rect_color_draw(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t fc)
{
int ix, iy;
LCD_CS_CLR;
for(ix = x1; ix < x2; ix ++) {
for(iy = y1; iy < y2; iy ++)
/* set the pixel */
{
lcd_draw_point(ix, iy, fc);
}
}
LCD_CS_SET;
}
/*!
\brief display button down
\param[in] x1: the x position of the start point
\param[in] y1: the y position of the start point
\param[in] x2: the x position of the end point
\param[in] y2: the y position of the end point
\param[out] none
\retval none
*/
void display_button_down(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
{
LCD_CS_CLR;
/* gui draw line with gray color*/
lcd_line_draw(x1, y1, x2, y1, GRAY2);
lcd_line_draw(x1 + 1, y1 + 1, x2, y1 + 1, GRAY1);
lcd_line_draw(x1, y1, x1, y2, GRAY2);
lcd_line_draw(x1 + 1, y1 + 1, x1 + 1, y2, GRAY1);
/* gui draw line with white color*/
lcd_line_draw(x1, y2, x2, y2, WHITE);
lcd_line_draw(x2, y1, x2, y2, WHITE);
LCD_CS_SET;
}
/*!
\brief display button up
\param[in] x1: the x position of the start point
\param[in] y1: the y position of the start point
\param[in] x2: the x position of the end point
\param[in] y2: the y position of the end point
\param[out] none
\retval none
*/
void display_button_up(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
{
LCD_CS_CLR;
/* gui draw line with white color*/
lcd_line_draw(x1, y1, x2, y1, WHITE);
lcd_line_draw(x1, y1, x1, y2, WHITE);
/* gui draw line with gray color*/
lcd_line_draw(x1 + 1, y2 - 1, x2, y2 - 1, GRAY1);
lcd_line_draw(x1, y2, x2, y2, GRAY2);
lcd_line_draw(x2 - 1, y1 + 1, x2 - 1, y2, GRAY1);
lcd_line_draw(x2, y1, x2, y2, GRAY2);
LCD_CS_SET;
}
/*!
\brief gui draw font to gbk16
\param[in] x: the x position of the start point
\param[in] y: the y position of the start point
\param[in] fc: display color of font
\param[in] bc: display background color
\param[in] *s: display char
\param[out] none
\retval none
*/
void lcd_draw_font_gbk16(uint16_t x, uint16_t y, uint16_t fc, uint16_t bc, char *s)
{
unsigned char i, j;
unsigned short k, x0;
x0 = x;
LCD_CS_CLR;
while(*s) {
/* ASCII character table from 32 to 128 */
if(((uint8_t)(*s)) < 128) {
k = *s;
if(13 == k) {
x = x0;
y += 16;
} else {
if(k > 32) {
k -= 32;
} else {
k = 0;
}
for(i = 0; i < 16; i ++)
for(j = 0; j < 8; j ++) {
if(asc16[k * 16 + i] & (0x80 >> j))
/* draw a point on the lcd */
{
lcd_draw_point(x + j, y + i, fc);
} else {
if(fc != bc)
/* draw a point on the lcd */
{
lcd_draw_point(x + j, y + i, bc);
}
}
}
x += 8;
}
s ++;
} else {
for(k = 0; k < hz16_num; k ++) {
if((hz16[k].Index[0] == *(s)) && (hz16[k].Index[1] == *(s + 1))) {
for(i = 0; i < 16; i ++) {
for(j = 0; j < 8; j ++) {
if(hz16[k].Msk[i * 2] & (0x80 >> j))
/* draw a point on the lcd */
{
lcd_draw_point(x + j, y + i, fc);
} else {
if(fc != bc)
/* draw a point on the lcd */
{
lcd_draw_point(x + j, y + i, bc);
}
}
}
for(j = 0; j < 8; j ++) {
if(hz16[k].Msk[i * 2 + 1] & (0x80 >> j))
/* draw a point on the lcd */
{
lcd_draw_point(x + j + 8, y + i, fc);
} else {
if(fc != bc)
/* draw a point on the lcd */
{
lcd_draw_point(x + j + 8, y + i, bc);
}
}
}
}
}
}
s += 2;
x += 16;
}
}
LCD_CS_SET;
}
/*!
\brief gui draw font to gbk24
\param[in] x: the x position of the start point
\param[in] y: the y position of the start point
\param[in] fc: display color of font
\param[in] bc: display background color
\param[in] *s: display char
\param[out] none
\retval none
*/
void lcd_draw_font_gbk24(uint16_t x, uint16_t y, uint16_t fc, uint16_t bc, char *s)
{
unsigned char i, j;
unsigned short k;
LCD_CS_CLR;
while(*s) {
/* ASCII character table from 32 to 128 */
if(((uint8_t)(*s)) < 0x80) {
k = *s;
if(k > 32) {
k -= 32;
} else {
k = 0;
}
for(i = 0; i < 16; i ++)
for(j = 0; j < 8; j ++) {
if(asc16[k * 16 + i] & (0x80 >> j))
/* draw a point on the lcd */
{
lcd_draw_point(x + j, y + i, fc);
} else {
if(fc != bc)
/* draw a point on the lcd */
{
lcd_draw_point(x + j, y + i, bc);
}
}
}
s ++;
x += 8;
} else {
for(k = 0; k < hz24_num; k ++) {
if((hz24[k].Index[0] == *(s)) && (hz24[k].Index[1] == *(s + 1))) {
for(i = 0; i < 24; i ++) {
for(j = 0; j < 8; j ++) {
if(hz24[k].Msk[i * 3] & (0x80 >> j))
/* draw a point on the lcd */
{
lcd_draw_point(x + j, y + i, fc);
} else {
if(fc != bc)
/* draw a point on the lcd */
{
lcd_draw_point(x + j, y + i, bc);
}
}
}
for(j = 0; j < 8; j ++) {
if(hz24[k].Msk[i * 3 + 1] & (0x80 >> j))
/* draw a point on the lcd */
{
lcd_draw_point(x + j + 8, y + i, fc);
} else {
if(fc != bc)
/* draw a point on the lcd */
{
lcd_draw_point(x + j + 8, y + i, bc);
}
}
}
for(j = 0; j < 8; j ++) {
if(hz24[k].Msk[i * 3 + 2] & (0x80 >> j))
/* draw a point on the lcd */
{
lcd_draw_point(x + j + 16, y + i, fc);
} else {
if(fc != bc)
/* draw a point on the lcd */
{
lcd_draw_point(x + j + 16, y + i, bc);
}
}
}
}
}
}
s += 2;
x += 24;
}
}
LCD_CS_SET;
}
/*!
\brief gui draw font to num32
\param[in] x: the x position of the start point
\param[in] y: the y position of the start point
\param[in] fc: display color of font
\param[in] bc: display background color
\param[in] num: display num
\param[out] none
\retval none
*/
void lcd_draw_font_num32(uint16_t x, uint16_t y, uint16_t fc, uint16_t bc, uint16_t num)
{
unsigned char i, j, k, c;
LCD_CS_CLR;
for(i = 0; i < 32; i ++) {
for(j = 0; j < 4; j++) {
c = *(sz32 + num * 32 * 4 + i * 4 + j);
for(k = 0; k < 8; k ++) {
if(c & (0x80 >> k))
/* draw a point on the lcd */
{
lcd_draw_point(x + j * 8 + k, y + i, fc);
} else {
if(fc != bc)
/* draw a point on the lcd */
{
lcd_draw_point(x + j * 8 + k, y + i, bc);
}
}
}
}
}
LCD_CS_SET;
}

View File

@@ -0,0 +1,110 @@
/*!
\file gd32e230_lcd_eval.h
\brief LCD driver header file
\version 2025-02-10, V2.4.0, demo for GD32E23x
*/
/*
Copyright (c) 2025, GigaDevice Semiconductor Inc.
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 the copyright holder 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.
*/
#ifndef GD32E230_LCD_EVAL_H
#define GD32E230_LCD_EVAL_H
#ifdef __cplusplus
extern "C" {
#endif
#include "gd32e230c_eval.h"
/* Colors */
#define RED 0xf800
#define GREEN 0x07e0
#define BLUE 0x001f
#define WHITE 0xffff
#define BLACK 0x0000
#define YELLOW 0xFFE0
/* GRAYs */
#define GRAY0 0xEF7D
#define GRAY1 0x8410
#define GRAY2 0x4208
/* PB0 tft cs */
#define LCD_CS_SET ((uint32_t)(GPIO_BOP(GPIOB) = GPIO_PIN_0))
#define LCD_CS_CLR ((uint32_t)(GPIO_BC(GPIOB) = GPIO_PIN_0))
/* PB2 tft rs/dc */
#define LCD_RS_SET ((uint32_t)(GPIO_BOP(GPIOB) = GPIO_PIN_2))
#define LCD_RS_CLR ((uint32_t)(GPIO_BC(GPIOB) = GPIO_PIN_2))
/* PB1 tft rst */
#define LCD_RST_SET ((uint32_t)(GPIO_BOP(GPIOB) = GPIO_PIN_1))
#define LCD_RST_CLR ((uint32_t)(GPIO_BC(GPIOB) = GPIO_PIN_1))
/* lcd init */
void lcd_init(void);
/* clear the lcd */
void lcd_clear(uint16_t color);
/* set the start display point of lcd */
void lcd_set_xy(uint16_t x, uint16_t y);
/* draw a point on the lcd */
void lcd_draw_point(uint16_t x, uint16_t y, uint16_t data);
/* bgr to rgb format conversion */
uint16_t lcd_bgr2rgb(uint16_t c);
/* draw a circle on the lcd */
void lcd_circle_draw(uint16_t x, uint16_t y, uint16_t r, uint16_t fc);
/* draw a line on the LCD */
void lcd_line_draw(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);
/* LCD rectangle draw */
void lcd_rect_draw(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t line_color);
/* LCD box */
void lcd_box(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t bc);
/* LCD box2 */
void lcd_box2(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t mode);
/* draw a rectangle with color on the lcd */
void lcd_rect_color_draw(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t fc);
/* display button down */
void display_button_down(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
/* display button up */
void display_button_up(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
/* draw gbk16 font on the LCD */
void lcd_draw_font_gbk16(uint16_t x, uint16_t y, uint16_t fc, uint16_t bc, char *s);
/* draw gbk24 font on the LCD */
void lcd_draw_font_gbk24(uint16_t x, uint16_t y, uint16_t fc, uint16_t bc, char *s);
/* draw num32 font on the LCD */
void lcd_draw_font_num32(uint16_t x, uint16_t y, uint16_t fc, uint16_t bc, uint16_t num);
void lcd_region_set(uint16_t StartX, uint16_t StartY, uint16_t EndX, uint16_t EndY);
#ifdef __cplusplus
}
#endif
#endif /* GD32E230_LCD_EVAL_H */