use It8951 files

This commit is contained in:
aceisace 2022-04-10 02:48:40 +02:00
parent 1f7ef37da1
commit f923321f24
20 changed files with 12832 additions and 0 deletions

View File

@ -0,0 +1,360 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bcm2835 configure 1.68, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
## --------- ##
hostname = inkydev
uname -m = armv7l
uname -r = 5.4.51-v7l+
uname -s = Linux
uname -v = #1333 SMP Mon Aug 10 16:51:40 BST 2020
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /home/pi/InkycalVenv/venv/bin
PATH: /home/pi/.local/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/local/games
PATH: /usr/games
## ----------- ##
## Core tests. ##
## ----------- ##
configure:1892: checking for a BSD-compatible install
configure:1960: result: /usr/bin/install -c
configure:1971: checking whether build environment is sane
configure:2026: result: yes
configure:2175: checking for a thread-safe mkdir -p
configure:2214: result: /bin/mkdir -p
configure:2221: checking for gawk
configure:2251: result: no
configure:2221: checking for mawk
configure:2237: found /usr/bin/mawk
configure:2248: result: mawk
configure:2259: checking whether make sets $(MAKE)
configure:2281: result: yes
configure:2310: checking whether make supports nested variables
configure:2327: result: yes
configure:2457: checking whether make supports the include directive
configure:2472: make -f confmf.GNU && cat confinc.out
this is the am__doit target
configure:2475: $? = 0
configure:2494: result: yes (GNU style)
configure:2564: checking for gcc
configure:2580: found /usr/bin/gcc
configure:2591: result: gcc
configure:2820: checking for C compiler version
configure:2829: gcc --version >&5
gcc (Raspbian 8.3.0-6+rpi1) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:2840: $? = 0
configure:2829: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/8/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Raspbian 8.3.0-6+rpi1' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --disable-werror --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1)
configure:2840: $? = 0
configure:2829: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2840: $? = 1
configure:2829: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:2840: $? = 1
configure:2860: checking whether the C compiler works
configure:2882: gcc conftest.c >&5
configure:2886: $? = 0
configure:2934: result: yes
configure:2937: checking for C compiler default output file name
configure:2939: result: a.out
configure:2945: checking for suffix of executables
configure:2952: gcc -o conftest conftest.c >&5
configure:2956: $? = 0
configure:2978: result:
configure:3000: checking whether we are cross compiling
configure:3008: gcc -o conftest conftest.c >&5
configure:3012: $? = 0
configure:3019: ./conftest
configure:3023: $? = 0
configure:3011: result: no
configure:3016: checking for suffix of object files
configure:3038: gcc -c conftest.c >&5
configure:3042: $? = 0
configure:3063: result: o
configure:3067: checking whether we are using the GNU C compiler
configure:3086: gcc -c conftest.c >&5
configure:3086: $? = 0
configure:3095: result: yes
configure:3104: checking whether gcc accepts -g
configure:3124: gcc -c -g conftest.c >&5
configure:3124: $? = 0
configure:3165: result: yes
configure:3182: checking for gcc option to accept ISO C89
configure:3245: gcc -c -g -O2 conftest.c >&5
configure:3245: $? = 0
configure:3258: result: none needed
configure:3283: checking whether gcc understands -c and -o together
configure:3305: gcc -c conftest.c -o conftest2.o
configure:3308: $? = 0
configure:3305: gcc -c conftest.c -o conftest2.o
configure:3308: $? = 0
configure:3320: result: yes
configure:3339: checking dependency style of gcc
configure:3450: result: gcc3
configure:3466: checking for clock_gettime in -lrt
configure:3491: gcc -o conftest -g -O2 conftest.c -lrt >&5
configure:3491: $? = 0
configure:3500: result: yes
configure:3515: checking for doxygen
configure:3545: result: no
configure:3554: WARNING: Doxygen not found - continuing without Doxygen support
configure:3600: checking for ranlib
configure:3616: found /usr/bin/ranlib
configure:3627: result: ranlib
configure:3697: checking for gcc
configure:3724: result: gcc
configure:3953: checking for C compiler version
configure:3962: gcc --version >&5
gcc (Raspbian 8.3.0-6+rpi1) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3973: $? = 0
configure:3962: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/8/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Raspbian 8.3.0-6+rpi1' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --disable-werror --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1)
configure:3973: $? = 0
configure:3962: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3973: $? = 1
configure:3962: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:3973: $? = 1
configure:3977: checking whether we are using the GNU C compiler
configure:4005: result: yes
configure:4014: checking whether gcc accepts -g
configure:4075: result: yes
configure:4092: checking for gcc option to accept ISO C89
configure:4168: result: none needed
configure:4193: checking whether gcc understands -c and -o together
configure:4230: result: yes
configure:4249: checking dependency style of gcc
configure:4360: result: gcc3
configure:4490: checking that generated files are newer than configure
configure:4496: result: done
configure:4527: creating ./config.status
## ---------------------- ##
## Running config.status. ##
## ---------------------- ##
This file was extended by bcm2835 config.status 1.68, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES =
CONFIG_HEADERS =
CONFIG_LINKS =
CONFIG_COMMANDS =
$ ./config.status
on inkydev
config.status:844: creating Makefile
config.status:844: creating src/Makefile
config.status:844: creating doc/Makefile
config.status:844: creating config.h
config.status:1025: config.h is unchanged
config.status:1073: executing depfiles commands
config.status:1150: cd src && sed -e '/# am--include-marker/d' Makefile | make -f - am--depfiles
make: Nothing to be done for 'am--depfiles'.
config.status:1155: $? = 0
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_lib_rt_clock_gettime=yes
ac_cv_objext=o
ac_cv_path_install='/usr/bin/install -c'
ac_cv_path_mkdir=/bin/mkdir
ac_cv_prog_AWK=mawk
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_ac_ct_RANLIB=ranlib
ac_cv_prog_cc_c89=
ac_cv_prog_cc_g=yes
ac_cv_prog_make_make_set=yes
am_cv_CC_dependencies_compiler_type=gcc3
am_cv_make_support_nested_variables=yes
am_cv_prog_cc_c_o=yes
## ----------------- ##
## Output variables. ##
## ----------------- ##
ACLOCAL='${SHELL} /home/pi/InkycalVenv/inkycal/display/drivers/7_in_8_drivers/bcm2835-1.68/missing aclocal-1.16'
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AM_BACKSLASH='\'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
AM_DEFAULT_VERBOSITY='1'
AM_V='$(V)'
AUTOCONF='${SHELL} /home/pi/InkycalVenv/inkycal/display/drivers/7_in_8_drivers/bcm2835-1.68/missing autoconf'
AUTOHEADER='${SHELL} /home/pi/InkycalVenv/inkycal/display/drivers/7_in_8_drivers/bcm2835-1.68/missing autoheader'
AUTOMAKE='${SHELL} /home/pi/InkycalVenv/inkycal/display/drivers/7_in_8_drivers/bcm2835-1.68/missing automake-1.16'
AWK='mawk'
CC='gcc'
CCDEPMODE='depmode=gcc3'
CFLAGS='-g -O2'
CPPFLAGS=''
CYGPATH_W='echo'
DEFS='-DHAVE_CONFIG_H'
DEPDIR='.deps'
DOXYGEN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EXEEXT=''
HAVE_DOXYGEN_FALSE=''
HAVE_DOXYGEN_TRUE='#'
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LDFLAGS=''
LIBOBJS=''
LIBS='-lrt '
LTLIBOBJS=''
MAKEINFO='${SHELL} /home/pi/InkycalVenv/inkycal/display/drivers/7_in_8_drivers/bcm2835-1.68/missing makeinfo'
MKDIR_P='/bin/mkdir -p'
OBJEXT='o'
PACKAGE='bcm2835'
PACKAGE_BUGREPORT='mikem@airspayce.com'
PACKAGE_NAME='bcm2835'
PACKAGE_STRING='bcm2835 1.68'
PACKAGE_TARNAME='bcm2835'
PACKAGE_URL=''
PACKAGE_VERSION='1.68'
PATH_SEPARATOR=':'
RANLIB='ranlib'
SET_MAKE=''
SHELL='/bin/bash'
STRIP=''
VERSION='1.68'
ac_ct_CC='gcc'
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE='#'
am__fastdepCC_FALSE='#'
am__fastdepCC_TRUE=''
am__include='include'
am__isrc=''
am__leading_dot='.'
am__nodep='_no'
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='${prefix}'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /home/pi/InkycalVenv/inkycal/display/drivers/7_in_8_drivers/bcm2835-1.68/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='$(MKDIR_P)'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/usr/local'
program_transform_name='s,x,x,'
psdir='${docdir}'
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "bcm2835"
#define PACKAGE_TARNAME "bcm2835"
#define PACKAGE_VERSION "1.68"
#define PACKAGE_STRING "bcm2835 1.68"
#define PACKAGE_BUGREPORT "mikem@airspayce.com"
#define PACKAGE_URL ""
#define PACKAGE "bcm2835"
#define VERSION "1.68"
#define HAVE_LIBRT 1
configure: exit 0

View File

@ -0,0 +1,14 @@
======================================
bcm2835 1.68: src/test-suite.log
======================================
# TOTAL: 1
# PASS: 1
# SKIP: 0
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
.. contents:: :depth: 2

View File

@ -0,0 +1 @@
PASS test (exit status: 0)

View File

@ -0,0 +1,176 @@
/*****************************************************************************
* | File : DEV_Config.c
* | Author : Waveshare team
* | Function : Hardware underlying interface
* | Info :
*----------------
* | This version: V3.0
* | Date : 2019-09-17
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of theex Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "DEV_Config.h"
#include <fcntl.h>
/******************************************************************************
function: GPIO Write
parameter:
Info:
******************************************************************************/
void DEV_Digital_Write(UWORD Pin, UBYTE Value)
{
bcm2835_gpio_write(Pin, Value);
}
/******************************************************************************
function: GPIO Read
parameter:
Info:
******************************************************************************/
UBYTE DEV_Digital_Read(UWORD Pin)
{
UBYTE Read_Value = 0;
Read_Value = bcm2835_gpio_lev(Pin);
return Read_Value;
}
/******************************************************************************
function: SPI Write
parameter:
Info:
******************************************************************************/
void DEV_SPI_WriteByte(UBYTE Value)
{
bcm2835_spi_transfer(Value);
}
/******************************************************************************
function: SPI Read
parameter:
Info:
******************************************************************************/
UBYTE DEV_SPI_ReadByte()
{
UBYTE Read_Value = 0x00;
Read_Value = bcm2835_spi_transfer(0x00);
return Read_Value;
}
/******************************************************************************
function: Time delay for ms
parameter:
Info:
******************************************************************************/
void DEV_Delay_ms(UDOUBLE xms)
{
bcm2835_delay(xms);
}
/******************************************************************************
function: Time delay for us
parameter:
Info:
******************************************************************************/
void DEV_Delay_us(UDOUBLE xus)
{
bcm2835_delayMicroseconds(xus);
}
/**
* GPIO Mode
**/
static void DEV_GPIO_Mode(UWORD Pin, UWORD Mode)
{
if(Mode == 0 || Mode == BCM2835_GPIO_FSEL_INPT) {
bcm2835_gpio_fsel(Pin, BCM2835_GPIO_FSEL_INPT);
} else {
bcm2835_gpio_fsel(Pin, BCM2835_GPIO_FSEL_OUTP);
}
}
/**
* GPIO Init
**/
static void DEV_GPIO_Init(void)
{
DEV_GPIO_Mode(EPD_RST_PIN, BCM2835_GPIO_FSEL_OUTP);
DEV_GPIO_Mode(EPD_CS_PIN, BCM2835_GPIO_FSEL_OUTP);
DEV_GPIO_Mode(EPD_BUSY_PIN, BCM2835_GPIO_FSEL_INPT);
DEV_Digital_Write(EPD_CS_PIN, HIGH);
}
/******************************************************************************
function: Module Initialize, the library and initialize the pins, SPI protocol
parameter:
Info:
******************************************************************************/
UBYTE DEV_Module_Init(void)
{
Debug("/***********************************/ \r\n");
if(!bcm2835_init()) {
Debug("bcm2835 init failed !!! \r\n");
return 1;
} else {
Debug("bcm2835 init success !!! \r\n");
}
bcm2835_spi_begin(); //Start spi interface, set spi pin for the reuse function
bcm2835_spi_setBitOrder(BCM2835_SPI_BIT_ORDER_MSBFIRST); //High first transmission
bcm2835_spi_setDataMode(BCM2835_SPI_MODE0); //spi mode 0
//bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_16); //For RPi3/3B/3B+
bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_32); //For RPi 4
/* SPI clock reference link*/
/*http://www.airspayce.com/mikem/bcm2835/group__constants.html#gaf2e0ca069b8caef24602a02e8a00884e*/
//GPIO Config
DEV_GPIO_Init();
Debug("/***********************************/ \r\n");
return 0;
}
/******************************************************************************
function: Module exits, closes SPI and BCM2835 library
parameter:
Info:
******************************************************************************/
void DEV_Module_Exit(void)
{
DEV_Digital_Write(EPD_CS_PIN, LOW);
DEV_Digital_Write(EPD_RST_PIN, LOW);
bcm2835_spi_end();
bcm2835_close();
}

View File

@ -0,0 +1,96 @@
/*****************************************************************************
* | File : DEV_Config.h
* | Author : Waveshare team
* | Function : Hardware underlying interface
* | Info :
* Used to shield the underlying layers of each master
* and enhance portability
*----------------
* | This version: V2.0
* | Date : 2018-10-30
* | Info :
* 1.add:
* UBYTE\UWORD\UDOUBLE
* 2.Change:
* EPD_RST -> EPD_RST_PIN
* EPD_DC -> EPD_DC_PIN
* EPD_CS -> EPD_CS_PIN
* EPD_BUSY -> EPD_BUSY_PIN
* 3.Remote:
* EPD_RST_1\EPD_RST_0
* EPD_DC_1\EPD_DC_0
* EPD_CS_1\EPD_CS_0
* EPD_BUSY_1\EPD_BUSY_0
* 3.add:
* #define DEV_Digital_Write(_pin, _value) bcm2835_GPIOI_write(_pin, _value)
* #define DEV_Digital_Read(_pin) bcm2835_GPIOI_lev(_pin)
* #define DEV_SPI_WriteByte(__value) bcm2835_spi_transfer(__value)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#ifndef _DEV_CONFIG_H_
#define _DEV_CONFIG_H_
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include "Debug.h"
#include <bcm2835.h>
/**
* GPIO
**/
#define EPD_RST_PIN 17
#define EPD_CS_PIN 8
#define EPD_BUSY_PIN 24
/**
* data
**/
#define UBYTE uint8_t
#define UWORD uint16_t
#define UDOUBLE uint32_t
/*------------------------------------------------------------------------------------------------------*/
void DEV_Digital_Write(UWORD Pin, UBYTE Value);
UBYTE DEV_Digital_Read(UWORD Pin);
void DEV_SPI_WriteByte(UBYTE Value);
UBYTE DEV_SPI_ReadByte();
void DEV_Delay_ms(UDOUBLE xms);
void DEV_Delay_us(UDOUBLE xus);
UBYTE DEV_Module_Init(void);
void DEV_Module_Exit(void);
#endif

View File

@ -0,0 +1,47 @@
/*****************************************************************************
* | File : Debug.h
* | Author : Waveshare team
* | Function : debug with printf
* | Info :
* Image scanning
* Please use progressive scanning to generate images or fonts
*----------------
* | This version: V2.0
* | Date : 2018-10-30
* | Info :
* 1.USE_DEBUG -> DEBUG, If you need to see the debug information,
* clear the execution: make DEBUG=-DDEBUG
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#ifndef __DEBUG_H
#define __DEBUG_H
#include <stdio.h>
#if DEBUG
#define Debug(fmt,...) printf("%s[%d]:"fmt,__FILE__,__LINE__,##__VA_ARGS__)
#else
#define Debug(fmt,...) printf(fmt,##__VA_ARGS__)
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,120 @@
/**
******************************************************************************
* @file Font12.c
* @author MCD Application Team
* @version V1.0.0
* @date 18-February-2014
* @brief This file provides text Font12 for STM32xx-EVAL's LCD driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; 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.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "fonts.h"
//
// Font data for Courier New 12pt
//
const CH_CN Font12CN_Table[] =
{
/*-- 文字: 你 --*/
/*-- 微软雅黑12; 此字体下对应的点阵为宽x高=16x21 --*/
{{""},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1D,0xC0,0x1D,0x80,0x3B,0xFF,0x3B,0x07,
0x3F,0x77,0x7E,0x76,0xF8,0x70,0xFB,0xFE,0xFB,0xFE,0x3F,0x77,0x3F,0x77,0x3E,0x73,
0x38,0x70,0x38,0x70,0x3B,0xE0,0x00,0x00,0x00,0x00}},
/*-- 文字: 好 --*/
/*-- 微软雅黑12; 此字体下对应的点阵为宽x高=16x21 --*/
{{""},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x73,0xFF,0x70,0x0F,0xFE,0x1E,
0x7E,0x3C,0x6E,0x38,0xEE,0x30,0xEF,0xFF,0xFC,0x30,0x7C,0x30,0x38,0x30,0x3E,0x30,
0x7E,0x30,0xE0,0x30,0xC1,0xF0,0x00,0x00,0x00,0x00}},
/*-- 文字: 树 --*/
/*-- 微软雅黑12; 此字体下对应的点阵为宽x高=16x21 --*/
{{""},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x0E,0x30,0x0E,0x3F,0xEE,0x30,0xEE,
0xFC,0xFF,0x76,0xCE,0x77,0xFE,0x7B,0xFE,0xFF,0xFE,0xF3,0xDE,0xF3,0xCE,0x37,0xEE,
0x3E,0x6E,0x3C,0x0E,0x30,0x3E,0x00,0x00,0x00,0x00}},
/*-- 文字: 莓 --*/
/*-- 微软雅黑12; 此字体下对应的点阵为宽x高=16x21 --*/
{{""},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x70,0xFF,0xFF,0x3E,0x70,0x38,0x00,
0x7F,0xFF,0xE0,0x00,0xFF,0xFC,0x3B,0x8C,0x39,0xCC,0xFF,0xFF,0x73,0x9C,0x71,0xDC,
0x7F,0xFF,0x00,0x1C,0x01,0xF8,0x00,0x00,0x00,0x00}},
/*-- 文字: 派 --*/
/*-- 微软雅黑12; 此字体下对应的点阵为宽x高=16x21 --*/
{{""},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x1F,0xFF,0xF0,0x3E,0x00,0x0E,0x1F,
0xCF,0xFB,0xFF,0xF8,0x3F,0xFF,0x0F,0xFF,0x7F,0xD8,0x7F,0xDC,0x6F,0xCE,0xED,0xFF,
0xFD,0xF7,0xF9,0xC0,0x00,0x00,0x00,0x00,0x00,0x00}},
/*-- 文字: a --*/
/*-- 微软雅黑12; 此字体下对应的点阵为宽x高=16x21 --*/
{{"a"},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x3E,0x00,0x67,0x00,0x07,0x80,0x0F,0x80,0x7F,0x80,0xE3,0x80,0xE7,0x80,0xE7,0x80,
0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
/*-- 文字: b --*/
/*-- 微软雅黑12; 此字体下对应的点阵为宽x高=16x21 --*/
{{"b"},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,
0x7F,0x00,0x7B,0x80,0x71,0xC0,0x71,0xC0,0x71,0xC0,0x71,0xC0,0x71,0xC0,0x7B,0x80,
0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
/*-- 文字: c --*/
/*-- 微软雅黑12; 此字体下对应的点阵为宽x高=16x21 --*/
{{"c"},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x3F,0x00,0x73,0x00,0xF0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xF0,0x00,0x73,0x00,
0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
/*-- 文字: A --*/
/*-- 微软雅黑12; 此字体下对应的点阵为宽x高=16x21 --*/
{{"A"},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x1F,0x00,0x1F,0x00,
0x1F,0x00,0x3B,0x80,0x3B,0x80,0x71,0x80,0x7F,0xC0,0x71,0xC0,0xE0,0xE0,0xE0,0xE0,
0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
};
cFONT Font12CN = {
Font12CN_Table,
sizeof(Font12CN_Table)/sizeof(CH_CN), /*size of table*/
11, /* ASCII Width */
16, /* Width */
21, /* Height */
};
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,465 @@
/**
******************************************************************************
* @file Font12.c
* @author MCD Application Team
* @version V1.0.0
* @date 18-February-2014
* @brief This file provides text Font12 for STM32xx-EVAL's LCD driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; 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.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "fonts.h"
//
// Font data for Courier New 12pt
//
const CH_CN Font24CN_Table[] =
{
/*-- 文字: 你 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,0x01,0xC1,0xC0,0x00,
0x01,0xE3,0xE0,0x00,0x03,0xE3,0xC0,0x00,0x03,0xC7,0x80,0x00,0x03,0xC7,0xFF,0xFF,
0x07,0x8F,0xFF,0xFF,0x07,0x8F,0x00,0x0F,0x0F,0x1E,0x00,0x1E,0x0F,0x3C,0x1E,0x1E,
0x1F,0x3C,0x1E,0x3E,0x1F,0x18,0x1E,0x3C,0x3F,0x00,0x1E,0x1C,0x7F,0x00,0x1E,0x00,
0x7F,0x07,0x9E,0x70,0xFF,0x07,0x9E,0xF0,0xEF,0x0F,0x9E,0x78,0x6F,0x0F,0x1E,0x78,
0x0F,0x0F,0x1E,0x3C,0x0F,0x1E,0x1E,0x3C,0x0F,0x1E,0x1E,0x1E,0x0F,0x3C,0x1E,0x1E,
0x0F,0x3C,0x1E,0x1F,0x0F,0x7C,0x1E,0x0F,0x0F,0x78,0x1E,0x0E,0x0F,0x00,0x1E,0x00,
0x0F,0x00,0x1E,0x00,0x0F,0x00,0x3C,0x00,0x0F,0x07,0xFC,0x00,0x0F,0x07,0xF8,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 好 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,
0x0F,0x07,0xFF,0xFE,0x0F,0x07,0xFF,0xFE,0x0F,0x00,0x00,0x3E,0x1E,0x00,0x00,0xFC,
0xFF,0xF8,0x01,0xF0,0xFF,0xF8,0x03,0xE0,0x1E,0x78,0x07,0xC0,0x1E,0x78,0x0F,0x80,
0x3C,0x78,0x0F,0x00,0x3C,0x78,0x0F,0x00,0x3C,0x78,0x0F,0x00,0x3C,0x78,0x0F,0x00,
0x3C,0x7F,0xFF,0xFF,0x78,0xFF,0xFF,0xFF,0x78,0xF0,0x0F,0x00,0x78,0xF0,0x0F,0x00,
0x3D,0xE0,0x0F,0x00,0x1F,0xE0,0x0F,0x00,0x0F,0xE0,0x0F,0x00,0x07,0xC0,0x0F,0x00,
0x07,0xE0,0x0F,0x00,0x07,0xF0,0x0F,0x00,0x0F,0xF8,0x0F,0x00,0x1E,0x7C,0x0F,0x00,
0x3C,0x38,0x0F,0x00,0x78,0x00,0x0F,0x00,0xF0,0x03,0xFF,0x00,0x60,0x01,0xFE,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 微 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x01,0xE0,0x07,0x87,0x01,0xE0,
0x07,0x07,0x01,0xC0,0x0F,0xF7,0x79,0xC0,0x1E,0xF7,0x7B,0xC0,0x1E,0xF7,0x7B,0x80,
0x3C,0xF7,0x7B,0xFF,0x78,0xF7,0x7B,0xFF,0xF8,0xF7,0x7F,0x9E,0xF7,0xFF,0xFF,0x9E,
0x67,0xFF,0xFF,0x9E,0x07,0x00,0x7F,0x9C,0x0F,0x00,0x0F,0x9C,0x1E,0x00,0x1F,0x9C,
0x1E,0x7F,0xFF,0xBC,0x3E,0x7F,0xF3,0xFC,0x3E,0x00,0x03,0xFC,0x7E,0x00,0x01,0xF8,
0xFE,0x00,0x01,0xF8,0xFE,0x7F,0xE1,0xF8,0xDE,0x7F,0xE1,0xF8,0x1E,0x78,0xE0,0xF0,
0x1E,0x78,0xEE,0xF0,0x1E,0x78,0xFF,0xF0,0x1E,0x78,0xFD,0xF8,0x1E,0x79,0xFB,0xFC,
0x1E,0xF1,0xF7,0xBC,0x1E,0xF0,0xEF,0x9E,0x1F,0xE0,0x0F,0x0F,0x1E,0xC0,0x1E,0x0F,
0x1E,0x00,0x0C,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 软 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xC0,0x78,0x00,0x07,0x80,0x78,0x00,0x07,0x80,0x78,0x00,
0x07,0x80,0xF0,0x00,0x0F,0x00,0xF0,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x1E,0x03,0xC0,0x1F,0x1E,0x03,0xC0,0x1E,0x1F,0xE7,0x8F,0x3E,0x3D,0xE7,0x8F,0x3C,
0x3D,0xEF,0x0F,0x7C,0x3D,0xE7,0x0F,0x78,0x79,0xE0,0x0F,0x00,0x79,0xE0,0x0E,0x00,
0x7F,0xFE,0x0E,0x00,0x7F,0xFE,0x1F,0x00,0x01,0xE0,0x1F,0x00,0x01,0xE0,0x1F,0x00,
0x01,0xE0,0x1F,0x80,0x01,0xE0,0x1F,0x80,0x01,0xE0,0x3F,0x80,0x01,0xFF,0x3F,0xC0,
0x0F,0xFF,0x7B,0xC0,0xFF,0xF0,0x79,0xE0,0xF9,0xE0,0xF1,0xF0,0x01,0xE1,0xF0,0xF0,
0x01,0xE3,0xE0,0xF8,0x01,0xE7,0xC0,0x7C,0x01,0xFF,0x80,0x3F,0x01,0xFF,0x00,0x1F,
0x01,0xEC,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 雅 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,0x77,0x00,0x00,0x00,0xFF,0x00,
0x7F,0xFC,0xF7,0x80,0x7F,0xFD,0xE3,0xC0,0x01,0xC1,0xE3,0xC0,0x01,0xC3,0xC1,0x80,
0x3D,0xC7,0xFF,0xFF,0x39,0xC7,0xFF,0xFF,0x39,0xCF,0x83,0x80,0x79,0xDF,0x83,0x80,
0x79,0xFF,0x83,0x80,0x79,0xDF,0x83,0x80,0x71,0xC3,0x83,0x80,0x7F,0xFF,0xFF,0xFE,
0x7F,0xFF,0xFF,0xFE,0x03,0xC3,0x83,0x80,0x07,0xC3,0x83,0x80,0x07,0xC3,0x83,0x80,
0x0F,0xC3,0x83,0x80,0x0F,0xC3,0x83,0x80,0x1F,0xC3,0xFF,0xFE,0x1D,0xC3,0xFF,0xFE,
0x3D,0xC3,0x83,0x80,0x79,0xC3,0x83,0x80,0xF1,0xC3,0x83,0x80,0xF1,0xC3,0x83,0x80,
0x61,0xC3,0x83,0x80,0x01,0xC3,0xFF,0xFF,0x03,0xC3,0xFF,0xFF,0x1F,0xC3,0x80,0x00,
0x1F,0x83,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 黑 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,
0x1F,0xFF,0xFF,0xFC,0x1F,0xFF,0xFF,0xFC,0x1E,0x03,0xC0,0x3C,0x1E,0xC3,0xC7,0x3C,
0x1F,0xE3,0xC7,0xBC,0x1E,0xF3,0xCF,0x3C,0x1E,0xFB,0xDF,0x3C,0x1E,0x7B,0xDE,0x3C,
0x1E,0x33,0xDC,0x3C,0x1E,0x03,0xC0,0x3C,0x1F,0xFF,0xFF,0xFC,0x1F,0xFF,0xFF,0xFC,
0x1E,0x03,0xC0,0x3C,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x3F,0xFF,0xFF,0xFC,
0x3F,0xFF,0xFF,0xFC,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x1C,0x38,0x70,0x70,
0x3E,0x78,0xF8,0xF8,0x3C,0x7C,0x78,0x7C,0x7C,0x3C,0x3C,0x3E,0xF8,0x3E,0x3C,0x1F,
0xF0,0x1C,0x18,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 此 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,0x3C,0x00,
0x00,0x78,0x3C,0x00,0x00,0x78,0x3C,0x00,0x00,0x78,0x3C,0x00,0x00,0x78,0x3C,0x00,
0x00,0x78,0x3C,0x0C,0x3C,0x78,0x3C,0x1E,0x3C,0x78,0x3C,0x3F,0x3C,0x78,0x3C,0xF8,
0x3C,0x7F,0xFD,0xF0,0x3C,0x7F,0xFF,0xE0,0x3C,0x78,0x3F,0x80,0x3C,0x78,0x3E,0x00,
0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x00,
0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x00,0x3C,0x78,0x3C,0x0E,0x3C,0x78,0x3C,0x0F,
0x3C,0x78,0x3C,0x0F,0x3C,0x79,0xFC,0x0F,0x3C,0x7F,0xFC,0x0F,0x3F,0xFF,0x3C,0x0F,
0x3F,0xF0,0x3E,0x1E,0xFF,0x00,0x1F,0xFE,0xF0,0x00,0x0F,0xFC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 字 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x07,0x80,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xE0,0x00,0x00,0x01,0xE0,0x00,0x7F,0xFF,0xFF,0xFE,0x7F,0xFF,0xFF,0xFE,
0x78,0x00,0x00,0x1E,0x78,0x00,0x00,0x1E,0x78,0x00,0x00,0x1E,0x78,0x00,0x00,0x1E,
0x7B,0xFF,0xFF,0xDE,0x03,0xFF,0xFF,0xC0,0x00,0x00,0x0F,0xC0,0x00,0x00,0x3F,0x00,
0x00,0x00,0x7E,0x00,0x00,0x01,0xF8,0x00,0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,
0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,0x00,0x01,0xE0,0x00,
0x00,0x03,0xE0,0x00,0x00,0x03,0xC0,0x00,0x00,0xFF,0xC0,0x00,0x00,0xFF,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 体 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,0x03,0xC0,0x3C,0x00,
0x03,0xC0,0x3C,0x00,0x03,0xC0,0x3C,0x00,0x07,0x80,0x3C,0x00,0x07,0x80,0x3C,0x00,
0x07,0x80,0x3C,0x00,0x0F,0xFF,0xFF,0xFF,0x0F,0xFF,0xFF,0xFF,0x1F,0x01,0xFE,0x00,
0x1F,0x01,0xFF,0x00,0x3F,0x01,0xFF,0x00,0x3F,0x03,0xFF,0x00,0x7F,0x03,0xFF,0x80,
0x7F,0x07,0xBF,0x80,0xFF,0x07,0xBF,0xC0,0xEF,0x0F,0x3D,0xC0,0xCF,0x0F,0x3D,0xE0,
0x0F,0x1E,0x3D,0xE0,0x0F,0x1E,0x3C,0xF0,0x0F,0x3C,0x3C,0x78,0x0F,0x7C,0x3C,0x7C,
0x0F,0xF8,0x3C,0x3E,0x0F,0xF7,0xFF,0xDF,0x0F,0xE7,0xFF,0xCF,0x0F,0xC0,0x3C,0x06,
0x0F,0x00,0x3C,0x00,0x0F,0x00,0x3C,0x00,0x0F,0x00,0x3C,0x00,0x0F,0x00,0x3C,0x00,
0x0F,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 下 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
0x00,0x0F,0xE0,0x00,0x00,0x0F,0xF8,0x00,0x00,0x0F,0xFC,0x00,0x00,0x0F,0xBF,0x00,
0x00,0x0F,0x9F,0x80,0x00,0x0F,0x87,0xE0,0x00,0x0F,0x83,0xF0,0x00,0x0F,0x80,0xF8,
0x00,0x0F,0x80,0x7C,0x00,0x0F,0x80,0x38,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,0x00,0x0F,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 对 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,0x7F,0xFC,0x00,0x78,0x7F,0xFC,0x00,0x78,
0x00,0x3C,0x00,0x78,0x00,0x3F,0xFF,0xFF,0x30,0x3F,0xFF,0xFF,0x78,0x3C,0x00,0x78,
0x3C,0x38,0x00,0x78,0x3E,0x78,0x00,0x78,0x1E,0x78,0xC0,0x78,0x0F,0x79,0xE0,0x78,
0x0F,0xF0,0xF0,0x78,0x07,0xF0,0xF8,0x78,0x03,0xF0,0x78,0x78,0x01,0xE0,0x3C,0x78,
0x03,0xF0,0x3E,0x78,0x03,0xF0,0x18,0x78,0x07,0xF8,0x00,0x78,0x07,0xFC,0x00,0x78,
0x0F,0x3E,0x00,0x78,0x1F,0x1E,0x00,0x78,0x3E,0x1F,0x00,0x78,0x7C,0x0E,0x00,0xF8,
0xF8,0x00,0x00,0xF0,0xF0,0x00,0x3F,0xF0,0x60,0x00,0x3F,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}},
/*-- 文字: 应 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x03,0xE0,0x00,0x00,0x01,0xE0,0x00,
0x00,0x01,0xF0,0x00,0x00,0x00,0xF0,0x00,0x1F,0xFF,0xFF,0xFF,0x1F,0xFF,0xFF,0xFF,
0x1E,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x1E,0x01,0xE0,0x78,0x1E,0x01,0xE0,0x78,
0x1E,0xE1,0xE0,0x78,0x1F,0xF1,0xF0,0xF8,0x1E,0xF0,0xF0,0xF0,0x1E,0xF0,0xF0,0xF0,
0x1E,0xF8,0xF0,0xF0,0x1E,0x78,0xF1,0xF0,0x1E,0x78,0xF9,0xE0,0x1E,0x78,0x79,0xE0,
0x1E,0x7C,0x7B,0xE0,0x1E,0x3C,0x7B,0xC0,0x1E,0x3C,0x7B,0xC0,0x1E,0x3C,0x7B,0xC0,
0x3C,0x3E,0x07,0x80,0x3C,0x1C,0x07,0x80,0x3C,0x00,0x07,0x80,0x3C,0x00,0x0F,0x00,
0x78,0x00,0x0F,0x00,0x7B,0xFF,0xFF,0xFF,0xF3,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,
0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 的 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x3C,0x00,0x07,0xC0,0x3E,0x00,
0x07,0x80,0x3C,0x00,0x07,0x80,0x7C,0x00,0x0F,0x00,0x78,0x00,0x7F,0xFE,0x7F,0xFE,
0x7F,0xFE,0xFF,0xFE,0x78,0x1E,0xF0,0x1E,0x78,0x1F,0xE0,0x1E,0x78,0x1F,0xE0,0x1E,
0x78,0x1F,0xC0,0x1E,0x78,0x1F,0xC0,0x1E,0x78,0x1F,0xF0,0x1E,0x78,0x1E,0xF8,0x1E,
0x78,0x1E,0x7C,0x1E,0x7F,0xFE,0x3C,0x1E,0x7F,0xFE,0x1E,0x1E,0x78,0x1E,0x1F,0x1E,
0x78,0x1E,0x0F,0x9E,0x78,0x1E,0x07,0x9E,0x78,0x1E,0x07,0x1E,0x78,0x1E,0x00,0x1E,
0x78,0x1E,0x00,0x1E,0x78,0x1E,0x00,0x3E,0x78,0x1E,0x00,0x3C,0x78,0x1E,0x00,0x3C,
0x7F,0xFE,0x00,0x3C,0x7F,0xFE,0x00,0x7C,0x78,0x1E,0x3F,0xF8,0x78,0x1E,0x3F,0xF0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 点 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xFF,0xFF,0x00,0x03,0xFF,0xFF,
0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x0F,0xFF,0xFF,0xF8,0x0F,0xFF,0xFF,0xF8,0x0F,0x00,0x00,0x78,0x0F,0x00,0x00,0x78,
0x0F,0x00,0x00,0x78,0x0F,0x00,0x00,0x78,0x0F,0x00,0x00,0x78,0x0F,0x00,0x00,0x78,
0x0F,0xFF,0xFF,0xF8,0x0F,0xFF,0xFF,0xF8,0x0F,0x00,0x00,0x78,0x00,0x00,0x00,0x00,
0x0C,0x38,0x38,0x30,0x1E,0x7C,0x78,0x78,0x3E,0x3C,0x78,0x78,0x3C,0x3C,0x3C,0x3C,
0x7C,0x3E,0x3C,0x3E,0xF8,0x1E,0x3C,0x1E,0xF0,0x1E,0x1E,0x1F,0x70,0x1E,0x1C,0x0E,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 阵 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,0x3C,0x00,0x00,0x00,0x78,0x00,
0x7F,0xF0,0x78,0x00,0x7F,0xF0,0x78,0x00,0x79,0xFF,0xFF,0xFF,0x79,0xFF,0xFF,0xFF,
0x79,0xE1,0xE0,0x00,0x79,0xE1,0xE0,0x00,0x7B,0xC1,0xEF,0x80,0x7B,0xC3,0xCF,0x80,
0x7B,0xC3,0xCF,0x80,0x7F,0x87,0xCF,0x80,0x7F,0x87,0x8F,0x80,0x7F,0x87,0x8F,0x80,
0x7B,0xCF,0x0F,0x80,0x7B,0xCF,0xFF,0xFE,0x79,0xEF,0xFF,0xFE,0x79,0xE0,0x0F,0x80,
0x78,0xE0,0x0F,0x80,0x78,0xF0,0x0F,0x80,0x78,0xF0,0x0F,0x80,0x78,0xF0,0x0F,0x80,
0x78,0xFF,0xFF,0xFF,0x79,0xFF,0xFF,0xFF,0x7F,0xE0,0x0F,0x80,0x7F,0xC0,0x0F,0x80,
0x78,0x00,0x0F,0x80,0x78,0x00,0x0F,0x80,0x78,0x00,0x0F,0x80,0x78,0x00,0x0F,0x80,
0x78,0x00,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 为 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,0x80,0x00,
0x0E,0x07,0x80,0x00,0x1F,0x07,0x80,0x00,0x0F,0x87,0x80,0x00,0x07,0xC7,0x80,0x00,
0x01,0xE7,0x80,0x00,0x00,0xC7,0x80,0x00,0x00,0x07,0x80,0x00,0x7F,0xFF,0xFF,0xFC,
0x7F,0xFF,0xFF,0xFC,0x00,0x07,0x80,0x3C,0x00,0x0F,0x80,0x3C,0x00,0x0F,0x00,0x3C,
0x00,0x0F,0x00,0x3C,0x00,0x0F,0x60,0x3C,0x00,0x1F,0xF0,0x3C,0x00,0x1E,0x78,0x3C,
0x00,0x3E,0x3C,0x3C,0x00,0x3C,0x3E,0x3C,0x00,0x7C,0x1F,0x3C,0x00,0x78,0x0F,0x3C,
0x00,0xF8,0x06,0x3C,0x01,0xF0,0x00,0x3C,0x03,0xE0,0x00,0x7C,0x07,0xC0,0x00,0x7C,
0x0F,0x80,0x00,0x78,0x1F,0x00,0x00,0xF8,0x3E,0x00,0xFF,0xF0,0x7C,0x00,0xFF,0xE0,
0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 树 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,0x0F,0x00,0x00,0x38,
0x0F,0x00,0x00,0x38,0x0F,0x00,0x00,0x38,0x0F,0x3F,0xF8,0x38,0x0F,0x3F,0xF8,0x38,
0x0F,0x00,0x78,0x38,0xFF,0xE0,0x7F,0xFF,0xFF,0xE0,0x7F,0xFF,0x0F,0x00,0x70,0x38,
0x0F,0x18,0xF0,0x38,0x1F,0x3C,0xF0,0x38,0x1F,0x1C,0xFE,0x38,0x1F,0xDE,0xFE,0x38,
0x3F,0xEF,0xEF,0x38,0x3F,0xFF,0xEF,0x38,0x3F,0xF7,0xE7,0xB8,0x7F,0x67,0xC7,0xB8,
0x7F,0x03,0xC3,0xB8,0xFF,0x07,0xE0,0x38,0xEF,0x07,0xE0,0x38,0xEF,0x0F,0xF0,0x38,
0xCF,0x1F,0xF0,0x38,0x0F,0x1E,0x78,0x38,0x0F,0x3C,0x7C,0x38,0x0F,0x78,0x3C,0x38,
0x0F,0xF8,0x38,0x38,0x0F,0x60,0x00,0x78,0x0F,0x00,0x0F,0xF8,0x0F,0x00,0x07,0xF0,
0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 莓 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,0x3C,0x1E,0x00,0x00,0x3C,0x1E,0x00,
0x00,0x3C,0x1E,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x3C,0x1E,0x00,
0x07,0xBC,0x1E,0x00,0x07,0x80,0x00,0x00,0x0F,0xFF,0xFF,0xFC,0x0F,0xFF,0xFF,0xFC,
0x1E,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xF0,
0xF7,0xFF,0xFF,0xF0,0x37,0x83,0x80,0xF0,0x07,0x87,0xC0,0xF0,0x07,0x83,0xF0,0xF0,
0x07,0x00,0xE0,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x0F,0x00,0xE0,
0x0F,0x0F,0x81,0xE0,0x0E,0x03,0xE1,0xE0,0x1E,0x01,0xC1,0xE0,0x1F,0xFF,0xFF,0xFE,
0x1F,0xFF,0xFF,0xFE,0x00,0x00,0x01,0xE0,0x00,0x00,0x03,0xC0,0x00,0x00,0xFF,0xC0,
0x00,0x00,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 派 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,0x38,0x00,0x00,0x3E,
0x7C,0x00,0x3F,0xFE,0x3F,0x3F,0xFF,0xF0,0x1F,0xBF,0xE0,0x00,0x07,0xBC,0x00,0x00,
0x03,0x3C,0x00,0x00,0x00,0x3C,0x00,0x3C,0x00,0x3C,0x0F,0xFE,0x70,0x3D,0xFF,0xF8,
0xF8,0x3D,0xFF,0x00,0x7C,0x3D,0xE7,0x80,0x3F,0x3D,0xE7,0x80,0x1F,0x3D,0xE7,0x8E,
0x0E,0x3D,0xE7,0x9F,0x00,0x3D,0xE7,0xFE,0x00,0x39,0xE7,0xF8,0x00,0x39,0xE3,0xF0,
0x1C,0x39,0xE3,0xC0,0x1E,0x79,0xE3,0xC0,0x1E,0x79,0xE1,0xE0,0x1E,0x79,0xE1,0xE0,
0x3C,0x79,0xE0,0xF0,0x3C,0x79,0xE0,0xF8,0x3C,0xF1,0xE0,0x7C,0x3C,0xF1,0xE3,0x7C,
0x7D,0xF1,0xEF,0x3F,0x79,0xE1,0xFE,0x1F,0x7B,0xE1,0xF8,0x0E,0x7B,0xC3,0xE0,0x00,
0x79,0x81,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: A --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{
"A"},{
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,0x7C,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xFE,0x00,0x00,
0x01,0xFF,0x00,0x00,0x01,0xFF,0x00,0x00,0x01,0xEF,0x00,0x00,0x03,0xEF,0x80,0x00,
0x03,0xCF,0x80,0x00,0x07,0xC7,0x80,0x00,0x07,0xC7,0xC0,0x00,0x07,0x87,0xC0,0x00,
0x0F,0x83,0xE0,0x00,0x0F,0x83,0xE0,0x00,0x0F,0x01,0xE0,0x00,0x1F,0xFF,0xF0,0x00,
0x1F,0xFF,0xF0,0x00,0x3F,0xFF,0xF8,0x00,0x3E,0x00,0xF8,0x00,0x3C,0x00,0xF8,0x00,
0x7C,0x00,0x7C,0x00,0x7C,0x00,0x7C,0x00,0x78,0x00,0x3C,0x00,0xF8,0x00,0x3E,0x00,
0xF8,0x00,0x3E,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}},
/*-- 文字: a --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{"a"},{
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,0x07,0xF8,0x00,0x00,
0x1F,0xFE,0x00,0x00,0x3F,0xFE,0x00,0x00,0x3E,0x3F,0x00,0x00,0x38,0x1F,0x00,0x00,
0x00,0x0F,0x00,0x00,0x00,0x0F,0x00,0x00,0x03,0xFF,0x00,0x00,0x1F,0xFF,0x00,0x00,
0x3F,0x8F,0x00,0x00,0x7C,0x0F,0x00,0x00,0x7C,0x0F,0x00,0x00,0x78,0x1F,0x00,0x00,
0x7C,0x1F,0x00,0x00,0x7E,0x7F,0x00,0x00,0x7F,0xFF,0x00,0x00,0x3F,0xFF,0x00,0x00,
0x0F,0xCF,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}},
/*-- 文字: b --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{"b"},{
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,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,0x3C,0xFE,0x00,0x00,
0x3D,0xFF,0x80,0x00,0x3F,0xFF,0xC0,0x00,0x3F,0x8F,0xC0,0x00,0x3F,0x07,0xE0,0x00,
0x3E,0x03,0xE0,0x00,0x3E,0x03,0xE0,0x00,0x3C,0x01,0xE0,0x00,0x3C,0x01,0xE0,0x00,
0x3C,0x01,0xE0,0x00,0x3C,0x03,0xE0,0x00,0x3E,0x03,0xE0,0x00,0x3E,0x03,0xE0,0x00,
0x3F,0x07,0xC0,0x00,0x3F,0x8F,0xC0,0x00,0x3F,0xFF,0x80,0x00,0x3F,0xFF,0x00,0x00,
0x3C,0xFC,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}},
/*-- 文字: c --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{"c"},{
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,0x01,0xFC,0x00,0x00,
0x07,0xFE,0x00,0x00,0x1F,0xFE,0x00,0x00,0x3F,0x86,0x00,0x00,0x3E,0x00,0x00,0x00,
0x7C,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x78,0x00,0x00,0x00,
0x78,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,
0x3E,0x00,0x00,0x00,0x3F,0x86,0x00,0x00,0x1F,0xFE,0x00,0x00,0x0F,0xFE,0x00,0x00,
0x03,0xFC,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}},
/*-- 文字: 微 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x01,0xE0,0x07,0x87,0x01,0xE0,
0x07,0x07,0x01,0xC0,0x0F,0xF7,0x79,0xC0,0x1E,0xF7,0x7B,0xC0,0x1E,0xF7,0x7B,0x80,
0x3C,0xF7,0x7B,0xFF,0x78,0xF7,0x7B,0xFF,0xF8,0xF7,0x7F,0x9E,0xF7,0xFF,0xFF,0x9E,
0x67,0xFF,0xFF,0x9E,0x07,0x00,0x7F,0x9C,0x0F,0x00,0x0F,0x9C,0x1E,0x00,0x1F,0x9C,
0x1E,0x7F,0xFF,0xBC,0x3E,0x7F,0xF3,0xFC,0x3E,0x00,0x03,0xFC,0x7E,0x00,0x01,0xF8,
0xFE,0x00,0x01,0xF8,0xFE,0x7F,0xE1,0xF8,0xDE,0x7F,0xE1,0xF8,0x1E,0x78,0xE0,0xF0,
0x1E,0x78,0xEE,0xF0,0x1E,0x78,0xFF,0xF0,0x1E,0x78,0xFD,0xF8,0x1E,0x79,0xFB,0xFC,
0x1E,0xF1,0xF7,0xBC,0x1E,0xF0,0xEF,0x9E,0x1F,0xE0,0x0F,0x0F,0x1E,0xC0,0x1E,0x0F,
0x1E,0x00,0x0C,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 雪 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,
0x1F,0xFF,0xFF,0xF8,0x1F,0xFF,0xFF,0xF8,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x7F,0xFF,0xFF,0xFE,0x7F,0xFF,0xFF,0xFE,0x78,0x03,0xC0,0x1E,0x78,0x03,0xC0,0x1E,
0x7F,0xFF,0xFF,0xFE,0x7F,0xFF,0xFF,0xFE,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
0x07,0xFF,0xFF,0xE0,0x07,0xFF,0xFF,0xE0,0x00,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,
0x1F,0xFF,0xFF,0xF8,0x1F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,
0x1F,0xFF,0xFF,0xF8,0x1F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x78,
0x00,0x00,0x00,0x78,0x3F,0xFF,0xFF,0xF8,0x3F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x78,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 电 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,0x80,0x00,0x00,0x07,0x80,0x00,
0x00,0x07,0x80,0x00,0x00,0x07,0x80,0x00,0x7F,0xFF,0xFF,0xF8,0x7F,0xFF,0xFF,0xF8,
0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,
0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x7F,0xFF,0xFF,0xF8,0x7F,0xFF,0xFF,0xF8,
0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,
0x78,0x07,0x80,0xF8,0x78,0x07,0x80,0xF8,0x7F,0xFF,0xFF,0xF8,0x7F,0xFF,0xFF,0xF8,
0x78,0x07,0x80,0x0E,0x78,0x07,0x80,0x0F,0x00,0x07,0x80,0x0F,0x00,0x07,0x80,0x0F,
0x00,0x07,0x80,0x1F,0x00,0x07,0x80,0x1E,0x00,0x03,0xFF,0xFE,0x00,0x01,0xFF,0xFC,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
/*-- 文字: 子 --*/
/*-- 微软雅黑24; 此字体下对应的点阵为宽x高=32x41 --*/
{{""},{
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,
0x1F,0xFF,0xFF,0xF8,0x1F,0xFF,0xFF,0xF8,0x00,0x00,0x01,0xF8,0x00,0x00,0x07,0xE0,
0x00,0x00,0x0F,0xC0,0x00,0x00,0x1F,0x80,0x00,0x00,0x3E,0x00,0x00,0x00,0xFC,0x00,
0x00,0x01,0xF8,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,
0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,
0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,0x00,0x03,0xE0,0x00,
0x00,0x03,0xE0,0x00,0x00,0x03,0xC0,0x00,0x01,0xFF,0xC0,0x00,0x00,0xFF,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}},
};
cFONT Font24CN = {
Font24CN_Table,
sizeof(Font24CN_Table)/sizeof(CH_CN), /*size of table*/
24, /* ASCII Width */
32, /* Width */
41, /* Height */
};
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,97 @@
/**
******************************************************************************
* @file fonts.h
* @author MCD Application Team
* @version V1.0.0
* @date 18-February-2014
* @brief Header for fonts.c file
******************************************************************************
* @attention
*
* <h2><center>&copy; 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
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>΢<EFBFBD><CEA2><EFBFBD>ź<EFBFBD>24 (32x41) */
#define MAX_HEIGHT_FONT 41
#define MAX_WIDTH_FONT 32
#define OFFSET_BITMAP
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
//ASCII
typedef struct _tFont
{
const uint8_t *table;
uint16_t Width;
uint16_t Height;
} sFONT;
//GB2312
typedef struct // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>ݽṹ
{
const char index[2]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
const char matrix[MAX_HEIGHT_FONT*MAX_WIDTH_FONT/8+2]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}CH_CN;
typedef struct
{
const CH_CN *table;
uint16_t size;
uint16_t ASCII_Width;
uint16_t Width;
uint16_t Height;
}cFONT;
extern sFONT Font24;
extern sFONT Font20;
extern sFONT Font16;
extern sFONT Font12;
extern sFONT Font8;
extern cFONT Font12CN;
extern cFONT Font24CN;
#ifdef __cplusplus
}
#endif
#endif /* __FONTS_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -0,0 +1,425 @@
/*****************************************************************************
* | File : GUI_BMPfile.c
* | Author : Waveshare team
* | Function : Hardware underlying interface
* | Info :
* Used to shield the underlying layers of each master
* and enhance portability
*----------------
* | This version: V2.0
* | Date : 2018-11-12
* | Info :
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
* 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "GUI_BMPfile.h"
#include "GUI_Paint.h"
#include "../Config/Debug.h"
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include <stdlib.h>//exit()
#include <string.h>//memset()
#include <math.h>//memset()
#include <stdio.h>
//global variables related to BMP picture display
UBYTE *bmp_dst_buf = NULL;
UBYTE *bmp_src_buf = NULL;
UDOUBLE bmp_width, bmp_height;
UBYTE bmp_BitCount;
UDOUBLE bytesPerLine;
UDOUBLE imageSize;
UDOUBLE skip;
BMPRGBQUAD palette[256];
extern UBYTE isColor;
static void Bitmap_format_Matrix(UBYTE *dst,UBYTE *src)
{
UDOUBLE i,j,k;
UBYTE *psrc = src;
UBYTE *pdst = dst;
UBYTE *p = psrc;
UBYTE temp;
UDOUBLE count;
//Since the bmp storage is from the back to the front, it needs to be converted in reverse order.
switch(bmp_BitCount)
{
case 1:
pdst += (bmp_width * bmp_height);
for(i=0;i<bmp_height;i++)
{
pdst -= bmp_width;
count = 0;
for (j=0;j<(bmp_width+7)/8;j++)
{
temp = p[j];
for (k=0;k<8;k++)
{
pdst[0]= ((temp & (0x80>>k)) >> (7-k));
count++;
pdst++;
if (count == bmp_width)
{
break;
}
}
}
pdst -= bmp_width;
p += bytesPerLine;
}
break;
case 4:
pdst += (bmp_width * bmp_height);
for(i=0;i<bmp_height;i++)
{
pdst -= bmp_width;
count = 0;
for (j=0;j<(bmp_width+1)/2;j++)
{
temp = p[j];
pdst[0]= ((temp & 0xf0) >> 4);
count++;
pdst++;
if (count == bmp_width)
{
break;
}
pdst[0] = temp & 0x0f;
count++;
pdst++;
if (count == bmp_width)
{
break;
}
}
pdst -= bmp_width;
p += bytesPerLine;
}
break;
case 8:
pdst += (bmp_width*bmp_height);
for(i=0;i<bmp_height;i++)
{
p = psrc+(i+1)*bytesPerLine;
p -= skip;
for(j=0;j<bmp_width;j++)
{
pdst -= 1;
p -= 1;
pdst[0] = p[0];
}
}
break;
case 16:
pdst += (bmp_width*bmp_height*2);
for(i=0;i<bmp_height;i++)
{
p = psrc+(i+1)*bytesPerLine;
p -= skip;
for(j=0;j<bmp_width;j++)
{
pdst -= 2;
p -= 2;
pdst[0] = p[1];
pdst[1] = p[0];
}
}
break;
case 24:
pdst += (bmp_width*bmp_height*3);
for(i=0;i<bmp_height;i++)
{
p = psrc+(i+1)*bytesPerLine;
p -= skip;
for(j=0;j<bmp_width;j++)
{
pdst -= 3;
p -= 3;
pdst[0] = p[2];
pdst[1] = p[1];
pdst[2] = p[0];
}
}
break;
case 32:
pdst += (bmp_width*bmp_height*4);
for(i=0;i<bmp_height;i++)
{
p = psrc+(i+1)*bmp_width*4;
for(j=0;j<bmp_width;j++)
{
pdst -= 4;
p -= 4;
pdst[0] = p[2];
pdst[1] = p[1];
pdst[2] = p[0];
pdst[3] = p[3];
}
}
break;
default:
break;
}
}
static void DrawMatrix(UWORD Xpos, UWORD Ypos,UWORD Width, UWORD High,const UBYTE* Matrix)
{
UWORD i,j,x,y;
UBYTE R,G,B;
UBYTE temp1,temp2;
double Gray;
for (y=0,j=Ypos;y<High;y++,j++)
{
for (x=0,i=Xpos;x<Width;x++,i++)
{
switch(bmp_BitCount)
{
case 1:
case 4:
case 8:
R = palette[Matrix[(y*Width+x)]].rgbRed;
G = palette[Matrix[(y*Width+x)]].rgbGreen;
B = palette[Matrix[(y*Width+x)]].rgbBlue;
break;
case 16:
temp1 = Matrix[(y*Width+x)*2];
temp2 = Matrix[(y*Width+x)*2+1];
R = (temp1 & 0x7c)<<1;
G = (((temp1 & 0x03) << 3 ) | ((temp2&0xe0) >> 5))<<3;
B = (temp2 & 0x1f)<<3;
break;
case 24:
R = Matrix[(y*Width+x)*3];
G = Matrix[(y*Width+x)*3+1];
B = Matrix[(y*Width+x)*3+2];
break;
case 32:
R = Matrix[(y*Width+x)*4];
G = Matrix[(y*Width+x)*4+1];
B = Matrix[(y*Width+x)*4+2];
break;
default:
break;
}
Gray = (R*299 + G*587 + B*114 + 500) / 1000;
if(isColor && i%3==2)
Paint_SetPixel(i, j, Gray/2);
else
Paint_SetPixel(i, j, Gray);
}
}
}
UBYTE GUI_ReadBmp(const char *path, UWORD x, UWORD y)
{
//bmp file pointer
FILE *fp;
BMPFILEHEADER FileHead;
BMPINFOHEADER InfoHead;
UDOUBLE total_length;
UBYTE *buf = NULL;
UDOUBLE ret = -1;
fp = fopen(path,"rb");
if (fp == NULL)
{
return(-1);
}
ret = fread(&FileHead, sizeof(BMPFILEHEADER),1, fp);
if (ret != 1)
{
Debug("Read header error!\n");
fclose(fp);
return(-2);
}
//Detect if it is a bmp image, since BMP file type is "BM"(0x4D42)
if (FileHead.bType != 0x4D42)
{
Debug("It's not a BMP file\n");
fclose(fp);
return(-3);
}
Debug("*****************************************\n");
Debug("BMP_bSize:%d \n", FileHead.bSize);
Debug("BMP_bOffset:%d \n", FileHead.bOffset);
ret = fread((char *)&InfoHead, sizeof(BMPINFOHEADER),1, fp);
if (ret != 1)
{
Debug("Read infoheader error!\n");
fclose(fp);
return(-4);
}
Debug("BMP_biInfoSize:%d \n", InfoHead.biInfoSize);
Debug("BMP_biWidth:%d \n", InfoHead.biWidth);
Debug("BMP_biHeight:%d \n", InfoHead.biHeight);
Debug("BMP_biPlanes:%d \n", InfoHead.biPlanes);
Debug("BMP_biBitCount:%d \n", InfoHead.biBitCount);
Debug("BMP_biCompression:%d \n", InfoHead.biCompression);
Debug("BMP_bimpImageSize:%d \n", InfoHead.bimpImageSize);
Debug("BMP_biXPelsPerMeter:%d \n", InfoHead.biXPelsPerMeter);
Debug("BMP_biYPelsPerMeter:%d \n", InfoHead.biYPelsPerMeter);
Debug("BMP_biClrUsed:%d \n", InfoHead.biClrUsed);
Debug("BMP_biClrImportant:%d \n", InfoHead.biClrImportant);
total_length = FileHead.bSize-FileHead.bOffset;
bytesPerLine=((InfoHead.biWidth*InfoHead.biBitCount+31)>>5)<<2;
imageSize=bytesPerLine*InfoHead.biHeight;
skip=(4-((InfoHead.biWidth*InfoHead.biBitCount)>>3))&3;
Debug("bimpImageSize:%d\n", InfoHead.bimpImageSize);
Debug("total_length:%d\n", total_length);
Debug("bytesPerLine = %d\n", bytesPerLine);
Debug("imageSize = %d\n", imageSize);
Debug("skip = %d\n", skip);
Debug("*****************************************\n");
bmp_width = InfoHead.biWidth;
bmp_height = InfoHead.biHeight;
bmp_BitCount = InfoHead.biBitCount;
//This is old code, but allocate imageSize byte memory is more reasonable
bmp_src_buf = (UBYTE*)calloc(1,total_length);
//bmp_src_buf = (UBYTE*)calloc(1,imageSize);
if(bmp_src_buf == NULL){
Debug("Load > malloc bmp out of memory!\n");
return -1;
}
//This is old code, but allocate imageSize byte memory is more reasonable
bmp_dst_buf = (UBYTE*)calloc(1,total_length);
//bmp_dst_buf = (UBYTE*)calloc(1,imageSize);
if(bmp_dst_buf == NULL){
Debug("Load > malloc bmp out of memory!\n");
return -2;
}
//Jump to data area
fseek(fp, FileHead.bOffset, SEEK_SET);
//Bytes per line
buf = bmp_src_buf;
while ((ret = fread(buf,1,total_length,fp)) >= 0)
{
if (ret == 0)
{
DEV_Delay_us(100);
continue;
}
buf = ((UBYTE*)buf) + ret;
total_length = total_length - ret;
if(total_length == 0)
break;
}
//Jump to color pattern board
switch(bmp_BitCount)
{
case 1:
fseek(fp, 54, SEEK_SET);
ret = fread(palette,1,4*2,fp);
if (ret != 8)
{
Debug("Error: fread != 8\n");
return -5;
}
//this is old code, will likely result in memory leak if use 1bp source bmp image
bmp_dst_buf = (UBYTE*)calloc(1,InfoHead.biWidth * InfoHead.biHeight);
if(bmp_dst_buf == NULL)
{
Debug("Load > malloc bmp out of memory!\n");
return -5;
}
break;
case 4:
fseek(fp, 54, SEEK_SET);
ret = fread(palette,1,4*16,fp);
if (ret != 64)
{
Debug("Error: fread != 64\n");
return -5;
}
//this is old code, will likely result in memory leak if use 4bp source bmp image
bmp_dst_buf = (UBYTE*)calloc(1,InfoHead.biWidth * InfoHead.biHeight);
if(bmp_dst_buf == NULL)
{
Debug("Load > malloc bmp out of memory!\n");
return -5;
}
break;
case 8:
fseek(fp, 54, SEEK_SET);
ret = fread(palette,1,4*256,fp);
if (ret != 1024)
{
Debug("Error: fread != 1024\n");
return -5;
}
break;
default:
break;
}
Bitmap_format_Matrix(bmp_dst_buf,bmp_src_buf);
DrawMatrix(x, y,InfoHead.biWidth, InfoHead.biHeight, bmp_dst_buf);
free(bmp_src_buf);
free(bmp_dst_buf);
bmp_src_buf = NULL;
bmp_dst_buf = NULL;
fclose(fp);
return(0);
}

View File

@ -0,0 +1,87 @@
/*****************************************************************************
* | File : GUI_BMPfile.h
* | Author : Waveshare team
* | Function : Hardware underlying interface
* | Info :
* Used to shield the underlying layers of each master
* and enhance portability
*----------------
* | This version: V2.0
* | Date : 2018-11-12
* | Info :
* 1.Change file name: GUI_BMP.h -> GUI_BMPfile.h
* 2.fix: GUI_ReadBmp()
* Now Xstart and Xstart can control the position of the picture normally,
* and support the display of images of any size. If it is larger than
* the actual display range, it will not be displayed.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#ifndef __GUI_BMPFILE_H
#define __GUI_BMPFILE_H
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include "../Config/DEV_Config.h"
extern UBYTE *bmp_dst_buf;
extern UBYTE *bmp_src_buf;
/*Bitmap file header 14bit*/
typedef struct
{
UWORD bType; //File identifier, as for bmp is:0x4D42
UDOUBLE bSize; //The size of the file
UWORD brgbReversed1; //rgbReversed value, must be set to 0
UWORD brgbReversed2; //rgbReversed value, must be set to 0
UDOUBLE bOffset; //The offset from the beginning of the file header to the beginning of the image data bit
}__attribute__((packed)) BMPFILEHEADER; //Tell the compiler to cancel optimal alignment of the structure during compilation
/*Bitmap information header 40bit*/
typedef struct
{
UDOUBLE biInfoSize; //The size of the header: 40
UDOUBLE biWidth; //The width of the image
UDOUBLE biHeight; //The height of the image
UWORD biPlanes; //The number of target planes in the image
UWORD biBitCount; //The number of bits per pixel
UDOUBLE biCompression; //Compression type
UDOUBLE bimpImageSize; //The size of the image in bytes. The data must be a multiple of 4.
UDOUBLE biXPelsPerMeter; //Number of horizontal pixel of the target device per meter
UDOUBLE biYPelsPerMeter; //Number of vertical pixel of the target device per meter
UDOUBLE biClrUsed; //Number of colors for bitmap used in color palette
UDOUBLE biClrImportant; //Specifies the number of important colors. When the value of this field is equal to the number of colors (or equal to 0), it means that all colors are equally important.
}__attribute__((packed)) BMPINFOHEADER;//Tell the compiler to cancel optimal alignment of the structure during compilation
typedef struct
{
UBYTE rgbBlue; //rgbBlue intensity
UBYTE rgbGreen; //rgbGreen intensity
UBYTE rgbRed; //rgbRed intensity
UBYTE rgbReversed; //rgbReversed value
}__attribute__((packed)) BMPRGBQUAD;//Tell the compiler to cancel optimal alignment of the structure during compilation
UBYTE GUI_ReadBmp(const char *path, UWORD x, UWORD y);
#endif

View File

@ -0,0 +1,776 @@
/******************************************************************************
* | File : GUI_Paint.c
* | Author : Waveshare electronics
* | Function : Achieve drawing: draw points, lines, boxes, circles and
* their size, solid dotted line, solid rectangle hollow
* rectangle, solid circle hollow circle.
* | Info :
* Achieve display characters: Display a single character, string, number
* Achieve time display: adaptive size display time minutes and seconds
*----------------
* | This version: V3.0
* | Date : 2019-04-18
* | Info :
* -----------------------------------------------------------------------------
* V3.0(2019-04-18):
* 1.Change:
* Paint_DrawPoint(..., DOT_STYLE DOT_STYLE)
* => Paint_DrawPoint(..., DOT_STYLE Dot_Style)
* Paint_DrawLine(..., LINE_STYLE Line_Style, DOT_PIXEL Dot_Pixel)
* => Paint_DrawLine(..., DOT_PIXEL Line_width, LINE_STYLE Line_Style)
* Paint_DrawRectangle(..., DRAW_FILL Filled, DOT_PIXEL Dot_Pixel)
* => Paint_DrawRectangle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
* Paint_DrawCircle(..., DRAW_FILL Draw_Fill, DOT_PIXEL Dot_Pixel)
* => Paint_DrawCircle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Filll)
*
* -----------------------------------------------------------------------------
* V2.0(2018-11-15):
* 1.add: Paint_NewImage()
* Create an image's properties
* 2.add: Paint_SelectImage()
* Select the picture to be drawn
* 3.add: Paint_SetRotate()
* Set the direction of the cache
* 4.add: Paint_RotateImage()
* Can flip the picture, Support 0-360 degrees,
* but only 90.180.270 rotation is better
* 4.add: Paint_SetMirroring()
* Can Mirroring the picture, horizontal, vertical, origin
* 5.add: Paint_DrawString_CN()
* Can display Chinese(GB1312)
*
* -----------------------------------------------------------------------------
* V1.0(2018-07-17):
* Create library
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documnetation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
******************************************************************************/
#include "GUI_Paint.h"
#include "../Config/Debug.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h> //memset()
#include <math.h>
PAINT Paint;
UBYTE isColor = 0;
/******************************************************************************
function: Create Image
parameter:
image : Pointer to the image cache
width : The width of the picture
Height : The height of the picture
Color : Whether the picture is inverted
******************************************************************************/
void Paint_NewImage(UBYTE *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color)
{
Paint.Image = NULL;
Paint.Image = image;
Paint.WidthMemory = Width;
Paint.HeightMemory = Height;
Paint.Color = Color;
Paint.BitsPerPixel = 8;
Paint.GrayScale = pow(2, Paint.BitsPerPixel);
Paint.WidthByte = Width;
Paint.HeightByte = Height;
Paint.Rotate = Rotate;
Paint.Mirror = MIRROR_NONE;
if(Rotate == ROTATE_0 || Rotate == ROTATE_180) {
Paint.Width = Width;
Paint.Height = Height;
} else {
Paint.Width = Height;
Paint.Height = Width;
}
}
/******************************************************************************
function: Select Image
parameter:
image : Pointer to the image cache
******************************************************************************/
void Paint_SelectImage(UBYTE *image)
{
Paint.Image = image;
}
/******************************************************************************
function: Select Image Rotate
parameter:
Rotate : 0,90,180,270
******************************************************************************/
void Paint_SetRotate(UWORD Rotate)
{
if(Rotate == ROTATE_0 || Rotate == ROTATE_90 || Rotate == ROTATE_180 || Rotate == ROTATE_270) {
Debug("Set image Rotate %d\r\n", Rotate);
Paint.Rotate = Rotate;
} else {
Debug("rotate = 0, 90, 180, 270\r\n");
}
}
/******************************************************************************
function: Select Image mirror
parameter:
mirror :Not mirror,Horizontal mirror,Vertical mirror,Origin mirror
******************************************************************************/
void Paint_SetMirroring(UBYTE mirror)
{
if(mirror == MIRROR_NONE || mirror == MIRROR_HORIZONTAL ||
mirror == MIRROR_VERTICAL || mirror == MIRROR_ORIGIN) {
Debug("mirror image x:%s, y:%s\r\n",(mirror & 0x01)? "mirror":"none", ((mirror >> 1) & 0x01)? "mirror":"none");
Paint.Mirror = mirror;
} else {
Debug("mirror should be MIRROR_NONE, MIRROR_HORIZONTAL, \
MIRROR_VERTICAL or MIRROR_ORIGIN\r\n");
}
}
/******************************************************************************
function: Set BitsPerPixel
parameter:
Xpoint : At point X
Ypoint : At point Y
Color : Painted colors
******************************************************************************/
void Paint_SetBitsPerPixel(UBYTE bpp)
{
if(bpp == 8 || bpp == 4 || bpp == 2 || bpp == 1){
Paint.BitsPerPixel = bpp;
Paint.GrayScale = pow(2, Paint.BitsPerPixel);
Paint.WidthByte = (Paint.WidthMemory * bpp % 8 == 0)? (Paint.WidthMemory * bpp / 8 ) : (Paint.WidthMemory * bpp / 8 + 1);
}
else{
Debug("Set BitsPerPixel Input parameter error\r\n");
Debug("BitsPerPixel Only support: 1 2 4 8 \r\n");
}
}
/******************************************************************************
function: Draw Pixels
parameter:
Xpoint : At point X
Ypoint : At point Y
Color : Painted colors
******************************************************************************/
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
{
if(Xpoint > Paint.Width || Ypoint > Paint.Height){
//Debug("Exceeding display boundaries\r\n");
return;
}
UWORD X, Y;
switch(Paint.Rotate) {
case 0:
X = Xpoint;
Y = Ypoint;
break;
case 90:
X = Paint.WidthMemory - Ypoint - 1;
Y = Xpoint;
break;
case 180:
X = Paint.WidthMemory - Xpoint - 1;
Y = Paint.HeightMemory - Ypoint - 1;
break;
case 270:
X = Ypoint;
Y = Paint.HeightMemory - Xpoint - 1;
break;
default:
return;
}
switch(Paint.Mirror) {
case MIRROR_NONE:
break;
case MIRROR_HORIZONTAL:
X = Paint.WidthMemory - X - 1;
break;
case MIRROR_VERTICAL:
Y = Paint.HeightMemory - Y - 1;
break;
case MIRROR_ORIGIN:
X = Paint.WidthMemory - X - 1;
Y = Paint.HeightMemory - Y - 1;
break;
default:
return;
}
if(X > Paint.WidthMemory || Y > Paint.HeightMemory){
Debug("Exceeding display boundaries\r\n");
return;
}
UDOUBLE Addr = X * (Paint.BitsPerPixel) / 8 + Y * Paint.WidthByte;
switch( Paint.BitsPerPixel ){
case 8:{
Paint.Image[Addr] = Color & 0xF0;
break;
}
case 4:{
Paint.Image[Addr] &= ~( (0xF0) >> (7 - (X*4+3)%8 ) );
Paint.Image[Addr] |= (Color & 0xF0) >> (7 - (X*4+3)%8 );
break;
}
case 2:{
Paint.Image[Addr] &= ~( (0xC0) >> (7 - (X*2+1)%8 ) );
Paint.Image[Addr] |= (Color & 0xC0) >> (7 - (X*2+1)%8 );
break;
}
case 1:{
Paint.Image[Addr] &= ~( (0x80) >> (7 - X%8) );
Paint.Image[Addr] |= (Color & 0x80) >> (7 - X%8);
break;
}
}
}
void Paint_SetColor(UWORD x, UWORD y, UWORD color)
{
UWORD arr_XY[2] = {x, y};
UBYTE arr_color[9];
UBYTE offset = x/3%3;
if(x%3 != 1)
(x%3==0) ? (arr_XY[0]++) : (arr_XY[0]--);
if((y+2)%3 != 1)
((y+2)%3==0) ? (arr_XY[1]++) : (arr_XY[1]--);
arr_XY[1] -= offset;
Paint_GetColor(color, arr_color);
for(UBYTE i=0; i<3; i++) {
for(UBYTE j=0; j<3; j++) {
Paint_SetPixel(arr_XY[0]-1+j, arr_XY[1]-1+i, arr_color[i*3+j]);
}
}
}
void Paint_GetColor(UWORD color, UBYTE* arr_color)
{
UBYTE* p_color = arr_color;
UWORD R, G, B;
B = (color>>4) & 0xf0;
G = color & 0xf0;
R = (color<<4) & 0xf0;
UBYTE temp[9] = {G, G, G/2, B, B, B/2, R, R, R/2};
for(UBYTE t=0; t<9; t++) {
p_color[t] = temp[t];
}
}
/******************************************************************************
function: Clear the color of the picture
parameter:
Color : Painted colors
******************************************************************************/
void Paint_Clear(UWORD Color)
{
UDOUBLE ImageSize = Paint.WidthByte * Paint.HeightByte;
memset(Paint.Image, Color, ImageSize);
}
/******************************************************************************
function: Clear the color of a window
parameter:
Xstart : x starting point
Ystart : Y starting point
Xend : x end point
Yend : y end point
Color : Painted colors
******************************************************************************/
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color)
{
for (UWORD Y = Ystart; Y < Yend; Y++) {
for (UWORD X = Xstart; X < Xend; X++) {
Paint_SetPixel(X, Y, Color);
}
}
}
/******************************************************************************
function: Draw Point(Xpoint, Ypoint) Fill the color
parameter:
Xpoint : The Xpoint coordinate of the point
Ypoint : The Ypoint coordinate of the point
Color : Painted color
Dot_Pixel : point size
Dot_Style : point Style
******************************************************************************/
void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color,
DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_Style)
{
if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
Debug("Paint_DrawPoint Input exceeds the normal display range\r\n");
return;
}
int16_t XDir_Num , YDir_Num;
if (Dot_Style == DOT_FILL_AROUND) {
for (XDir_Num = 0; XDir_Num < 2 * Dot_Pixel - 1; XDir_Num++) {
for (YDir_Num = 0; YDir_Num < 2 * Dot_Pixel - 1; YDir_Num++) {
if(Xpoint + XDir_Num - Dot_Pixel < 0 || Ypoint + YDir_Num - Dot_Pixel < 0)
break;
// Debug("x = %d, y = %d\r\n", Xpoint + XDir_Num - Dot_Pixel, Ypoint + YDir_Num - Dot_Pixel);
if(isColor)
Paint_SetColor(Xpoint + XDir_Num - Dot_Pixel, Ypoint + YDir_Num - Dot_Pixel, Color);
else
Paint_SetPixel(Xpoint + XDir_Num - Dot_Pixel, Ypoint + YDir_Num - Dot_Pixel, Color);
}
}
} else {
for (XDir_Num = 0; XDir_Num < Dot_Pixel; XDir_Num++) {
for (YDir_Num = 0; YDir_Num < Dot_Pixel; YDir_Num++) {
if(isColor)
Paint_SetColor(Xpoint + XDir_Num - 1, Ypoint + YDir_Num - 1, Color);
else
Paint_SetPixel(Xpoint + XDir_Num - 1, Ypoint + YDir_Num - 1, Color);
}
}
}
}
/******************************************************************************
function: Draw a line of arbitrary slope
parameter:
Xstart Starting Xpoint point coordinates
Ystart Starting Xpoint point coordinates
Xend End point Xpoint coordinate
Yend End point Ypoint coordinate
Color The color of the line segment
Line_width : Line width
Line_Style: Solid and dotted lines
******************************************************************************/
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend,
UWORD Color, DOT_PIXEL Line_width, LINE_STYLE Line_Style)
{
if (Xstart > Paint.Width || Ystart > Paint.Height ||
Xend > Paint.Width || Yend > Paint.Height) {
Debug("Paint_DrawLine Input exceeds the normal display range\r\n");
return;
}
UWORD Xpoint = Xstart;
UWORD Ypoint = Ystart;
int dx = (int)Xend - (int)Xstart >= 0 ? Xend - Xstart : Xstart - Xend;
int dy = (int)Yend - (int)Ystart <= 0 ? Yend - Ystart : Ystart - Yend;
// Increment direction, 1 is positive, -1 is counter;
int XAddway = Xstart < Xend ? 1 : -1;
int YAddway = Ystart < Yend ? 1 : -1;
//Cumulative error
int Esp = dx + dy;
char Dotted_Len = 0;
for (;;) {
Dotted_Len++;
//Painted dotted line, 2 point is really virtual
if (Line_Style == LINE_STYLE_DOTTED && Dotted_Len % 3 == 0) {
//Debug("LINE_DOTTED\r\n");
Paint_DrawPoint(Xpoint, Ypoint, IMAGE_BACKGROUND, Line_width, DOT_STYLE_DFT);
Dotted_Len = 0;
} else {
Paint_DrawPoint(Xpoint, Ypoint, Color, Line_width, DOT_STYLE_DFT);
}
if (2 * Esp >= dy) {
if (Xpoint == Xend)
break;
Esp += dy;
Xpoint += XAddway;
}
if (2 * Esp <= dx) {
if (Ypoint == Yend)
break;
Esp += dx;
Ypoint += YAddway;
}
}
}
/******************************************************************************
function: Draw a rectangle
parameter:
Xstart Rectangular Starting Xpoint point coordinates
Ystart Rectangular Starting Xpoint point coordinates
Xend Rectangular End point Xpoint coordinate
Yend Rectangular End point Ypoint coordinate
Color The color of the Rectangular segment
Line_width: Line width
Draw_Fill : Whether to fill the inside of the rectangle
******************************************************************************/
void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend,
UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
{
if (Xstart > Paint.Width || Ystart > Paint.Height ||
Xend > Paint.Width || Yend > Paint.Height) {
Debug("Input exceeds the normal display range\r\n");
return;
}
if (Draw_Fill) {
UWORD Ypoint;
for(Ypoint = Ystart; Ypoint < Yend; Ypoint++) {
Paint_DrawLine(Xstart, Ypoint, Xend, Ypoint, Color , Line_width, LINE_STYLE_SOLID);
}
} else {
Paint_DrawLine(Xstart, Ystart, Xend, Ystart, Color, Line_width, LINE_STYLE_SOLID);
Paint_DrawLine(Xstart, Ystart, Xstart, Yend, Color, Line_width, LINE_STYLE_SOLID);
Paint_DrawLine(Xend, Yend, Xend, Ystart, Color, Line_width, LINE_STYLE_SOLID);
Paint_DrawLine(Xend, Yend, Xstart, Yend, Color, Line_width, LINE_STYLE_SOLID);
}
}
/******************************************************************************
function: Use the 8-point method to draw a circle of the
specified size at the specified position->
parameter:
X_Center Center X coordinate
Y_Center Center Y coordinate
Radius circle Radius
Color The color of the circle segment
Line_width: Line width
Draw_Fill : Whether to fill the inside of the Circle
******************************************************************************/
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius,
UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
{
if (X_Center > Paint.Width || Y_Center >= Paint.Height) {
Debug("Paint_DrawCircle Input exceeds the normal display range\r\n");
return;
}
//Draw a circle from(0, R) as a starting point
int16_t XCurrent, YCurrent;
XCurrent = 0;
YCurrent = Radius;
//Cumulative error,judge the next point of the logo
int16_t Esp = 3 - (Radius << 1 );
int16_t sCountY;
if (Draw_Fill == DRAW_FILL_FULL) {
while (XCurrent <= YCurrent ) { //Realistic circles
for (sCountY = XCurrent; sCountY <= YCurrent; sCountY ++ ) {
Paint_DrawPoint(X_Center + XCurrent, Y_Center + sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//1
Paint_DrawPoint(X_Center - XCurrent, Y_Center + sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//2
Paint_DrawPoint(X_Center - sCountY, Y_Center + XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//3
Paint_DrawPoint(X_Center - sCountY, Y_Center - XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//4
Paint_DrawPoint(X_Center - XCurrent, Y_Center - sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//5
Paint_DrawPoint(X_Center + XCurrent, Y_Center - sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//6
Paint_DrawPoint(X_Center + sCountY, Y_Center - XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//7
Paint_DrawPoint(X_Center + sCountY, Y_Center + XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);
}
if (Esp < 0 )
Esp += 4 * XCurrent + 6;
else {
Esp += 10 + 4 * (XCurrent - YCurrent );
YCurrent --;
}
XCurrent ++;
}
} else { //Draw a hollow circle
while (XCurrent <= YCurrent ) {
Paint_DrawPoint(X_Center + XCurrent, Y_Center + YCurrent, Color, Line_width, DOT_STYLE_DFT);//1
Paint_DrawPoint(X_Center - XCurrent, Y_Center + YCurrent, Color, Line_width, DOT_STYLE_DFT);//2
Paint_DrawPoint(X_Center - YCurrent, Y_Center + XCurrent, Color, Line_width, DOT_STYLE_DFT);//3
Paint_DrawPoint(X_Center - YCurrent, Y_Center - XCurrent, Color, Line_width, DOT_STYLE_DFT);//4
Paint_DrawPoint(X_Center - XCurrent, Y_Center - YCurrent, Color, Line_width, DOT_STYLE_DFT);//5
Paint_DrawPoint(X_Center + XCurrent, Y_Center - YCurrent, Color, Line_width, DOT_STYLE_DFT);//6
Paint_DrawPoint(X_Center + YCurrent, Y_Center - XCurrent, Color, Line_width, DOT_STYLE_DFT);//7
Paint_DrawPoint(X_Center + YCurrent, Y_Center + XCurrent, Color, Line_width, DOT_STYLE_DFT);//0
if (Esp < 0 )
Esp += 4 * XCurrent + 6;
else {
Esp += 10 + 4 * (XCurrent - YCurrent );
YCurrent --;
}
XCurrent ++;
}
}
}
/******************************************************************************
function: Show English characters
parameter:
Xpoint X coordinate
Ypoint Y coordinate
Acsii_Char To display the English characters
Font A structure pointer that displays a character size
Color_Foreground : Select the foreground color
Color_Background : Select the background color
******************************************************************************/
void Paint_DrawChar(UWORD Xpoint, UWORD Ypoint, const char Acsii_Char,
sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
{
UWORD Page, Column;
if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
Debug("Paint_DrawChar Input exceeds the normal display range\r\n");
return;
}
uint32_t Char_Offset = (Acsii_Char - ' ') * Font->Height * (Font->Width / 8 + (Font->Width % 8 ? 1 : 0));
const unsigned char *ptr = &Font->table[Char_Offset];
for (Page = 0; Page < Font->Height; Page ++ ) {
for (Column = 0; Column < Font->Width; Column ++ ) {
//To determine whether the font background color and screen background color is consistent
if (FONT_BACKGROUND == Color_Background) { //this process is to speed up the scan
if (*ptr & (0x80 >> (Column % 8)))
Paint_SetPixel(Xpoint + Column, Ypoint + Page, Color_Foreground);
// Paint_DrawPoint(Xpoint + Column, Ypoint + Page, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
} else {
if (*ptr & (0x80 >> (Column % 8))) {
Paint_SetPixel(Xpoint + Column, Ypoint + Page, Color_Foreground);
// Paint_DrawPoint(Xpoint + Column, Ypoint + Page, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
} else {
Paint_SetPixel(Xpoint + Column, Ypoint + Page, Color_Background);
// Paint_DrawPoint(Xpoint + Column, Ypoint + Page, Color_Background, DOT_PIXEL_DFT, DOT_STYLE_DFT);
}
}
//One pixel is 8 bits
if (Column % 8 == 7)
ptr++;
}// Write a line
if (Font->Width % 8 != 0)
ptr++;
}// Write all
}
/******************************************************************************
function: Display the string
parameter:
Xstart X coordinate
Ystart Y coordinate
pString The first address of the English string to be displayed
Font A structure pointer that displays a character size
Color_Foreground : Select the foreground color
Color_Background : Select the background color
******************************************************************************/
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString,
sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
{
UWORD Xpoint = Xstart;
UWORD Ypoint = Ystart;
if (Xstart > Paint.Width || Ystart > Paint.Height) {
Debug("Paint_DrawString_EN Input exceeds the normal display range\r\n");
return;
}
while (* pString != '\0') {
//if X direction filled , reposition to(Xstart,Ypoint),Ypoint is Y direction plus the Height of the character
if ((Xpoint + Font->Width ) > Paint.Width ) {
Xpoint = Xstart;
Ypoint += Font->Height;
}
// If the Y direction is full, reposition to(Xstart, Ystart)
if ((Ypoint + Font->Height ) > Paint.Height ) {
Xpoint = Xstart;
Ypoint = Ystart;
}
Paint_DrawChar(Xpoint, Ypoint, * pString, Font, Color_Foreground, Color_Background);
//The next character of the address
pString ++;
//The next word of the abscissa increases the font of the broadband
Xpoint += Font->Width;
}
}
/******************************************************************************
function: Display the string
parameter:
Xstart X coordinate
Ystart Y coordinate
pString The first address of the Chinese string and English
string to be displayed
Font A structure pointer that displays a character size
Color_Foreground : Select the foreground color
Color_Background : Select the background color
******************************************************************************/
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font,
UWORD Color_Foreground, UWORD Color_Background)
{
const char* p_text = pString;
int x = Xstart, y = Ystart;
int i, j,Num;
/* Send the string character by character on EPD */
while (*p_text != 0) {
if(*p_text <= 0x7F) { //ASCII < 126
for(Num = 0; Num < font->size; Num++) {
if(*p_text== font->table[Num].index[0]) {
const char* ptr = &font->table[Num].matrix[0];
for (j = 0; j < font->Height; j++) {
for (i = 0; i < font->Width; i++) {
if (FONT_BACKGROUND == Color_Background) { //this process is to speed up the scan
if (*ptr & (0x80 >> (i % 8))) {
Paint_SetPixel(x + i, y + j, Color_Foreground);
// Paint_DrawPoint(x + i, y + j, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
}
} else {
if (*ptr & (0x80 >> (i % 8))) {
Paint_SetPixel(x + i, y + j, Color_Foreground);
// Paint_DrawPoint(x + i, y + j, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
} else {
Paint_SetPixel(x + i, y + j, Color_Background);
// Paint_DrawPoint(x + i, y + j, Color_Background, DOT_PIXEL_DFT, DOT_STYLE_DFT);
}
}
if (i % 8 == 7) {
ptr++;
}
}
if (font->Width % 8 != 0) {
ptr++;
}
}
break;
}
}
/* Point on the next character */
p_text += 1;
/* Decrement the column position by 16 */
x += font->ASCII_Width;
} else { //Chinese
for(Num = 0; Num < font->size; Num++) {
if((*p_text== font->table[Num].index[0]) && (*(p_text+1) == font->table[Num].index[1])) {
const char* ptr = &font->table[Num].matrix[0];
for (j = 0; j < font->Height; j++) {
for (i = 0; i < font->Width; i++) {
if (FONT_BACKGROUND == Color_Background) { //this process is to speed up the scan
if (*ptr & (0x80 >> (i % 8))) {
Paint_SetPixel(x + i, y + j, Color_Foreground);
// Paint_DrawPoint(x + i, y + j, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
}
} else {
if (*ptr & (0x80 >> (i % 8))) {
Paint_SetPixel(x + i, y + j, Color_Foreground);
// Paint_DrawPoint(x + i, y + j, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
} else {
Paint_SetPixel(x + i, y + j, Color_Background);
// Paint_DrawPoint(x + i, y + j, Color_Background, DOT_PIXEL_DFT, DOT_STYLE_DFT);
}
}
if (i % 8 == 7) {
ptr++;
}
}
if (font->Width % 8 != 0) {
ptr++;
}
}
break;
}
}
/* Point on the next character */
p_text += 2;
/* Decrement the column position by 16 */
x += font->Width;
}
}
}
/******************************************************************************
function: Display nummber
parameter:
Xstart X coordinate
Ystart : Y coordinate
Nummber : The number displayed
Font A structure pointer that displays a character size
Color_Foreground : Select the foreground color
Color_Background : Select the background color
******************************************************************************/
#define ARRAY_LEN 255
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Nummber,
sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
{
int16_t Num_Bit = 0, Str_Bit = 0;
uint8_t Str_Array[ARRAY_LEN] = {0}, Num_Array[ARRAY_LEN] = {0};
uint8_t *pStr = Str_Array;
if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
Debug("Paint_DisNum Input exceeds the normal display range\r\n");
return;
}
//Converts a number to a string
while (Nummber) {
Num_Array[Num_Bit] = Nummber % 10 + '0';
Num_Bit++;
Nummber /= 10;
}
//The string is inverted
while (Num_Bit > 0) {
Str_Array[Str_Bit] = Num_Array[Num_Bit - 1];
Str_Bit ++;
Num_Bit --;
}
//show
Paint_DrawString_EN(Xpoint, Ypoint, (const char*)pStr, Font, Color_Foreground, Color_Background);
}
/******************************************************************************
function: Display time
parameter:
Xstart X coordinate
Ystart : Y coordinate
pTime : Time-related structures
Font A structure pointer that displays a character size
Color_Foreground : Select the foreground color
Color_Background : Select the background color
******************************************************************************/
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font,
UWORD Color_Foreground, UWORD Color_Background)
{
uint8_t value[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
UWORD Dx = Font->Width;
//Write data into the cache
Paint_DrawChar(Xstart , Ystart, value[pTime->Hour / 10], Font, Color_Foreground, Color_Background);
Paint_DrawChar(Xstart + Dx , Ystart, value[pTime->Hour % 10], Font, Color_Foreground, Color_Background);
Paint_DrawChar(Xstart + Dx + Dx / 4 + Dx / 2 , Ystart, ':' , Font, Color_Foreground, Color_Background);
Paint_DrawChar(Xstart + Dx * 2 + Dx / 2 , Ystart, value[pTime->Min / 10] , Font, Color_Foreground, Color_Background);
Paint_DrawChar(Xstart + Dx * 3 + Dx / 2 , Ystart, value[pTime->Min % 10] , Font, Color_Foreground, Color_Background);
Paint_DrawChar(Xstart + Dx * 4 + Dx / 2 - Dx / 4, Ystart, ':' , Font, Color_Foreground, Color_Background);
Paint_DrawChar(Xstart + Dx * 5 , Ystart, value[pTime->Sec / 10] , Font, Color_Foreground, Color_Background);
Paint_DrawChar(Xstart + Dx * 6 , Ystart, value[pTime->Sec % 10] , Font, Color_Foreground, Color_Background);
}

View File

@ -0,0 +1,224 @@
/******************************************************************************
* | File : GUI_Paint.h
* | Author : Waveshare electronics
* | Function : Achieve drawing: draw points, lines, boxes, circles and
* their size, solid dotted line, solid rectangle hollow
* rectangle, solid circle hollow circle.
* | Info :
* Achieve display characters: Display a single character, string, number
* Achieve time display: adaptive size display time minutes and seconds
*----------------
* | This version: V3.0
* | Date : 2019-04-18
* | Info :
* -----------------------------------------------------------------------------
* V3.0(2019-04-18):
* 1.Change:
* Paint_DrawPoint(..., DOT_STYLE DOT_STYLE)
* => Paint_DrawPoint(..., DOT_STYLE Dot_Style)
* Paint_DrawLine(..., LINE_STYLE Line_Style, DOT_PIXEL Dot_Pixel)
* => Paint_DrawLine(..., DOT_PIXEL Line_width, LINE_STYLE Line_Style)
* Paint_DrawRectangle(..., DRAW_FILL Filled, DOT_PIXEL Dot_Pixel)
* => Paint_DrawRectangle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
* Paint_DrawCircle(..., DRAW_FILL Draw_Fill, DOT_PIXEL Dot_Pixel)
* => Paint_DrawCircle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Filll)
*
* -----------------------------------------------------------------------------
* V2.0(2018-11-15):
* 1.add: Paint_NewImage()
* Create an image's properties
* 2.add: Paint_SelectImage()
* Select the picture to be drawn
* 3.add: Paint_SetRotate()
* Set the direction of the cache
* 4.add: Paint_RotateImage()
* Can flip the picture, Support 0-360 degrees,
* but only 90.180.270 rotation is better
* 4.add: Paint_SetMirroring()
* Can Mirroring the picture, horizontal, vertical, origin
* 5.add: Paint_DrawString_CN()
* Can display Chinese(GB1312)
*
* -----------------------------------------------------------------------------
* V1.0(2018-07-17):
* Create library
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documnetation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
******************************************************************************/
#ifndef __GUI_PAINT_H
#define __GUI_PAINT_H
#include "../Config/DEV_Config.h"
#include "../Fonts/fonts.h"
/**
* Image attributes
**/
typedef struct {
UBYTE *Image;
UWORD Width;
UWORD Height;
UWORD WidthMemory;
UWORD HeightMemory;
UWORD Color;
UWORD Rotate;
UWORD Mirror;
UWORD WidthByte;
UWORD HeightByte;
UWORD BitsPerPixel;
UWORD GrayScale;
} PAINT;
extern PAINT Paint;
/**
* Display rotate
**/
#define ROTATE_0 0
#define ROTATE_90 90
#define ROTATE_180 180
#define ROTATE_270 270
/**
* Display Flip
**/
typedef enum {
MIRROR_NONE = 0x00,
MIRROR_HORIZONTAL = 0x01,
MIRROR_VERTICAL = 0x02,
MIRROR_ORIGIN = 0x03,
} MIRROR_IMAGE;
#define MIRROR_IMAGE_DFT MIRROR_NONE
/**
* image color
**/
#define WHITE 0xFF
#define BLACK 0x00
#define IMAGE_BACKGROUND WHITE
#define FONT_FOREGROUND BLACK
#define FONT_BACKGROUND WHITE
/*
For color definition of all BitsPerPixel, you can refer to this:
8bpp: 0x00-0xF0, as for 8bp will automatically reduce to 4bp, the detail value of 8bp is:
0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xA0 0xB0 0xC0 0xE0 0xF0 16 grayscale in total
which only occupy upper 4 bits of a byte
4bpp: 0x00-0xF0
0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xA0 0xB0 0xC0 0xE0 0xF0 16 grayscale in total
which only occupy upper 4 bits of a byte
2bpp: 0x00-0xC0
0x00 0x40 0x80 0xC0 4 grayscale in total
which only occupy upper 2 bits of a byte
1bpp: 0x00-0x80
0x00 0x80 2 grayscale in total
which only occupy upper 1 bits of a byte
*/
/**
* The size of the point
**/
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
#define DOT_PIXEL_DFT DOT_PIXEL_1X1 //Default dot pilex
/**
* Point size fill style
**/
typedef enum {
DOT_FILL_AROUND = 1, // dot pixel 1 x 1
DOT_FILL_RIGHTUP , // dot pixel 2 X 2
} DOT_STYLE;
#define DOT_STYLE_DFT DOT_FILL_AROUND //Default dot pilex
/**
* Line style, solid or dashed
**/
typedef enum {
LINE_STYLE_SOLID = 0,
LINE_STYLE_DOTTED,
} LINE_STYLE;
/**
* Whether the graphic is filled
**/
typedef enum {
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
} DRAW_FILL;
/**
* Custom structure of a time attribute
**/
typedef struct {
UWORD Year; //0000
UBYTE Month; //1 - 12
UBYTE Day; //1 - 30
UBYTE Hour; //0 - 23
UBYTE Min; //0 - 59
UBYTE Sec; //0 - 59
} PAINT_TIME;
extern PAINT_TIME sPaint_time;
//init and Clear
void Paint_NewImage(UBYTE *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color);
void Paint_SelectImage(UBYTE *image);
void Paint_SetRotate(UWORD Rotate);
void Paint_SetMirroring(UBYTE mirror);
void Paint_SetBitsPerPixel(UBYTE bpp);
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color);
void Paint_Clear(UWORD Color);
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color);
//Drawing
void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_FillWay);
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, LINE_STYLE Line_Style);
void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill);
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill);
//Display string
void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Acsii_Char, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Foreground, UWORD Color_Background);
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Nummber, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
void Paint_SetColor(UWORD x, UWORD y, UWORD color);
void Paint_GetColor(UWORD color, UBYTE* arr_color);
#endif

View File

@ -0,0 +1,921 @@
/*****************************************************************************
* | File : EPD_IT8951.c
* | Author : Waveshare team
* | Function : IT8951 Common driver
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-09-17
* | Info :
* -----------------------------------------------------------------------------
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "EPD_IT8951.h"
#include <time.h>
//basic mode definition
UBYTE INIT_Mode = 0;
UBYTE GC16_Mode = 2;
//A2_Mode's value is not fixed, is decide by firmware's LUT
UBYTE A2_Mode = 6;
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
static void EPD_IT8951_Reset(void)
{
DEV_Digital_Write(EPD_RST_PIN, HIGH);
DEV_Delay_ms(200);
DEV_Digital_Write(EPD_RST_PIN, LOW);
DEV_Delay_ms(10);
DEV_Digital_Write(EPD_RST_PIN, HIGH);
DEV_Delay_ms(200);
}
/******************************************************************************
function : Wait until the busy_pin goes HIGH
parameter:
******************************************************************************/
static void EPD_IT8951_ReadBusy(void)
{
// Debug("Busy ------\r\n");
UBYTE Busy_State = DEV_Digital_Read(EPD_BUSY_PIN);
//0: busy, 1: idle
while(Busy_State == 0) {
Busy_State = DEV_Digital_Read(EPD_BUSY_PIN);
}
// Debug("Busy Release ------\r\n");
}
/******************************************************************************
function : write command
parameter: command
******************************************************************************/
static void EPD_IT8951_WriteCommand(UWORD Command)
{
//Set Preamble for Write Command
UWORD Write_Preamble = 0x6000;
EPD_IT8951_ReadBusy();
DEV_Digital_Write(EPD_CS_PIN, LOW);
DEV_SPI_WriteByte(Write_Preamble>>8);
DEV_SPI_WriteByte(Write_Preamble);
EPD_IT8951_ReadBusy();
DEV_SPI_WriteByte(Command>>8);
DEV_SPI_WriteByte(Command);
DEV_Digital_Write(EPD_CS_PIN, HIGH);
}
/******************************************************************************
function : write data
parameter: data
******************************************************************************/
static void EPD_IT8951_WriteData(UWORD Data)
{
//Set Preamble for Write Command
UWORD Write_Preamble = 0x0000;
EPD_IT8951_ReadBusy();
DEV_Digital_Write(EPD_CS_PIN, LOW);
DEV_SPI_WriteByte(Write_Preamble>>8);
DEV_SPI_WriteByte(Write_Preamble);
EPD_IT8951_ReadBusy();
DEV_SPI_WriteByte(Data>>8);
DEV_SPI_WriteByte(Data);
DEV_Digital_Write(EPD_CS_PIN, HIGH);
}
/******************************************************************************
function : write multi data
parameter: data
******************************************************************************/
static void EPD_IT8951_WriteMuitiData(UWORD* Data_Buf, UDOUBLE Length)
{
//Set Preamble for Write Command
UWORD Write_Preamble = 0x0000;
EPD_IT8951_ReadBusy();
DEV_Digital_Write(EPD_CS_PIN, LOW);
DEV_SPI_WriteByte(Write_Preamble>>8);
DEV_SPI_WriteByte(Write_Preamble);
EPD_IT8951_ReadBusy();
for(UDOUBLE i = 0; i<Length; i++)
{
DEV_SPI_WriteByte(Data_Buf[i]>>8);
DEV_SPI_WriteByte(Data_Buf[i]);
}
DEV_Digital_Write(EPD_CS_PIN, HIGH);
}
/******************************************************************************
function : read data
parameter: data
******************************************************************************/
static UWORD EPD_IT8951_ReadData()
{
UWORD ReadData;
UWORD Write_Preamble = 0x1000;
UWORD Read_Dummy;
EPD_IT8951_ReadBusy();
DEV_Digital_Write(EPD_CS_PIN, LOW);
DEV_SPI_WriteByte(Write_Preamble>>8);
DEV_SPI_WriteByte(Write_Preamble);
EPD_IT8951_ReadBusy();
//dummy
Read_Dummy = DEV_SPI_ReadByte()<<8;
Read_Dummy |= DEV_SPI_ReadByte();
EPD_IT8951_ReadBusy();
ReadData = DEV_SPI_ReadByte()<<8;
ReadData |= DEV_SPI_ReadByte();
DEV_Digital_Write(EPD_CS_PIN, HIGH);
return ReadData;
}
/******************************************************************************
function : read multi data
parameter: data
******************************************************************************/
static void EPD_IT8951_ReadMultiData(UWORD* Data_Buf, UDOUBLE Length)
{
UWORD Write_Preamble = 0x1000;
UWORD Read_Dummy;
EPD_IT8951_ReadBusy();
DEV_Digital_Write(EPD_CS_PIN, LOW);
DEV_SPI_WriteByte(Write_Preamble>>8);
DEV_SPI_WriteByte(Write_Preamble);
EPD_IT8951_ReadBusy();
//dummy
Read_Dummy = DEV_SPI_ReadByte()<<8;
Read_Dummy |= DEV_SPI_ReadByte();
EPD_IT8951_ReadBusy();
for(UDOUBLE i = 0; i<Length; i++)
{
Data_Buf[i] = DEV_SPI_ReadByte()<<8;
Data_Buf[i] |= DEV_SPI_ReadByte();
}
DEV_Digital_Write(EPD_CS_PIN, HIGH);
}
/******************************************************************************
function: write multi arg
parameter: data
description: some situation like this:
* 1 commander 0 argument
* 1 commander 1 argument
* 1 commander multi argument
******************************************************************************/
static void EPD_IT8951_WriteMultiArg(UWORD Arg_Cmd, UWORD* Arg_Buf, UWORD Arg_Num)
{
//Send Cmd code
EPD_IT8951_WriteCommand(Arg_Cmd);
//Send Data
for(UWORD i=0; i<Arg_Num; i++)
{
EPD_IT8951_WriteData(Arg_Buf[i]);
}
}
/******************************************************************************
function : Cmd4 ReadReg
parameter:
******************************************************************************/
static UWORD EPD_IT8951_ReadReg(UWORD Reg_Address)
{
UWORD Reg_Value;
EPD_IT8951_WriteCommand(IT8951_TCON_REG_RD);
EPD_IT8951_WriteData(Reg_Address);
Reg_Value = EPD_IT8951_ReadData();
return Reg_Value;
}
/******************************************************************************
function : Cmd5 WriteReg
parameter:
******************************************************************************/
static void EPD_IT8951_WriteReg(UWORD Reg_Address,UWORD Reg_Value)
{
EPD_IT8951_WriteCommand(IT8951_TCON_REG_WR);
EPD_IT8951_WriteData(Reg_Address);
EPD_IT8951_WriteData(Reg_Value);
}
/******************************************************************************
function : get VCOM
parameter:
******************************************************************************/
static UWORD EPD_IT8951_GetVCOM(void)
{
UWORD VCOM;
EPD_IT8951_WriteCommand(USDEF_I80_CMD_VCOM);
EPD_IT8951_WriteData(0x0000);
VCOM = EPD_IT8951_ReadData();
return VCOM;
}
/******************************************************************************
function : set VCOM
parameter:
******************************************************************************/
static void EPD_IT8951_SetVCOM(UWORD VCOM)
{
EPD_IT8951_WriteCommand(USDEF_I80_CMD_VCOM);
EPD_IT8951_WriteData(0x0001);
EPD_IT8951_WriteData(VCOM);
}
/******************************************************************************
function : Cmd10 LD_IMG
parameter:
******************************************************************************/
static void EPD_IT8951_LoadImgStart( IT8951_Load_Img_Info* Load_Img_Info )
{
UWORD Args;
Args = (\
Load_Img_Info->Endian_Type<<8 | \
Load_Img_Info->Pixel_Format<<4 | \
Load_Img_Info->Rotate\
);
EPD_IT8951_WriteCommand(IT8951_TCON_LD_IMG);
EPD_IT8951_WriteData(Args);
}
/******************************************************************************
function : Cmd11 LD_IMG_Area
parameter:
******************************************************************************/
static void EPD_IT8951_LoadImgAreaStart( IT8951_Load_Img_Info* Load_Img_Info, IT8951_Area_Img_Info* Area_Img_Info )
{
UWORD Args[5];
Args[0] = (\
Load_Img_Info->Endian_Type<<8 | \
Load_Img_Info->Pixel_Format<<4 | \
Load_Img_Info->Rotate\
);
Args[1] = Area_Img_Info->Area_X;
Args[2] = Area_Img_Info->Area_Y;
Args[3] = Area_Img_Info->Area_W;
Args[4] = Area_Img_Info->Area_H;
EPD_IT8951_WriteMultiArg(IT8951_TCON_LD_IMG_AREA, Args,5);
}
/******************************************************************************
function : Cmd12 LD_IMG_End
parameter:
******************************************************************************/
static void EPD_IT8951_LoadImgEnd(void)
{
EPD_IT8951_WriteCommand(IT8951_TCON_LD_IMG_END);
}
/******************************************************************************
function : EPD_IT8951_Get_System_Info
parameter:
******************************************************************************/
static void EPD_IT8951_GetSystemInfo(void* Buf)
{
IT8951_Dev_Info* Dev_Info;
EPD_IT8951_WriteCommand(USDEF_I80_CMD_GET_DEV_INFO);
EPD_IT8951_ReadMultiData((UWORD*)Buf, sizeof(IT8951_Dev_Info)/2);
Dev_Info = (IT8951_Dev_Info*)Buf;
Debug("Panel(W,H) = (%d,%d)\r\n",Dev_Info->Panel_W, Dev_Info->Panel_H );
Debug("Memory Address = %X\r\n",Dev_Info->Memory_Addr_L | (Dev_Info->Memory_Addr_H << 16));
Debug("FW Version = %s\r\n", (UBYTE*)Dev_Info->FW_Version);
Debug("LUT Version = %s\r\n", (UBYTE*)Dev_Info->LUT_Version);
}
/******************************************************************************
function : EPD_IT8951_Set_Target_Memory_Addr
parameter:
******************************************************************************/
static void EPD_IT8951_SetTargetMemoryAddr(UDOUBLE Target_Memory_Addr)
{
UWORD WordH = (UWORD)((Target_Memory_Addr >> 16) & 0x0000FFFF);
UWORD WordL = (UWORD)( Target_Memory_Addr & 0x0000FFFF);
EPD_IT8951_WriteReg(LISAR+2, WordH);
EPD_IT8951_WriteReg(LISAR , WordL);
}
/******************************************************************************
function : EPD_IT8951_WaitForDisplayReady
parameter:
******************************************************************************/
static void EPD_IT8951_WaitForDisplayReady(void)
{
//Check IT8951 Register LUTAFSR => NonZero Busy, Zero - Free
while( EPD_IT8951_ReadReg(LUTAFSR) )
{
//wait in idle state
}
}
/******************************************************************************
function : EPD_IT8951_HostAreaPackedPixelWrite_1bp
parameter:
******************************************************************************/
static void EPD_IT8951_HostAreaPackedPixelWrite_1bp(IT8951_Load_Img_Info*Load_Img_Info,IT8951_Area_Img_Info*Area_Img_Info, bool Packed_Write)
{
UWORD Source_Buffer_Width, Source_Buffer_Height;
UWORD Source_Buffer_Length;
UWORD* Source_Buffer = (UWORD*)Load_Img_Info->Source_Buffer_Addr;
EPD_IT8951_SetTargetMemoryAddr(Load_Img_Info->Target_Memory_Addr);
EPD_IT8951_LoadImgAreaStart(Load_Img_Info,Area_Img_Info);
//from byte to word
//use 8bp to display 1bp, so here, divide by 2, because every byte has full bit.
Source_Buffer_Width = Area_Img_Info->Area_W/2;
Source_Buffer_Height = Area_Img_Info->Area_H;
Source_Buffer_Length = Source_Buffer_Width * Source_Buffer_Height;
if(Packed_Write == true)
{
EPD_IT8951_WriteMuitiData(Source_Buffer, Source_Buffer_Length);
}
else
{
for(UDOUBLE i=0; i<Source_Buffer_Height; i++)
{
for(UDOUBLE j=0; j<Source_Buffer_Width; j++)
{
EPD_IT8951_WriteData(*Source_Buffer);
Source_Buffer++;
}
}
}
EPD_IT8951_LoadImgEnd();
}
/******************************************************************************
function : EPD_IT8951_HostAreaPackedPixelWrite_2bp
parameter:
******************************************************************************/
static void EPD_IT8951_HostAreaPackedPixelWrite_2bp(IT8951_Load_Img_Info*Load_Img_Info, IT8951_Area_Img_Info*Area_Img_Info, bool Packed_Write)
{
UWORD Source_Buffer_Width, Source_Buffer_Height;
UWORD Source_Buffer_Length;
UWORD* Source_Buffer = (UWORD*)Load_Img_Info->Source_Buffer_Addr;
EPD_IT8951_SetTargetMemoryAddr(Load_Img_Info->Target_Memory_Addr);
EPD_IT8951_LoadImgAreaStart(Load_Img_Info,Area_Img_Info);
//from byte to word
Source_Buffer_Width = (Area_Img_Info->Area_W*2/8)/2;
Source_Buffer_Height = Area_Img_Info->Area_H;
Source_Buffer_Length = Source_Buffer_Width * Source_Buffer_Height;
if(Packed_Write == true)
{
EPD_IT8951_WriteMuitiData(Source_Buffer, Source_Buffer_Length);
}
else
{
for(UDOUBLE i=0; i<Source_Buffer_Height; i++)
{
for(UDOUBLE j=0; j<Source_Buffer_Width; j++)
{
EPD_IT8951_WriteData(*Source_Buffer);
Source_Buffer++;
}
}
}
EPD_IT8951_LoadImgEnd();
}
/******************************************************************************
function : EPD_IT8951_HostAreaPackedPixelWrite_4bp
parameter:
******************************************************************************/
static void EPD_IT8951_HostAreaPackedPixelWrite_4bp(IT8951_Load_Img_Info*Load_Img_Info, IT8951_Area_Img_Info*Area_Img_Info, bool Packed_Write)
{
UWORD Source_Buffer_Width, Source_Buffer_Height;
UWORD Source_Buffer_Length;
UWORD* Source_Buffer = (UWORD*)Load_Img_Info->Source_Buffer_Addr;
EPD_IT8951_SetTargetMemoryAddr(Load_Img_Info->Target_Memory_Addr);
EPD_IT8951_LoadImgAreaStart(Load_Img_Info,Area_Img_Info);
//from byte to word
Source_Buffer_Width = (Area_Img_Info->Area_W*4/8)/2;
Source_Buffer_Height = Area_Img_Info->Area_H;
Source_Buffer_Length = Source_Buffer_Width * Source_Buffer_Height;
if(Packed_Write == true)
{
EPD_IT8951_WriteMuitiData(Source_Buffer, Source_Buffer_Length);
}
else
{
for(UDOUBLE i=0; i<Source_Buffer_Height; i++)
{
for(UDOUBLE j=0; j<Source_Buffer_Width; j++)
{
EPD_IT8951_WriteData(*Source_Buffer);
Source_Buffer++;
}
}
}
EPD_IT8951_LoadImgEnd();
}
/******************************************************************************
function : EPD_IT8951_HostAreaPackedPixelWrite_8bp
parameter:
Precautions: Can't Packed Write
******************************************************************************/
static void EPD_IT8951_HostAreaPackedPixelWrite_8bp(IT8951_Load_Img_Info*Load_Img_Info,IT8951_Area_Img_Info*Area_Img_Info)
{
UWORD Source_Buffer_Width, Source_Buffer_Height;
UWORD* Source_Buffer = (UWORD*)Load_Img_Info->Source_Buffer_Addr;
EPD_IT8951_SetTargetMemoryAddr(Load_Img_Info->Target_Memory_Addr);
EPD_IT8951_LoadImgAreaStart(Load_Img_Info,Area_Img_Info);
//from byte to word
Source_Buffer_Width = (Area_Img_Info->Area_W*8/8)/2;
Source_Buffer_Height = Area_Img_Info->Area_H;
for(UDOUBLE i=0; i<Source_Buffer_Height; i++)
{
for(UDOUBLE j=0; j<Source_Buffer_Width; j++)
{
EPD_IT8951_WriteData(*Source_Buffer);
Source_Buffer++;
}
}
EPD_IT8951_LoadImgEnd();
}
/******************************************************************************
function : EPD_IT8951_Display_Area
parameter:
******************************************************************************/
static void EPD_IT8951_Display_Area(UWORD X,UWORD Y,UWORD W,UWORD H,UWORD Mode)
{
UWORD Args[5];
Args[0] = X;
Args[1] = Y;
Args[2] = W;
Args[3] = H;
Args[4] = Mode;
//0x0034
EPD_IT8951_WriteMultiArg(USDEF_I80_CMD_DPY_AREA, Args,5);
}
/******************************************************************************
function : EPD_IT8951_Display_AreaBuf
parameter:
******************************************************************************/
static void EPD_IT8951_Display_AreaBuf(UWORD X,UWORD Y,UWORD W,UWORD H,UWORD Mode, UDOUBLE Target_Memory_Addr)
{
UWORD Args[7];
Args[0] = X;
Args[1] = Y;
Args[2] = W;
Args[3] = H;
Args[4] = Mode;
Args[5] = (UWORD)Target_Memory_Addr;
Args[6] = (UWORD)(Target_Memory_Addr>>16);
//0x0037
EPD_IT8951_WriteMultiArg(USDEF_I80_CMD_DPY_BUF_AREA, Args,7);
}
/******************************************************************************
function : EPD_IT8951_Display_1bp
parameter:
******************************************************************************/
static void EPD_IT8951_Display_1bp(UWORD X, UWORD Y, UWORD W, UWORD H, UWORD Mode,UDOUBLE Target_Memory_Addr, UBYTE Back_Gray_Val,UBYTE Front_Gray_Val)
{
//Set Display mode to 1 bpp mode - Set 0x18001138 Bit[18](0x1800113A Bit[2])to 1
EPD_IT8951_WriteReg(UP1SR+2, EPD_IT8951_ReadReg(UP1SR+2) | (1<<2) );
EPD_IT8951_WriteReg(BGVR, (Front_Gray_Val<<8) | Back_Gray_Val);
if(Target_Memory_Addr == 0)
{
EPD_IT8951_Display_Area(X,Y,W,H,Mode);
}
else
{
EPD_IT8951_Display_AreaBuf(X,Y,W,H,Mode,Target_Memory_Addr);
}
EPD_IT8951_WaitForDisplayReady();
EPD_IT8951_WriteReg(UP1SR+2, EPD_IT8951_ReadReg(UP1SR+2) & ~(1<<2) );
}
/******************************************************************************
function : Enhanced driving capability
parameter: Enhanced driving capability for IT8951, in case the blurred display effect
******************************************************************************/
void Enhance_Driving_Capability(void)
{
UWORD RegValue = EPD_IT8951_ReadReg(0x0038);
Debug("The reg value before writing is %x\r\n", RegValue);
EPD_IT8951_WriteReg(0x0038, 0x0602);
RegValue = EPD_IT8951_ReadReg(0x0038);
Debug("The reg value after writing is %x\r\n", RegValue);
}
/******************************************************************************
function : Cmd1 SYS_RUN
parameter: Run the system
******************************************************************************/
void EPD_IT8951_SystemRun(void)
{
EPD_IT8951_WriteCommand(IT8951_TCON_SYS_RUN);
}
/******************************************************************************
function : Cmd2 STANDBY
parameter: Standby
******************************************************************************/
void EPD_IT8951_Standby(void)
{
EPD_IT8951_WriteCommand(IT8951_TCON_STANDBY);
}
/******************************************************************************
function : Cmd3 SLEEP
parameter: Sleep
******************************************************************************/
void EPD_IT8951_Sleep(void)
{
EPD_IT8951_WriteCommand(IT8951_TCON_SLEEP);
}
/******************************************************************************
function : EPD_IT8951_Init
parameter:
******************************************************************************/
IT8951_Dev_Info EPD_IT8951_Init(UWORD VCOM)
{
IT8951_Dev_Info Dev_Info;
EPD_IT8951_Reset();
EPD_IT8951_SystemRun();
EPD_IT8951_GetSystemInfo(&Dev_Info);
//Enable Pack write
EPD_IT8951_WriteReg(I80CPCR,0x0001);
//Set VCOM by handle
if(VCOM != EPD_IT8951_GetVCOM())
{
EPD_IT8951_SetVCOM(VCOM);
Debug("VCOM = -%.02fV\n",(float)EPD_IT8951_GetVCOM()/1000);
}
return Dev_Info;
}
/******************************************************************************
function : EPD_IT8951_Clear_Refresh
parameter:
******************************************************************************/
void EPD_IT8951_Clear_Refresh(IT8951_Dev_Info Dev_Info,UDOUBLE Target_Memory_Addr, UWORD Mode)
{
UDOUBLE ImageSize = ((Dev_Info.Panel_W * 4 % 8 == 0)? (Dev_Info.Panel_W * 4 / 8 ): (Dev_Info.Panel_W * 4 / 8 + 1)) * Dev_Info.Panel_H;
UBYTE* Frame_Buf = malloc (ImageSize);
memset(Frame_Buf, 0xFF, ImageSize);
IT8951_Load_Img_Info Load_Img_Info;
IT8951_Area_Img_Info Area_Img_Info;
EPD_IT8951_WaitForDisplayReady();
Load_Img_Info.Source_Buffer_Addr = (UDOUBLE)Frame_Buf;
Load_Img_Info.Endian_Type = IT8951_LDIMG_L_ENDIAN;
Load_Img_Info.Pixel_Format = IT8951_4BPP;
Load_Img_Info.Rotate = IT8951_ROTATE_0;
Load_Img_Info.Target_Memory_Addr = Target_Memory_Addr;
Area_Img_Info.Area_X = 0;
Area_Img_Info.Area_Y = 0;
Area_Img_Info.Area_W = Dev_Info.Panel_W;
Area_Img_Info.Area_H = Dev_Info.Panel_H;
EPD_IT8951_HostAreaPackedPixelWrite_4bp(&Load_Img_Info, &Area_Img_Info, false);
EPD_IT8951_Display_Area(0, 0, Dev_Info.Panel_W, Dev_Info.Panel_H, Mode);
free(Frame_Buf);
Frame_Buf = NULL;
}
/******************************************************************************
function : EPD_IT8951_1bp_Refresh
parameter:
******************************************************************************/
void EPD_IT8951_1bp_Refresh(UBYTE* Frame_Buf, UWORD X, UWORD Y, UWORD W, UWORD H, UBYTE Mode, UDOUBLE Target_Memory_Addr, bool Packed_Write)
{
IT8951_Load_Img_Info Load_Img_Info;
IT8951_Area_Img_Info Area_Img_Info;
EPD_IT8951_WaitForDisplayReady();
Load_Img_Info.Source_Buffer_Addr = (UDOUBLE)Frame_Buf;
Load_Img_Info.Endian_Type = IT8951_LDIMG_L_ENDIAN;
//Use 8bpp to set 1bpp
Load_Img_Info.Pixel_Format = IT8951_8BPP;
Load_Img_Info.Rotate = IT8951_ROTATE_0;
Load_Img_Info.Target_Memory_Addr = Target_Memory_Addr;
Area_Img_Info.Area_X = X/8;
Area_Img_Info.Area_Y = Y;
Area_Img_Info.Area_W = W/8;
Area_Img_Info.Area_H = H;
//clock_t start, finish;
//double duration;
//start = clock();
EPD_IT8951_HostAreaPackedPixelWrite_1bp(&Load_Img_Info, &Area_Img_Info, Packed_Write);
//finish = clock();
//duration = (double)(finish - start) / CLOCKS_PER_SEC;
//Debug( "Write occupy %f second\n", duration );
//start = clock();
EPD_IT8951_Display_1bp(X,Y,W,H,Mode,Target_Memory_Addr,0xF0,0x00);
//finish = clock();
//duration = (double)(finish - start) / CLOCKS_PER_SEC;
//Debug( "Show occupy %f second\n", duration );
}
/******************************************************************************
function : EPD_IT8951_1bp_Multi_Frame_Write
parameter:
******************************************************************************/
void EPD_IT8951_1bp_Multi_Frame_Write(UBYTE* Frame_Buf, UWORD X, UWORD Y, UWORD W, UWORD H,UDOUBLE Target_Memory_Addr, bool Packed_Write)
{
IT8951_Load_Img_Info Load_Img_Info;
IT8951_Area_Img_Info Area_Img_Info;
EPD_IT8951_WaitForDisplayReady();
Load_Img_Info.Source_Buffer_Addr = (UDOUBLE)Frame_Buf;
Load_Img_Info.Endian_Type = IT8951_LDIMG_L_ENDIAN;
//Use 8bpp to set 1bpp
Load_Img_Info.Pixel_Format = IT8951_8BPP;
Load_Img_Info.Rotate = IT8951_ROTATE_0;
Load_Img_Info.Target_Memory_Addr = Target_Memory_Addr;
Area_Img_Info.Area_X = X/8;
Area_Img_Info.Area_Y = Y;
Area_Img_Info.Area_W = W/8;
Area_Img_Info.Area_H = H;
EPD_IT8951_HostAreaPackedPixelWrite_1bp(&Load_Img_Info, &Area_Img_Info,Packed_Write);
}
/******************************************************************************
function : EPD_IT8951_1bp_Multi_Frame_Refresh
parameter:
******************************************************************************/
void EPD_IT8951_1bp_Multi_Frame_Refresh(UWORD X, UWORD Y, UWORD W, UWORD H,UDOUBLE Target_Memory_Addr)
{
EPD_IT8951_WaitForDisplayReady();
EPD_IT8951_Display_1bp(X,Y,W,H, A2_Mode,Target_Memory_Addr,0xF0,0x00);
}
/******************************************************************************
function : EPD_IT8951_2bp_Refresh
parameter:
******************************************************************************/
void EPD_IT8951_2bp_Refresh(UBYTE* Frame_Buf, UWORD X, UWORD Y, UWORD W, UWORD H, bool Hold, UDOUBLE Target_Memory_Addr, bool Packed_Write)
{
IT8951_Load_Img_Info Load_Img_Info;
IT8951_Area_Img_Info Area_Img_Info;
EPD_IT8951_WaitForDisplayReady();
Load_Img_Info.Source_Buffer_Addr = (UDOUBLE)Frame_Buf;
Load_Img_Info.Endian_Type = IT8951_LDIMG_L_ENDIAN;
Load_Img_Info.Pixel_Format = IT8951_2BPP;
Load_Img_Info.Rotate = IT8951_ROTATE_0;
Load_Img_Info.Target_Memory_Addr = Target_Memory_Addr;
Area_Img_Info.Area_X = X;
Area_Img_Info.Area_Y = Y;
Area_Img_Info.Area_W = W;
Area_Img_Info.Area_H = H;
EPD_IT8951_HostAreaPackedPixelWrite_2bp(&Load_Img_Info, &Area_Img_Info,Packed_Write);
if(Hold == true)
{
EPD_IT8951_Display_Area(X,Y,W,H, GC16_Mode);
}
else
{
EPD_IT8951_Display_AreaBuf(X,Y,W,H, GC16_Mode,Target_Memory_Addr);
}
}
/******************************************************************************
function : EPD_IT8951_4bp_Refresh
parameter:
******************************************************************************/
void EPD_IT8951_4bp_Refresh(UBYTE* Frame_Buf, UWORD X, UWORD Y, UWORD W, UWORD H, bool Hold, UDOUBLE Target_Memory_Addr, bool Packed_Write)
{
IT8951_Load_Img_Info Load_Img_Info;
IT8951_Area_Img_Info Area_Img_Info;
EPD_IT8951_WaitForDisplayReady();
Load_Img_Info.Source_Buffer_Addr = (UDOUBLE)Frame_Buf;
Load_Img_Info.Endian_Type = IT8951_LDIMG_L_ENDIAN;
Load_Img_Info.Pixel_Format = IT8951_4BPP;
Load_Img_Info.Rotate = IT8951_ROTATE_0;
Load_Img_Info.Target_Memory_Addr = Target_Memory_Addr;
Area_Img_Info.Area_X = X;
Area_Img_Info.Area_Y = Y;
Area_Img_Info.Area_W = W;
Area_Img_Info.Area_H = H;
EPD_IT8951_HostAreaPackedPixelWrite_4bp(&Load_Img_Info, &Area_Img_Info, Packed_Write);
if(Hold == true)
{
EPD_IT8951_Display_Area(X,Y,W,H, GC16_Mode);
}
else
{
EPD_IT8951_Display_AreaBuf(X,Y,W,H, GC16_Mode,Target_Memory_Addr);
}
}
/******************************************************************************
function : EPD_IT8951_8bp_Refresh
parameter:
******************************************************************************/
void EPD_IT8951_8bp_Refresh(UBYTE *Frame_Buf, UWORD X, UWORD Y, UWORD W, UWORD H, bool Hold, UDOUBLE Target_Memory_Addr)
{
IT8951_Load_Img_Info Load_Img_Info;
IT8951_Area_Img_Info Area_Img_Info;
EPD_IT8951_WaitForDisplayReady();
Load_Img_Info.Source_Buffer_Addr = (UDOUBLE)Frame_Buf;
Load_Img_Info.Endian_Type = IT8951_LDIMG_L_ENDIAN;
Load_Img_Info.Pixel_Format = IT8951_8BPP;
Load_Img_Info.Rotate = IT8951_ROTATE_0;
Load_Img_Info.Target_Memory_Addr = Target_Memory_Addr;
Area_Img_Info.Area_X = X;
Area_Img_Info.Area_Y = Y;
Area_Img_Info.Area_W = W;
Area_Img_Info.Area_H = H;
EPD_IT8951_HostAreaPackedPixelWrite_8bp(&Load_Img_Info, &Area_Img_Info);
if(Hold == true)
{
EPD_IT8951_Display_Area(X, Y, W, H, GC16_Mode);
}
else
{
EPD_IT8951_Display_AreaBuf(X, Y, W, H, GC16_Mode, Target_Memory_Addr);
}
}

View File

@ -0,0 +1,209 @@
/*****************************************************************************
* | File : EPD_IT8951.h
* | Author : Waveshare team
* | Function : IT8951 Common driver
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-09-17
* | Info :
* -----------------------------------------------------------------------------
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#ifndef __EPD_IT8951_H_
#define __EPD_IT8951_H_
#include <stdbool.h>
#include "../Config/DEV_Config.h"
// INIT mode, for every init or some time after A2 mode refresh
extern UBYTE INIT_Mode;
// GC16 mode, for every time to display 16 grayscale image
extern UBYTE GC16_Mode;
// A2 mode, for fast refresh without flash
extern UBYTE A2_Mode;
typedef struct IT8951_Load_Img_Info
{
UWORD Endian_Type; //little or Big Endian
UWORD Pixel_Format; //bpp
UWORD Rotate; //Rotate mode
UDOUBLE Source_Buffer_Addr; //Start address of source Frame buffer
UDOUBLE Target_Memory_Addr; //Base address of target image buffer
}IT8951_Load_Img_Info;
typedef struct IT8951_Area_Img_Info
{
UWORD Area_X;
UWORD Area_Y;
UWORD Area_W;
UWORD Area_H;
}IT8951_Area_Img_Info;
typedef struct IT8951_Dev_Info
{
UWORD Panel_W;
UWORD Panel_H;
UWORD Memory_Addr_L;
UWORD Memory_Addr_H;
UWORD FW_Version[8];
UWORD LUT_Version[8];
}IT8951_Dev_Info;
/*-----------------------------------------------------------------------
IT8951 Command defines
------------------------------------------------------------------------*/
//Built in I80 Command Code
#define IT8951_TCON_SYS_RUN 0x0001
#define IT8951_TCON_STANDBY 0x0002
#define IT8951_TCON_SLEEP 0x0003
#define IT8951_TCON_REG_RD 0x0010
#define IT8951_TCON_REG_WR 0x0011
#define IT8951_TCON_MEM_BST_RD_T 0x0012
#define IT8951_TCON_MEM_BST_RD_S 0x0013
#define IT8951_TCON_MEM_BST_WR 0x0014
#define IT8951_TCON_MEM_BST_END 0x0015
#define IT8951_TCON_LD_IMG 0x0020
#define IT8951_TCON_LD_IMG_AREA 0x0021
#define IT8951_TCON_LD_IMG_END 0x0022
//I80 User defined command code
#define USDEF_I80_CMD_DPY_AREA 0x0034
#define USDEF_I80_CMD_GET_DEV_INFO 0x0302
#define USDEF_I80_CMD_DPY_BUF_AREA 0x0037
#define USDEF_I80_CMD_VCOM 0x0039
/*-----------------------------------------------------------------------
IT8951 Mode defines
------------------------------------------------------------------------*/
//Rotate mode
#define IT8951_ROTATE_0 0
#define IT8951_ROTATE_90 1
#define IT8951_ROTATE_180 2
#define IT8951_ROTATE_270 3
//Pixel mode (Bit per Pixel)
#define IT8951_2BPP 0
#define IT8951_3BPP 1
#define IT8951_4BPP 2
#define IT8951_8BPP 3
//Endian Type
#define IT8951_LDIMG_L_ENDIAN 0
#define IT8951_LDIMG_B_ENDIAN 1
/*-----------------------------------------------------------------------
IT8951 Registers defines
------------------------------------------------------------------------*/
//Register Base Address
#define DISPLAY_REG_BASE 0x1000 //Register RW access
//Base Address of Basic LUT Registers
#define LUT0EWHR (DISPLAY_REG_BASE + 0x00) //LUT0 Engine Width Height Reg
#define LUT0XYR (DISPLAY_REG_BASE + 0x40) //LUT0 XY Reg
#define LUT0BADDR (DISPLAY_REG_BASE + 0x80) //LUT0 Base Address Reg
#define LUT0MFN (DISPLAY_REG_BASE + 0xC0) //LUT0 Mode and Frame number Reg
#define LUT01AF (DISPLAY_REG_BASE + 0x114) //LUT0 and LUT1 Active Flag Reg
//Update Parameter Setting Register
#define UP0SR (DISPLAY_REG_BASE + 0x134) //Update Parameter0 Setting Reg
#define UP1SR (DISPLAY_REG_BASE + 0x138) //Update Parameter1 Setting Reg
#define LUT0ABFRV (DISPLAY_REG_BASE + 0x13C) //LUT0 Alpha blend and Fill rectangle Value
#define UPBBADDR (DISPLAY_REG_BASE + 0x17C) //Update Buffer Base Address
#define LUT0IMXY (DISPLAY_REG_BASE + 0x180) //LUT0 Image buffer X/Y offset Reg
#define LUTAFSR (DISPLAY_REG_BASE + 0x224) //LUT Status Reg (status of All LUT Engines)
#define BGVR (DISPLAY_REG_BASE + 0x250) //Bitmap (1bpp) image color table
//System Registers
#define SYS_REG_BASE 0x0000
//Address of System Registers
#define I80CPCR (SYS_REG_BASE + 0x04)
//Memory Converter Registers
#define MCSR_BASE_ADDR 0x0200
#define MCSR (MCSR_BASE_ADDR + 0x0000)
#define LISAR (MCSR_BASE_ADDR + 0x0008)
/*
void EPD_IT8951_SystemRun();
void EPD_IT8951_Standby();
void EPD_IT8951_Sleep();
UWORD EPD_IT8951_ReadReg(UWORD Reg_Address);
void EPD_IT8951_WriteReg(UWORD Reg_Address,UWORD Reg_Value);
UWORD EPD_IT8951_GetVCOM(void);
void EPD_IT8951_SetVCOM(UWORD VCOM);
void EPD_IT8951_LoadImgStart( IT8951_Load_Img_Info* Load_Img_Info );
void EPD_IT8951_LoadImgAreaStart( IT8951_Load_Img_Info* Load_Img_Info, IT8951_Area_Img_Info* Area_Img_Info );
void EPD_IT8951_LoadImgEnd(void);
void EPD_IT8951_GetSystemInfo(void* Buf);
void EPD_IT8951_SetTargetMemoryAddr(UDOUBLE Target_Memory_Addr);
void EPD_IT8951_WaitForDisplayReady(void);
void EPD_IT8951_HostAreaPackedPixelWrite_8bp(IT8951_Load_Img_Info*Load_Img_Info,IT8951_Area_Img_Info*Area_Img_Info);
void EPD_IT8951_HostAreaPackedPixelWrite_1bp(IT8951_Load_Img_Info*Load_Img_Info,IT8951_Area_Img_Info*Area_Img_Info, bool Packed_Write);
void EPD_IT8951_HostAreaPackedPixelWrite_2bp(IT8951_Load_Img_Info*Load_Img_Info,IT8951_Area_Img_Info*Area_Img_Info, bool Packed_Write);
void EPD_IT8951_Display_Area(UWORD X,UWORD Y,UWORD W,UWORD H,UWORD Mode);
void EPD_IT8951_Display_AreaBuf(UWORD X,UWORD Y,UWORD W,UWORD H,UWORD Mode, UDOUBLE Target_Memory_Addr);
void EPD_IT8951_Display_1bp(UWORD X, UWORD Y, UWORD W, UWORD H, UWORD Mode,UDOUBLE Target_Memory_Addr, UBYTE Front_Gray_Val, UBYTE Back_Gray_Val);
*/
void Enhance_Driving_Capability(void);
void EPD_IT8951_SystemRun(void);
void EPD_IT8951_Standby(void);
void EPD_IT8951_Sleep(void);
IT8951_Dev_Info EPD_IT8951_Init(UWORD VCOM);
void EPD_IT8951_Clear_Refresh(IT8951_Dev_Info Dev_Info,UDOUBLE Target_Memory_Addr, UWORD Mode);
void EPD_IT8951_1bp_Refresh(UBYTE* Frame_Buf, UWORD X, UWORD Y, UWORD W, UWORD H, UBYTE Mode, UDOUBLE Target_Memory_Addr, bool Packed_Write);
void EPD_IT8951_1bp_Multi_Frame_Write(UBYTE* Frame_Buf, UWORD X, UWORD Y, UWORD W, UWORD H,UDOUBLE Target_Memory_Addr, bool Packed_Write);
void EPD_IT8951_1bp_Multi_Frame_Refresh(UWORD X, UWORD Y, UWORD W, UWORD H,UDOUBLE Target_Memory_Addr);
void EPD_IT8951_2bp_Refresh(UBYTE* Frame_Buf, UWORD X, UWORD Y, UWORD W, UWORD H, bool Hold, UDOUBLE Target_Memory_Addr, bool Packed_Write);
void EPD_IT8951_4bp_Refresh(UBYTE* Frame_Buf, UWORD X, UWORD Y, UWORD W, UWORD H, bool Hold, UDOUBLE Target_Memory_Addr, bool Packed_Write);
void EPD_IT8951_8bp_Refresh(UBYTE *Frame_Buf, UWORD X, UWORD Y, UWORD W, UWORD H, bool Hold, UDOUBLE Target_Memory_Addr);
#endif