init
This commit is contained in:
commit
52f9430ccd
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
obj/
|
||||
list/
|
||||
*.uvgui.*
|
||||
*.uvgui_*
|
||||
*.uvopt
|
16
README.md
Normal file
16
README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# CH552
|
||||
|
||||
### 项目描述
|
||||
|
||||
当下市面上最廉价的USB通信SOC,如果要做一款低成本的交互式产品,该平台十分合适,基于8051内核24MHz主频,够用的外设和USB通信能力很美好。
|
||||
|
||||
本项目包括基础工程,可以直接编译使用,相应的USB已经配置好,还可以搭配ST7735等驱动的LCD器件,快速省事开发产品,开发体验也很不错。
|
||||
|
||||
项目的工程通过keil c51编译开发,使用最新c51可以兼容mdk软件,开发环境相对友好。
|
||||
|
||||
---
|
||||
|
||||
## 组成
|
||||
|
||||
包括工程文件和用户文件,用户包括外设代码,本工程可以驱动ST7735 LCD显示器显示相关信息
|
||||
|
415
keil/CH552.uvproj
Normal file
415
keil/CH552.uvproj
Normal file
@ -0,0 +1,415 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_proj.xsd">
|
||||
|
||||
<SchemaVersion>1.1</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Targets>
|
||||
<Target>
|
||||
<TargetName>LCD</TargetName>
|
||||
<ToolsetNumber>0x0</ToolsetNumber>
|
||||
<ToolsetName>MCS-51</ToolsetName>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>AT89C52</Device>
|
||||
<Vendor>Atmel</Vendor>
|
||||
<Cpu>IRAM(0-0xFF) IROM(0-0x1FFF) CLOCK(24000000)</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile>"LIB\STARTUP.A51" ("Standard 8051 Startup Code")</StartupFile>
|
||||
<FlashDriverDll></FlashDriverDll>
|
||||
<DeviceId>2980</DeviceId>
|
||||
<RegisterFile>REGX52.H</RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
<Linker></Linker>
|
||||
<OHString></OHString>
|
||||
<InfinionOptionDll></InfinionOptionDll>
|
||||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile></SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
<LibPath></LibPath>
|
||||
<RegisterFilePath>Atmel\</RegisterFilePath>
|
||||
<DBRegisterFilePath>Atmel\</DBRegisterFilePath>
|
||||
<TargetStatus>
|
||||
<Error>0</Error>
|
||||
<ExitCodeStop>0</ExitCodeStop>
|
||||
<ButtonStop>0</ButtonStop>
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\obj\</OutputDirectory>
|
||||
<OutputName>headset</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>1</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\list\</ListingPath>
|
||||
<HexFormatSelection>0</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name>C:\Keil_v5\HEX2BIN.EXE C:\Users\Qitas\Desktop\vck1a\obj\VCK0_01.hex C:\Users\Qitas\Desktop\vck1a\obj\VCK0_01.bin</UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopA1X>0</nStopA1X>
|
||||
<nStopA2X>0</nStopA2X>
|
||||
</AfterMake>
|
||||
<SelectedForBatchBuild>0</SelectedForBatchBuild>
|
||||
<SVCSIdString></SVCSIdString>
|
||||
</TargetCommonOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>0</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>0</AlwaysBuild>
|
||||
<GenerateAssemblyFile>0</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>0</AssembleAssemblyFile>
|
||||
<PublicsOnly>0</PublicsOnly>
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
<BankNo>65535</BankNo>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>S8051.DLL</SimDllName>
|
||||
<SimDllArguments></SimDllArguments>
|
||||
<SimDlgDll>DP51.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-p52</SimDlgDllArguments>
|
||||
<TargetDllName>S8051.DLL</TargetDllName>
|
||||
<TargetDllArguments></TargetDllArguments>
|
||||
<TargetDlgDll>TP51.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-p52</TargetDlgDllArguments>
|
||||
</DllOption>
|
||||
<DebugOption>
|
||||
<OPTHX>
|
||||
<HexSelection>0</HexSelection>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
<Oh166RecLen>16</Oh166RecLen>
|
||||
</OPTHX>
|
||||
<Simulator>
|
||||
<UseSimulator>1</UseSimulator>
|
||||
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
|
||||
<RunToMain>1</RunToMain>
|
||||
<RestoreBreakpoints>1</RestoreBreakpoints>
|
||||
<RestoreWatchpoints>1</RestoreWatchpoints>
|
||||
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
|
||||
<RestoreFunctions>1</RestoreFunctions>
|
||||
<RestoreToolbox>1</RestoreToolbox>
|
||||
<LimitSpeedToRealTime>0</LimitSpeedToRealTime>
|
||||
<RestoreSysVw>1</RestoreSysVw>
|
||||
</Simulator>
|
||||
<Target>
|
||||
<UseTarget>0</UseTarget>
|
||||
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
|
||||
<RunToMain>0</RunToMain>
|
||||
<RestoreBreakpoints>1</RestoreBreakpoints>
|
||||
<RestoreWatchpoints>1</RestoreWatchpoints>
|
||||
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
|
||||
<RestoreFunctions>0</RestoreFunctions>
|
||||
<RestoreToolbox>1</RestoreToolbox>
|
||||
<RestoreTracepoints>0</RestoreTracepoints>
|
||||
<RestoreSysVw>1</RestoreSysVw>
|
||||
</Target>
|
||||
<RunDebugAfterBuild>0</RunDebugAfterBuild>
|
||||
<TargetSelection>-1</TargetSelection>
|
||||
<SimDlls>
|
||||
<CpuDll></CpuDll>
|
||||
<CpuDllArguments></CpuDllArguments>
|
||||
<PeripheralDll></PeripheralDll>
|
||||
<PeripheralDllArguments></PeripheralDllArguments>
|
||||
<InitializationFile></InitializationFile>
|
||||
</SimDlls>
|
||||
<TargetDlls>
|
||||
<CpuDll></CpuDll>
|
||||
<CpuDllArguments></CpuDllArguments>
|
||||
<PeripheralDll></PeripheralDll>
|
||||
<PeripheralDllArguments></PeripheralDllArguments>
|
||||
<InitializationFile></InitializationFile>
|
||||
<Driver></Driver>
|
||||
</TargetDlls>
|
||||
</DebugOption>
|
||||
<Utilities>
|
||||
<Flash1>
|
||||
<UseTargetDll>0</UseTargetDll>
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
|
||||
<Capability>0</Capability>
|
||||
<DriverSelection>-1</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>0</bUseTDR>
|
||||
<Flash2></Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<Target51>
|
||||
<Target51Misc>
|
||||
<MemoryModel>2</MemoryModel>
|
||||
<RTOS>0</RTOS>
|
||||
<RomSize>2</RomSize>
|
||||
<DataHold>0</DataHold>
|
||||
<XDataHold>0</XDataHold>
|
||||
<UseOnchipRom>0</UseOnchipRom>
|
||||
<UseOnchipArithmetic>0</UseOnchipArithmetic>
|
||||
<UseMultipleDPTR>0</UseMultipleDPTR>
|
||||
<UseOnchipXram>0</UseOnchipXram>
|
||||
<HadIRAM>1</HadIRAM>
|
||||
<HadXRAM>0</HadXRAM>
|
||||
<HadIROM>1</HadIROM>
|
||||
<Moda2>0</Moda2>
|
||||
<Moddp2>0</Moddp2>
|
||||
<Modp2>0</Modp2>
|
||||
<Mod517dp>0</Mod517dp>
|
||||
<Mod517au>0</Mod517au>
|
||||
<Mode2>0</Mode2>
|
||||
<useCB>0</useCB>
|
||||
<useXB>0</useXB>
|
||||
<useL251>0</useL251>
|
||||
<useA251>0</useA251>
|
||||
<Mx51>0</Mx51>
|
||||
<ModC812>0</ModC812>
|
||||
<ModCont>0</ModCont>
|
||||
<Lp51>0</Lp51>
|
||||
<useXBS>0</useXBS>
|
||||
<ModDA>0</ModDA>
|
||||
<ModAB2>0</ModAB2>
|
||||
<Mx51P>0</Mx51P>
|
||||
<hadXRAM2>0</hadXRAM2>
|
||||
<uocXram2>0</uocXram2>
|
||||
<hadXRAM3>0</hadXRAM3>
|
||||
<ModC2>0</ModC2>
|
||||
<ModH2>0</ModH2>
|
||||
<Mdu_R515>0</Mdu_R515>
|
||||
<Mdu_F120>0</Mdu_F120>
|
||||
<Psoc>0</Psoc>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<hadIROM3>0</hadIROM3>
|
||||
<ModSmx2>0</ModSmx2>
|
||||
<cBanks>0</cBanks>
|
||||
<xBanks>0</xBanks>
|
||||
<OnChipMemories>
|
||||
<RCB>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0xffff</Size>
|
||||
</RCB>
|
||||
<RXB>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</RXB>
|
||||
<Ocm1>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm1>
|
||||
<Ocm2>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm2>
|
||||
<Ocm3>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm3>
|
||||
<Ocr1>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocr1>
|
||||
<Ocr2>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocr2>
|
||||
<Ocr3>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocr3>
|
||||
<IRO>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x2000</Size>
|
||||
</IRO>
|
||||
<IRA>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x100</Size>
|
||||
</IRA>
|
||||
<XRA>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</XRA>
|
||||
<XRA512>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</XRA512>
|
||||
<IROM512>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</IROM512>
|
||||
<XRA513>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</XRA513>
|
||||
<IROM513>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</IROM513>
|
||||
</OnChipMemories>
|
||||
</Target51Misc>
|
||||
<C51>
|
||||
<RegisterColoring>0</RegisterColoring>
|
||||
<VariablesInOrder>0</VariablesInOrder>
|
||||
<IntegerPromotion>1</IntegerPromotion>
|
||||
<uAregs>0</uAregs>
|
||||
<UseInterruptVector>1</UseInterruptVector>
|
||||
<Fuzzy>3</Fuzzy>
|
||||
<Optimize>6</Optimize>
|
||||
<WarningLevel>2</WarningLevel>
|
||||
<SizeSpeed>1</SizeSpeed>
|
||||
<ObjectExtend>1</ObjectExtend>
|
||||
<ACallAJmp>0</ACallAJmp>
|
||||
<InterruptVectorAddress>0</InterruptVectorAddress>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</C51>
|
||||
<Ax51>
|
||||
<UseMpl>0</UseMpl>
|
||||
<UseStandard>1</UseStandard>
|
||||
<UseCase>0</UseCase>
|
||||
<UseMod51>0</UseMod51>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Ax51>
|
||||
<Lx51>
|
||||
<useFile>0</useFile>
|
||||
<linkonly>0</linkonly>
|
||||
<UseMemoryFromTarget>1</UseMemoryFromTarget>
|
||||
<CaseSensitiveSymbols>0</CaseSensitiveSymbols>
|
||||
<WarningLevel>2</WarningLevel>
|
||||
<DataOverlaying>1</DataOverlaying>
|
||||
<OverlayString></OverlayString>
|
||||
<MiscControls></MiscControls>
|
||||
<DisableWarningNumbers>16</DisableWarningNumbers>
|
||||
<LinkerCmdFile></LinkerCmdFile>
|
||||
<Assign></Assign>
|
||||
<ReserveString></ReserveString>
|
||||
<CClasses></CClasses>
|
||||
<UserClasses></UserClasses>
|
||||
<CSection></CSection>
|
||||
<UserSection></UserSection>
|
||||
<CodeBaseAddress></CodeBaseAddress>
|
||||
<XDataBaseAddress></XDataBaseAddress>
|
||||
<PDataBaseAddress></PDataBaseAddress>
|
||||
<BitBaseAddress></BitBaseAddress>
|
||||
<DataBaseAddress></DataBaseAddress>
|
||||
<IDataBaseAddress></IDataBaseAddress>
|
||||
<Precede></Precede>
|
||||
<Stack></Stack>
|
||||
<CodeSegmentName></CodeSegmentName>
|
||||
<XDataSegmentName></XDataSegmentName>
|
||||
<BitSegmentName></BitSegmentName>
|
||||
<DataSegmentName></DataSegmentName>
|
||||
<IDataSegmentName></IDataSegmentName>
|
||||
</Lx51>
|
||||
</Target51>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>CH552</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\usr\main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>USB.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\usr\USB.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>GPIO.C</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\usr\GPIO.C</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>Timer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\usr\Timer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>LCD.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\usr\LCD.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>common.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\usr\common.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
</Project>
|
1230
usr/CH554.h
Normal file
1230
usr/CH554.h
Normal file
File diff suppressed because it is too large
Load Diff
188
usr/GPIO.c
Normal file
188
usr/GPIO.c
Normal file
@ -0,0 +1,188 @@
|
||||
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : GPIO.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 IO 设置接口函数和GPIO中断函数
|
||||
*******************************************************************************/
|
||||
|
||||
#include "CH554.H"
|
||||
#include "common.h"
|
||||
#include "GPIO.h"
|
||||
#include "stdio.h"
|
||||
#include "USB.h"
|
||||
|
||||
extern UINT8 Value_CH552[14];
|
||||
UINT8 Power_y=0;
|
||||
|
||||
#pragma NOAREGS
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : Port1Cfg()
|
||||
* Description : 端口1配置
|
||||
* Input : Mode 0 = 浮空输入,无上拉
|
||||
1 = 推挽输入输出
|
||||
2 = 开漏输入输出,无上拉
|
||||
3 = 类51模式,开漏输入输出,有上拉,内部电路可以加速由低到高的电平爬升
|
||||
,UINT8 Pin (0-7)
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void Port1Cfg(UINT8 Mode,UINT8 Pin)
|
||||
{
|
||||
switch(Mode){
|
||||
case 0:
|
||||
P1_MOD_OC = P1_MOD_OC & ~(1<<Pin);
|
||||
P1_DIR_PU = P1_DIR_PU & ~(1<<Pin);
|
||||
break;
|
||||
case 1:
|
||||
P1_MOD_OC = P1_MOD_OC & ~(1<<Pin);
|
||||
P1_DIR_PU = P1_DIR_PU | (1<<Pin);
|
||||
break;
|
||||
case 2:
|
||||
P1_MOD_OC = P1_MOD_OC | (1<<Pin);
|
||||
P1_DIR_PU = P1_DIR_PU & ~(1<<Pin);
|
||||
break;
|
||||
case 3:
|
||||
P1_MOD_OC = P1_MOD_OC | (1<<Pin);
|
||||
P1_DIR_PU = P1_DIR_PU | (1<<Pin);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : Port3Cfg()
|
||||
* Description : 端口3配置
|
||||
* Input : Mode 0 = 浮空输入,无上拉
|
||||
1 = 推挽输入输出
|
||||
2 = 开漏输入输出,无上拉
|
||||
3 = 类51模式,开漏输入输出,有上拉,内部电路可以加速由低到高的电平爬升
|
||||
,UINT8 Pin (0-7)
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void Port3Cfg(UINT8 Mode,UINT8 Pin)
|
||||
{
|
||||
switch(Mode){
|
||||
case 0:
|
||||
P3_MOD_OC = P3_MOD_OC & ~(1<<Pin);
|
||||
P3_DIR_PU = P3_DIR_PU & ~(1<<Pin);
|
||||
break;
|
||||
case 1:
|
||||
P3_MOD_OC = P3_MOD_OC & ~(1<<Pin);
|
||||
P3_DIR_PU = P3_DIR_PU | (1<<Pin);
|
||||
break;
|
||||
case 2:
|
||||
P3_MOD_OC = P3_MOD_OC | (1<<Pin);
|
||||
P3_DIR_PU = P3_DIR_PU & ~(1<<Pin);
|
||||
break;
|
||||
case 3:
|
||||
P3_MOD_OC = P3_MOD_OC | (1<<Pin);
|
||||
P3_DIR_PU = P3_DIR_PU | (1<<Pin);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : GPIOInterruptCfg()
|
||||
* Description : GPIO中断配置
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void GPIOInterruptCfg()
|
||||
{
|
||||
GPIO_IE &= ~bIE_IO_EDGE; //高/低电平触发 低电平为有效电平
|
||||
// GPIO_IE |= bIE_IO_EDGE; //上升/下降触发 下降沿触发
|
||||
//GPIO_IE |= bIE_RXD1_LO; //RXD1低电平或下降沿触发 串口1接收中断使能
|
||||
GPIO_IE |= bIE_P1_5_LO | bIE_P1_4_LO | bIE_P1_3_LO | bIE_RST_HI;
|
||||
//P15\P14\P13低电平触发;RST高电平触发 上升沿触发
|
||||
//GPIO_IE |= bIE_P3_1_LO; //P31低电平或下降沿触发
|
||||
//GPIO_IE |= bIE_RXD0_LO; //RXD0低电平或下降沿触发 串口2接收中断使能
|
||||
IE_GPIO = 1; //GPIO中断开启 扩展中断使能
|
||||
}
|
||||
|
||||
|
||||
#ifdef GPIO_INTERRUPT
|
||||
/*******************************************************************************
|
||||
* Function Name : GPIOInterrupt(void)
|
||||
* Description : GPIO 中断服务程序
|
||||
*******************************************************************************/
|
||||
void GPIOInterrupt( void ) interrupt INT_NO_GPIO using 1 //GPIO中断服务程序,使用寄存器组1
|
||||
{
|
||||
//#ifdef DE_PRINTF
|
||||
// printf("GPIO_STATUS: %02x\n",(UINT16)(PIN_FUNC&bIO_INT_ACT));
|
||||
//#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TheKeyQuery()
|
||||
* Description : 按键查询
|
||||
* like-20180605
|
||||
*******************************************************************************/
|
||||
void TheKeyQuery()
|
||||
{
|
||||
if(KEY0==0)
|
||||
{
|
||||
delayus(100);
|
||||
if(KEY0==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(KEY_0);
|
||||
}
|
||||
}
|
||||
if(KEY1==0)
|
||||
{
|
||||
delayus(100);
|
||||
if(KEY1==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(KEY_1);
|
||||
}
|
||||
}
|
||||
if(KEY2==0)
|
||||
{
|
||||
delayus(100);
|
||||
if(KEY2==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(KEY_2);
|
||||
}
|
||||
}
|
||||
if(KEY3==0)
|
||||
{
|
||||
delayus(100);
|
||||
if(KEY3==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(KEY_3);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*******************************************************************************
|
||||
* Function Name : TheKeyQuery()
|
||||
* Description : 电源查询
|
||||
* like-20180605
|
||||
*******************************************************************************/
|
||||
void PowerSupplyQuery()
|
||||
{
|
||||
if(Power==0&&Power_y==1)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(PowerOFF);
|
||||
Power_y = 0;
|
||||
}
|
||||
else if(Power==1&&Power_y==0)
|
||||
{
|
||||
TXflag=SENDK;
|
||||
TXflagHandle(PowerON);
|
||||
Power_y = 1;
|
||||
}
|
||||
}
|
||||
|
32
usr/GPIO.h
Normal file
32
usr/GPIO.h
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
#define GPIO_INTERRUPT 1
|
||||
sbit Power=P1^7;
|
||||
sbit KEY0=P1^1;
|
||||
sbit KEY1=P1^4;
|
||||
sbit KEY2=P1^5;
|
||||
sbit KEY3=P1^6;
|
||||
/*******************************************************************************
|
||||
* Function Name : Port1Cfg()
|
||||
* Description : 端口1配置
|
||||
* Input : Mode 0 = 浮空输入,无上拉
|
||||
1 = 推挽输入输出
|
||||
2 = 开漏输入输出,无上拉
|
||||
3 = 类51模式,开漏输入输出,有上拉,内部电路可以加速由低到高的电平爬升
|
||||
,UINT8 Pin (0-7)
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void Port1Cfg(UINT8 Mode,UINT8 Pin);
|
||||
void Port3Cfg(UINT8 Mode,UINT8 Pin);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : GPIOInterruptCfg()
|
||||
* Description : GPIO中断配置
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void GPIOInterruptCfg();
|
||||
void custom_GPIO_Interrupt(void);
|
||||
void TheKeyQuery();
|
||||
void PowerSupplyQuery();
|
489
usr/LCD.c
Normal file
489
usr/LCD.c
Normal file
@ -0,0 +1,489 @@
|
||||
#include "CH554.h"
|
||||
#include "common.h"
|
||||
|
||||
//#include "font.h"
|
||||
//#include "sys.h"
|
||||
#include "lcd.h"
|
||||
/******************************************************
|
||||
GND=GND
|
||||
VCC=3.3V
|
||||
P00=CLK
|
||||
P01=MOSI
|
||||
P02=RES
|
||||
P03=DC
|
||||
P04=CS1
|
||||
BLK为LCD背光控制管脚,低电平关闭背光,高电平打开;默认可以不接打开背光
|
||||
////////////////////////以上是LCD工作所需要的/////////////////////////////////////
|
||||
P05=FSO
|
||||
P06=CS2
|
||||
******************************************************/
|
||||
|
||||
u16 BACK_COLOR, POINT_COLOR; //背景色,画笔色
|
||||
|
||||
unsigned char bdata bitdata;
|
||||
sbit bit7=bitdata^7;
|
||||
sbit bit6=bitdata^6;
|
||||
sbit bit5=bitdata^5;
|
||||
sbit bit4=bitdata^4;
|
||||
sbit bit3=bitdata^3;
|
||||
sbit bit2=bitdata^2;
|
||||
sbit bit1=bitdata^1;
|
||||
sbit bit0=bitdata^0;
|
||||
|
||||
|
||||
void LCD_Writ_Bus(char da) //串行数据写入
|
||||
{
|
||||
bitdata=da;
|
||||
LCD_SDI=bit7;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit6;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit5;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit4;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit3;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit2;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit1;LCD_SCK=0;LCD_SCK=1;
|
||||
LCD_SDI=bit0;LCD_SCK=0;LCD_SCK=1;
|
||||
}
|
||||
|
||||
void LCD_WR_DATA8(char da) //发送数据-8位参数
|
||||
{
|
||||
LCD_CS1=0;
|
||||
LCD_DC=1;
|
||||
LCD_Writ_Bus(da);
|
||||
LCD_CS1=1;
|
||||
}
|
||||
void LCD_WR_DATA(int da)
|
||||
{
|
||||
LCD_CS1=0;
|
||||
LCD_DC=1;
|
||||
LCD_Writ_Bus(da>>8);
|
||||
LCD_Writ_Bus(da);
|
||||
LCD_CS1=1;
|
||||
}
|
||||
void LCD_WR_REG(char da)
|
||||
{
|
||||
LCD_CS1=0;
|
||||
LCD_DC=0;
|
||||
LCD_Writ_Bus(da);
|
||||
LCD_CS1=1;
|
||||
}
|
||||
void LCD_WR_REG_DATA(int reg,int da)
|
||||
{
|
||||
LCD_WR_REG(reg);
|
||||
LCD_WR_DATA(da);
|
||||
|
||||
}
|
||||
void Address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2)
|
||||
{
|
||||
LCD_WR_REG(0x2a);
|
||||
LCD_WR_DATA8(0x02);
|
||||
LCD_WR_DATA8(x1+2);
|
||||
LCD_WR_DATA8(0x02);
|
||||
LCD_WR_DATA8(x2+2);
|
||||
|
||||
LCD_WR_REG(0x2b);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(y1+1);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(y2+1);
|
||||
|
||||
LCD_WR_REG(0x2C);
|
||||
}
|
||||
|
||||
|
||||
void Lcd_Init(void)
|
||||
{//LCD_BLK=1;
|
||||
|
||||
//调用一次这些函数,免得编译的时候提示警告
|
||||
|
||||
|
||||
// LCD_WR_REG_DATA(0,0);
|
||||
// LCD_ShowString(0,0," ");
|
||||
// LCD_ShowNum(0,0,0,0);
|
||||
// LCD_Show2Num(0,0,0,0);
|
||||
// LCD_DrawPoint_big(0,0);
|
||||
// LCD_DrawRectangle(0,0,0,0);
|
||||
// Draw_Circle(0,0,0);
|
||||
|
||||
LCD_REST=0;
|
||||
delayms(20);
|
||||
LCD_REST=1;
|
||||
delayms(20);
|
||||
LCD_WR_REG(0x11);//Sleep exit
|
||||
delayms (120);
|
||||
|
||||
//ST7735R Frame Rate
|
||||
LCD_WR_REG(0xB1);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(0x2C);
|
||||
LCD_WR_DATA8(0x2D);
|
||||
|
||||
LCD_WR_REG(0xB2);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(0x2C);
|
||||
LCD_WR_DATA8(0x2D);
|
||||
|
||||
LCD_WR_REG(0xB3);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(0x2C);
|
||||
LCD_WR_DATA8(0x2D);
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_DATA8(0x2C);
|
||||
LCD_WR_DATA8(0x2D);
|
||||
|
||||
LCD_WR_REG(0xB4); //Column inveLCD_DC ion
|
||||
LCD_WR_DATA8(0x07);
|
||||
|
||||
//ST7735R Power Sequence
|
||||
LCD_WR_REG(0xC0);
|
||||
LCD_WR_DATA8(0xA2);
|
||||
LCD_WR_DATA8(0x02);
|
||||
LCD_WR_DATA8(0x84);
|
||||
LCD_WR_REG(0xC1);
|
||||
LCD_WR_DATA8(0xC5);
|
||||
|
||||
LCD_WR_REG(0xC2);
|
||||
LCD_WR_DATA8(0x0A);
|
||||
LCD_WR_DATA8(0x00);
|
||||
|
||||
LCD_WR_REG(0xC3);
|
||||
LCD_WR_DATA8(0x8A);
|
||||
LCD_WR_DATA8(0x2A);
|
||||
LCD_WR_REG(0xC4);
|
||||
LCD_WR_DATA8(0x8A);
|
||||
LCD_WR_DATA8(0xEE);
|
||||
|
||||
LCD_WR_REG(0xC5); //VCOM
|
||||
LCD_WR_DATA8(0x0E);
|
||||
|
||||
LCD_WR_REG(0x36); //MX, MY, RGB mode
|
||||
LCD_WR_DATA8(0xC0);
|
||||
#ifdef USE_LANDSCAPE
|
||||
LCD_WR_DATA8(0xA8); //竖屏C8 横屏08 A8
|
||||
#else
|
||||
LCD_WR_DATA8(0xC8); //竖屏C8 横屏08 A8
|
||||
#endif
|
||||
//ST7735R Gamma Sequence
|
||||
LCD_WR_REG(0xe0);
|
||||
LCD_WR_DATA8(0x0f);
|
||||
LCD_WR_DATA8(0x1a);
|
||||
LCD_WR_DATA8(0x0f);
|
||||
LCD_WR_DATA8(0x18);
|
||||
LCD_WR_DATA8(0x2f);
|
||||
LCD_WR_DATA8(0x28);
|
||||
LCD_WR_DATA8(0x20);
|
||||
LCD_WR_DATA8(0x22);
|
||||
LCD_WR_DATA8(0x1f);
|
||||
LCD_WR_DATA8(0x1b);
|
||||
LCD_WR_DATA8(0x23);
|
||||
LCD_WR_DATA8(0x37);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x07);
|
||||
LCD_WR_DATA8(0x02);
|
||||
LCD_WR_DATA8(0x10);
|
||||
|
||||
LCD_WR_REG(0xe1);
|
||||
LCD_WR_DATA8(0x0f);
|
||||
LCD_WR_DATA8(0x1b);
|
||||
LCD_WR_DATA8(0x0f);
|
||||
LCD_WR_DATA8(0x17);
|
||||
LCD_WR_DATA8(0x33);
|
||||
LCD_WR_DATA8(0x2c);
|
||||
LCD_WR_DATA8(0x29);
|
||||
LCD_WR_DATA8(0x2e);
|
||||
LCD_WR_DATA8(0x30);
|
||||
LCD_WR_DATA8(0x30);
|
||||
LCD_WR_DATA8(0x39);
|
||||
LCD_WR_DATA8(0x3f);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x07);
|
||||
LCD_WR_DATA8(0x03);
|
||||
LCD_WR_DATA8(0x10);
|
||||
|
||||
LCD_WR_REG(0x2a);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x00+2);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x80+2);
|
||||
|
||||
LCD_WR_REG(0x2b);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x00+3);
|
||||
LCD_WR_DATA8(0x00);
|
||||
LCD_WR_DATA8(0x80+3);
|
||||
|
||||
LCD_WR_REG(0xF0); //Enable test command
|
||||
LCD_WR_DATA8(0x01);
|
||||
LCD_WR_REG(0xF6); //Disable ram power save mode
|
||||
LCD_WR_DATA8(0x00);
|
||||
|
||||
LCD_WR_REG(0x3A); //65k mode
|
||||
LCD_WR_DATA8(0x05);
|
||||
|
||||
|
||||
LCD_WR_REG(0x29);//Display on
|
||||
}
|
||||
|
||||
//***************************************************************
|
||||
|
||||
//清屏函数
|
||||
//Color:要清屏的填充色
|
||||
void LCD_Clear(u16 Color)
|
||||
{
|
||||
u16 i,j;
|
||||
Address_set(0,0,LCD_W-1,LCD_H-1);
|
||||
for(i=0;i<LCD_W;i++)
|
||||
{
|
||||
for (j=0;j<LCD_H;j++)
|
||||
{
|
||||
LCD_WR_DATA(Color);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//在指定位置显示一个汉字(32*33大小)
|
||||
//dcolor为内容颜色,gbcolor为背静颜色
|
||||
void showhanzi(unsigned int x,unsigned int y,unsigned char index)
|
||||
{
|
||||
unsigned char i,j;
|
||||
//unsigned char *temp=hanzi;
|
||||
unsigned char *temp=0;
|
||||
Address_set(x,y,x+31,y+31); //设置区域
|
||||
temp+=index*128;
|
||||
for(j=0;j<128;j++)
|
||||
{
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
if((*temp&(1<<i))!=0)
|
||||
{
|
||||
LCD_WR_DATA(POINT_COLOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
LCD_WR_DATA(BACK_COLOR);
|
||||
}
|
||||
}
|
||||
temp++;
|
||||
}
|
||||
}
|
||||
//画点
|
||||
//POINT_COLOR:此点的颜色
|
||||
void LCD_DrawPoint(u16 x,u16 y)
|
||||
{
|
||||
Address_set(x,y,x,y);//设置光标位置
|
||||
LCD_WR_DATA(POINT_COLOR);
|
||||
}
|
||||
//画一个大点
|
||||
//POINT_COLOR:此点的颜色
|
||||
void LCD_DrawPoint_big(u16 x,u16 y)
|
||||
{
|
||||
LCD_Fill(x-1,y-1,x+1,y+1,POINT_COLOR);
|
||||
}
|
||||
//在指定区域内填充指定颜色
|
||||
//区域大小:
|
||||
// (xend-xsta)*(yend-ysta)
|
||||
void LCD_Fill(u16 xsta,u16 ysta,u16 xend,u16 yend,u16 color)
|
||||
{
|
||||
u16 i,j;
|
||||
Address_set(xsta,ysta,xend,yend); //设置光标位置
|
||||
for(i=ysta;i<=yend;i++)
|
||||
{
|
||||
for(j=xsta;j<=xend;j++)LCD_WR_DATA(color);//设置光标位置
|
||||
}
|
||||
}
|
||||
//画线
|
||||
//x1,y1:起点坐标
|
||||
//x2,y2:终点坐标
|
||||
void LCD_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2)
|
||||
{
|
||||
u16 t;
|
||||
int xerr=0,yerr=0,delta_x,delta_y,distance;
|
||||
int incx,incy,uRow,uCol;
|
||||
|
||||
delta_x=x2-x1; //计算坐标增量
|
||||
delta_y=y2-y1;
|
||||
uRow=x1;
|
||||
uCol=y1;
|
||||
if(delta_x>0)incx=1; //设置单步方向
|
||||
else if(delta_x==0)incx=0;//垂直线
|
||||
else {incx=-1;delta_x=-delta_x;}
|
||||
if(delta_y>0)incy=1;
|
||||
else if(delta_y==0)incy=0;//水平线
|
||||
else{incy=-1;delta_y=-delta_y;}
|
||||
if( delta_x>delta_y)distance=delta_x; //选取基本增量坐标轴
|
||||
else distance=delta_y;
|
||||
for(t=0;t<=distance+1;t++ )//画线输出
|
||||
{
|
||||
LCD_DrawPoint(uRow,uCol);//画点
|
||||
xerr+=delta_x ;
|
||||
yerr+=delta_y ;
|
||||
if(xerr>distance)
|
||||
{
|
||||
xerr-=distance;
|
||||
uRow+=incx;
|
||||
}
|
||||
if(yerr>distance)
|
||||
{
|
||||
yerr-=distance;
|
||||
uCol+=incy;
|
||||
}
|
||||
}
|
||||
}
|
||||
//画矩形
|
||||
void LCD_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2)
|
||||
{
|
||||
LCD_DrawLine(x1,y1,x2,y1);
|
||||
LCD_DrawLine(x1,y1,x1,y2);
|
||||
LCD_DrawLine(x1,y2,x2,y2);
|
||||
LCD_DrawLine(x2,y1,x2,y2);
|
||||
}
|
||||
//在指定位置画一个指定大小的圆
|
||||
//(x,y):中心点
|
||||
//r :半径
|
||||
void Draw_Circle(u16 x0,u16 y0,u8 r)
|
||||
{
|
||||
int a,b;
|
||||
int di;
|
||||
a=0;b=r;
|
||||
di=3-(r<<1); //判断下个点位置的标志
|
||||
while(a<=b)
|
||||
{
|
||||
LCD_DrawPoint(x0-b,y0-a); //3
|
||||
LCD_DrawPoint(x0+b,y0-a); //0
|
||||
LCD_DrawPoint(x0-a,y0+b); //1
|
||||
LCD_DrawPoint(x0-b,y0-a); //7
|
||||
LCD_DrawPoint(x0-a,y0-b); //2
|
||||
LCD_DrawPoint(x0+b,y0+a); //4
|
||||
LCD_DrawPoint(x0+a,y0-b); //5
|
||||
LCD_DrawPoint(x0+a,y0+b); //6
|
||||
LCD_DrawPoint(x0-b,y0+a);
|
||||
a++;
|
||||
//使用Bresenham算法画圆
|
||||
if(di<0)di +=4*a+6;
|
||||
else
|
||||
{
|
||||
di+=10+4*(a-b);
|
||||
b--;
|
||||
}
|
||||
LCD_DrawPoint(x0+a,y0+b);
|
||||
}
|
||||
}
|
||||
//在指定位置显示一个字符
|
||||
|
||||
//num:要显示的字符:" "--->"~"
|
||||
//mode:叠加方式(1)还是非叠加方式(0)
|
||||
//在指定位置显示一个字符
|
||||
|
||||
//num:要显示的字符:" "--->"~"
|
||||
|
||||
//mode:叠加方式(1)还是非叠加方式(0)
|
||||
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 mode)
|
||||
{
|
||||
u8 temp;
|
||||
u8 pos,t;
|
||||
u16 x0=x;
|
||||
u16 colortemp=POINT_COLOR;
|
||||
if(x>LCD_W-16||y>LCD_H-16)return;
|
||||
//设置窗口
|
||||
num=num-' ';//得到偏移后的值
|
||||
Address_set(x,y,x+8-1,y+16-1); //设置光标位置
|
||||
if(!mode) //非叠加方式
|
||||
{
|
||||
for(pos=0;pos<16;pos++)
|
||||
{
|
||||
//temp=asc2_1608[(u16)num*16+pos]; //调用1608字体
|
||||
for(t=0;t<8;t++)
|
||||
{
|
||||
if(temp&0x01)POINT_COLOR=colortemp;
|
||||
else POINT_COLOR=BACK_COLOR;
|
||||
LCD_WR_DATA(POINT_COLOR);
|
||||
temp>>=1;
|
||||
x++;
|
||||
}
|
||||
x=x0;
|
||||
y++;
|
||||
}
|
||||
}else//叠加方式
|
||||
{
|
||||
for(pos=0;pos<16;pos++)
|
||||
{
|
||||
//temp=asc2_1608[(u16)num*16+pos]; //调用1608字体
|
||||
for(t=0;t<8;t++)
|
||||
{
|
||||
if(temp&0x01)LCD_DrawPoint(x+t,y+pos);//画一个点
|
||||
temp>>=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
POINT_COLOR=colortemp;
|
||||
}
|
||||
//m^n函数
|
||||
u32 mypow(u8 m,u8 n)
|
||||
{
|
||||
u32 result=1;
|
||||
while(n--)result*=m;
|
||||
return result;
|
||||
}
|
||||
//显示2个数字
|
||||
//x,y :起点坐标
|
||||
//len :数字的位数
|
||||
//color:颜色
|
||||
//num:数值(0~4294967295);
|
||||
void LCD_ShowNum(u16 x,u16 y,u32 num,u8 len)
|
||||
{
|
||||
u8 t,temp;
|
||||
u8 enshow=0;
|
||||
num=(u16)num;
|
||||
for(t=0;t<len;t++)
|
||||
{
|
||||
temp=(num/mypow(10,len-t-1))%10;
|
||||
if(enshow==0&&t<(len-1))
|
||||
{
|
||||
if(temp==0)
|
||||
{
|
||||
LCD_ShowChar(x+8*t,y,' ',0);
|
||||
continue;
|
||||
}else enshow=1;
|
||||
|
||||
}
|
||||
LCD_ShowChar(x+8*t,y,temp+48,0);
|
||||
}
|
||||
}
|
||||
//显示2个数字
|
||||
//x,y:起点坐标
|
||||
//num:数值(0~99);
|
||||
void LCD_Show2Num(u16 x,u16 y,u16 num,u8 len)
|
||||
{
|
||||
u8 t,temp;
|
||||
for(t=0;t<len;t++)
|
||||
{
|
||||
temp=(num/mypow(10,len-t-1))%10;
|
||||
LCD_ShowChar(x+8*t,y,temp+'0',0);
|
||||
}
|
||||
}
|
||||
//显示字符串
|
||||
//x,y:起点坐标
|
||||
//*p:字符串起始地址
|
||||
//用16字体
|
||||
void LCD_ShowString(u16 x,u16 y,const u8 *p)
|
||||
{
|
||||
while(*p!='\0')
|
||||
{
|
||||
if(x>LCD_W-16){x=0;y+=16;}
|
||||
if(y>LCD_H-16){y=x=0;LCD_Clear(RED);}
|
||||
LCD_ShowChar(x,y,*p,0);
|
||||
x+=8;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
112
usr/LCD.h
Normal file
112
usr/LCD.h
Normal file
@ -0,0 +1,112 @@
|
||||
#ifndef __LCD_H
|
||||
#define __LCD_H
|
||||
|
||||
#include "CH554.h"
|
||||
#include "common.h"
|
||||
//#include "sys.h"
|
||||
|
||||
#define u8 unsigned char
|
||||
#define u16 unsigned int
|
||||
#define u32 unsigned long
|
||||
/******************************************************
|
||||
GND=GND
|
||||
VCC=3.3V
|
||||
P00=CLK
|
||||
P01=MOSI
|
||||
P02=RES
|
||||
P03=DC
|
||||
P04=CS1
|
||||
BLK为LCD背光控制管脚,低电平关闭背光,高电平打开;默认可以不接打开背光
|
||||
////////////////////////以上是LCD工作所需要的/////////////////////////////////////
|
||||
P05=FSO
|
||||
P06=CS2
|
||||
|
||||
******************************************************/
|
||||
|
||||
//定义LCD的尺寸
|
||||
#define LCD_W 128
|
||||
#define LCD_H 160
|
||||
|
||||
sbit LCD_CS1 =P1^4; //片选
|
||||
sbit LCD_DC =P1^3; //数据/命令切换
|
||||
sbit LCD_SDI =P1^1; //数据
|
||||
sbit LCD_SCK =P1^0; //时钟
|
||||
//sbit LCD_REST =P0^2; //复位
|
||||
sbit LCD_REST =P1^5; //复位
|
||||
|
||||
sbit ZK_MISO =P1^7; //时钟
|
||||
sbit ZK_CS2 =P1^6; //复位
|
||||
|
||||
extern u16 BACK_COLOR, POINT_COLOR; //背景色,画笔色
|
||||
|
||||
void Lcd_Init(void);
|
||||
void LCD_Clear(u16 Color);
|
||||
void Address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2);
|
||||
void LCD_WR_DATA8(char da); //发送数据-8位参数
|
||||
void LCD_WR_DATA(int da);
|
||||
void LCD_WR_REG(char da);
|
||||
|
||||
void LCD_DrawPoint(u16 x,u16 y);//画点
|
||||
void LCD_DrawPoint_big(u16 x,u16 y);//画一个大点
|
||||
u16 LCD_ReadPoint(u16 x,u16 y); //读点
|
||||
void Draw_Circle(u16 x0,u16 y0,u8 r);
|
||||
void LCD_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2);
|
||||
void LCD_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2);
|
||||
void LCD_Fill(u16 xsta,u16 ysta,u16 xend,u16 yend,u16 color);
|
||||
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 mode);//显示一个字符
|
||||
void LCD_ShowNum(u16 x,u16 y,u32 num,u8 len);//显示数字
|
||||
void LCD_Show2Num(u16 x,u16 y,u16 num,u8 len);//显示2个数字
|
||||
void LCD_ShowString(u16 x,u16 y,const u8 *p); //显示一个字符串,16字体
|
||||
|
||||
void showhanzi(unsigned int x,unsigned int y,unsigned char index);
|
||||
|
||||
void CL_Mem(void);
|
||||
void GBZK_ROMOUTSET(void); //字库输出设置
|
||||
void GBZK_ROMOUTRESET(void); //字库输出设置
|
||||
void GBZK_GPIO_Config(void); //字库芯片初始化
|
||||
void ZK_command( unsigned char dat );
|
||||
unsigned char get_data_from_ROM(void);
|
||||
void get_n_bytes_data_from_ROM(unsigned char AddrHigh,unsigned char AddrMid,unsigned char AddrLow,unsigned char *pBuff,unsigned char DataLen );
|
||||
void Display_Asc_String(unsigned char zk_num,unsigned int x, unsigned int y, unsigned char text[]);
|
||||
void Display_Asc( unsigned char zk_num,unsigned int x, unsigned int y );
|
||||
void zk_map( unsigned char *getdate, unsigned char *putdata, unsigned char high, unsigned char width);
|
||||
void Display_GB2312_String(unsigned char zk_num,unsigned int x,unsigned int y, unsigned char text[]);
|
||||
void Display_GB2312( unsigned char zk_num,unsigned int x, unsigned int y );
|
||||
|
||||
|
||||
//画笔颜色
|
||||
#define WHITE 0xFFFF
|
||||
#define BLACK 0x0000
|
||||
#define BLUE 0x001F
|
||||
#define BRED 0XF81F
|
||||
#define GRED 0XFFE0
|
||||
#define GBLUE 0X07FF
|
||||
#define RED 0xF800
|
||||
#define MAGENTA 0xF81F
|
||||
#define GREEN 0x07E0
|
||||
#define CYAN 0x7FFF
|
||||
#define YELLOW 0xFFE0
|
||||
#define BROWN 0XBC40 //棕色
|
||||
#define BRRED 0XFC07 //棕红色
|
||||
#define GRAY 0X8430 //灰色
|
||||
//GUI颜色
|
||||
|
||||
#define DARKBLUE 0X01CF //深蓝色
|
||||
#define LIGHTBLUE 0X7D7C //浅蓝色
|
||||
#define GRAYBLUE 0X5458 //灰蓝色
|
||||
//以上三色为PANEL的颜色
|
||||
|
||||
#define LIGHTGREEN 0X841F //浅绿色
|
||||
#define LGRAY 0XC618 //浅灰色(PANNEL),窗体背景色
|
||||
|
||||
#define LGRAYBLUE 0XA651 //浅灰蓝色(中间层颜色)
|
||||
#define LBBLUE 0X2B12 //浅棕蓝色(选择条目的反色)
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
198
usr/STARTUP.A51
Normal file
198
usr/STARTUP.A51
Normal file
@ -0,0 +1,198 @@
|
||||
$NOMOD51
|
||||
;------------------------------------------------------------------------------
|
||||
; This file is part of the C51 Compiler package
|
||||
; Copyright (c) 1988-2005 Keil Elektronik GmbH and Keil Software, Inc.
|
||||
; Version 8.01
|
||||
;
|
||||
; *** <<< Use Configuration Wizard in Context Menu >>> ***
|
||||
;------------------------------------------------------------------------------
|
||||
; STARTUP.A51: This code is executed after processor reset.
|
||||
;
|
||||
; To translate this file use A51 with the following invocation:
|
||||
;
|
||||
; A51 STARTUP.A51
|
||||
;
|
||||
; To link the modified STARTUP.OBJ file to your application use the following
|
||||
; Lx51 invocation:
|
||||
;
|
||||
; Lx51 your object file list, STARTUP.OBJ controls
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; User-defined <h> Power-On Initialization of Memory
|
||||
;
|
||||
; With the following EQU statements the initialization of memory
|
||||
; at processor reset can be defined:
|
||||
;
|
||||
; <o> IDATALEN: IDATA memory size <0x0-0x100>
|
||||
; <i> Note: The absolute start-address of IDATA memory is always 0
|
||||
; <i> The IDATA space overlaps physically the DATA and BIT areas.
|
||||
IDATALEN EQU 80H
|
||||
;
|
||||
; <o> XDATASTART: XDATA memory start address <0x0-0xFFFF>
|
||||
; <i> The absolute start address of XDATA memory
|
||||
XDATASTART EQU 0
|
||||
;
|
||||
; <o> XDATALEN: XDATA memory size <0x0-0xFFFF>
|
||||
; <i> The length of XDATA memory in bytes.
|
||||
XDATALEN EQU 0
|
||||
;
|
||||
; <o> PDATASTART: PDATA memory start address <0x0-0xFFFF>
|
||||
; <i> The absolute start address of PDATA memory
|
||||
PDATASTART EQU 0H
|
||||
;
|
||||
; <o> PDATALEN: PDATA memory size <0x0-0xFF>
|
||||
; <i> The length of PDATA memory in bytes.
|
||||
PDATALEN EQU 0H
|
||||
;
|
||||
;</h>
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
;<h> Reentrant Stack Initialization
|
||||
;
|
||||
; The following EQU statements define the stack pointer for reentrant
|
||||
; functions and initialized it:
|
||||
;
|
||||
; <h> Stack Space for reentrant functions in the SMALL model.
|
||||
; <q> IBPSTACK: Enable SMALL model reentrant stack
|
||||
; <i> Stack space for reentrant functions in the SMALL model.
|
||||
IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
|
||||
; <o> IBPSTACKTOP: End address of SMALL model stack <0x0-0xFF>
|
||||
; <i> Set the top of the stack to the highest location.
|
||||
IBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
|
||||
; </h>
|
||||
;
|
||||
; <h> Stack Space for reentrant functions in the LARGE model.
|
||||
; <q> XBPSTACK: Enable LARGE model reentrant stack
|
||||
; <i> Stack space for reentrant functions in the LARGE model.
|
||||
XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
|
||||
; <o> XBPSTACKTOP: End address of LARGE model stack <0x0-0xFFFF>
|
||||
; <i> Set the top of the stack to the highest location.
|
||||
XBPSTACKTOP EQU 0xFFFF +1 ; default 0FFFFH+1
|
||||
; </h>
|
||||
;
|
||||
; <h> Stack Space for reentrant functions in the COMPACT model.
|
||||
; <q> PBPSTACK: Enable COMPACT model reentrant stack
|
||||
; <i> Stack space for reentrant functions in the COMPACT model.
|
||||
PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
|
||||
;
|
||||
; <o> PBPSTACKTOP: End address of COMPACT model stack <0x0-0xFFFF>
|
||||
; <i> Set the top of the stack to the highest location.
|
||||
PBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1
|
||||
; </h>
|
||||
;</h>
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Memory Page for Using the Compact Model with 64 KByte xdata RAM
|
||||
; <e>Compact Model Page Definition
|
||||
;
|
||||
; <i>Define the XDATA page used for PDATA variables.
|
||||
; <i>PPAGE must conform with the PPAGE set in the linker invocation.
|
||||
;
|
||||
; Enable pdata memory page initalization
|
||||
PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
|
||||
;
|
||||
; <o> PPAGE number <0x0-0xFF>
|
||||
; <i> uppermost 256-byte address of the page used for PDATA variables.
|
||||
PPAGE EQU 0
|
||||
;
|
||||
; <o> SFR address which supplies uppermost address byte <0x0-0xFF>
|
||||
; <i> most 8051 variants use P2 as uppermost address byte
|
||||
PPAGE_SFR DATA 0A0H
|
||||
;
|
||||
; </e>
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
; Standard SFR Symbols
|
||||
ACC DATA 0E0H
|
||||
B DATA 0F0H
|
||||
SP DATA 81H
|
||||
DPL DATA 82H
|
||||
DPH DATA 83H
|
||||
|
||||
NAME ?C_STARTUP
|
||||
|
||||
|
||||
?C_C51STARTUP SEGMENT CODE
|
||||
?STACK SEGMENT IDATA
|
||||
|
||||
RSEG ?STACK
|
||||
DS 1
|
||||
|
||||
EXTRN CODE (?C_START)
|
||||
PUBLIC ?C_STARTUP
|
||||
|
||||
CSEG AT 0
|
||||
?C_STARTUP: LJMP STARTUP1
|
||||
|
||||
RSEG ?C_C51STARTUP
|
||||
|
||||
STARTUP1:
|
||||
|
||||
IF IDATALEN <> 0
|
||||
MOV R0,#IDATALEN - 1
|
||||
CLR A
|
||||
IDATALOOP: MOV @R0,A
|
||||
DJNZ R0,IDATALOOP
|
||||
ENDIF
|
||||
|
||||
IF XDATALEN <> 0
|
||||
MOV DPTR,#XDATASTART
|
||||
MOV R7,#LOW (XDATALEN)
|
||||
IF (LOW (XDATALEN)) <> 0
|
||||
MOV R6,#(HIGH (XDATALEN)) +1
|
||||
ELSE
|
||||
MOV R6,#HIGH (XDATALEN)
|
||||
ENDIF
|
||||
CLR A
|
||||
XDATALOOP: MOVX @DPTR,A
|
||||
INC DPTR
|
||||
DJNZ R7,XDATALOOP
|
||||
DJNZ R6,XDATALOOP
|
||||
ENDIF
|
||||
|
||||
IF PPAGEENABLE <> 0
|
||||
MOV PPAGE_SFR,#PPAGE
|
||||
ENDIF
|
||||
|
||||
IF PDATALEN <> 0
|
||||
MOV R0,#LOW (PDATASTART)
|
||||
MOV R7,#LOW (PDATALEN)
|
||||
CLR A
|
||||
PDATALOOP: MOVX @R0,A
|
||||
INC R0
|
||||
DJNZ R7,PDATALOOP
|
||||
ENDIF
|
||||
|
||||
IF IBPSTACK <> 0
|
||||
EXTRN DATA (?C_IBP)
|
||||
|
||||
MOV ?C_IBP,#LOW IBPSTACKTOP
|
||||
ENDIF
|
||||
|
||||
IF XBPSTACK <> 0
|
||||
EXTRN DATA (?C_XBP)
|
||||
|
||||
MOV ?C_XBP,#HIGH XBPSTACKTOP
|
||||
MOV ?C_XBP+1,#LOW XBPSTACKTOP
|
||||
ENDIF
|
||||
|
||||
IF PBPSTACK <> 0
|
||||
EXTRN DATA (?C_PBP)
|
||||
MOV ?C_PBP,#LOW PBPSTACKTOP
|
||||
ENDIF
|
||||
|
||||
MOV SP,#?STACK-1
|
||||
|
||||
; This code is required if you use L51_BANK.A51 with Banking Mode 4
|
||||
;<h> Code Banking
|
||||
; <q> Select Bank 0 for L51_BANK.A51 Mode 4
|
||||
#if 0
|
||||
; <i> Initialize bank mechanism to code bank 0 when using L51_BANK.A51 with Banking Mode 4.
|
||||
EXTRN CODE (?B_SWITCH0)
|
||||
CALL ?B_SWITCH0 ; init bank mechanism to code bank 0
|
||||
#endif
|
||||
;</h>
|
||||
LJMP ?C_START
|
||||
|
||||
END
|
159
usr/Timer.c
Normal file
159
usr/Timer.c
Normal file
@ -0,0 +1,159 @@
|
||||
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : Timer.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 Time 初始化、定时器、计数器赋值、T2捕捉功能开启函数等
|
||||
定时器中断函数
|
||||
*******************************************************************************/
|
||||
#include "CH554.h"
|
||||
#include "common.h"
|
||||
#include "Timer.h"
|
||||
#include "stdio.h"
|
||||
#include "USB.h"
|
||||
|
||||
UINT8 Tim_3ms;
|
||||
|
||||
#pragma NOAREGS
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer_x_ModInit(UINT8 x ,UINT8 mode)
|
||||
* Description : CH554定时计数器x模式设置
|
||||
* Input : UINT8 mode,Timer模式选择
|
||||
0:模式0,13位定时器,TLn的高3位无效
|
||||
1:模式1,16位定时器
|
||||
2:模式2,8位自动重装定时器
|
||||
3:模式3,两个8位定时器 Timer0
|
||||
3:模式3,Timer1停止
|
||||
* Output : None
|
||||
* Return : 成功 SUCCESS
|
||||
失败 FAIL
|
||||
*******************************************************************************/
|
||||
UINT8 mTimer_x_ModInit(UINT8 x ,UINT8 mode)
|
||||
{
|
||||
if(x == 0){TMOD = TMOD & 0xf0 | mode;}
|
||||
else if(x == 1){TMOD = TMOD & 0x0f | (mode<<4);}
|
||||
else if(x == 2){RCLK = 0;TCLK = 0;CP_RL2 = 0;} //16位自动重载定时器
|
||||
else return FAIL;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer_x_SetData(UINT8 x,UINT16 dat)
|
||||
* Description : CH554Timer0 TH0和TL0赋值
|
||||
* Input : UINT16 dat;定时器赋值
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mTimer_x_SetData(UINT8 x,UINT16 dat)
|
||||
{
|
||||
UINT16 tmp;
|
||||
tmp = 65536 - dat;
|
||||
if(x == 0){TL0 = tmp & 0xff;TH0 = (tmp>>8) & 0xff;}
|
||||
else if(x == 1){TL1 = tmp & 0xff;TH1 = (tmp>>8) & 0xff;}
|
||||
else if(x == 2)
|
||||
{
|
||||
RCAP2L = TL2 = tmp & 0xff; //16位自动重载定时器
|
||||
RCAP2H = TH2 = (tmp>>8) & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CAP2Init(UINT8 mode)
|
||||
* Description : CH554定时计数器2 T2EX引脚捕捉功能初始化
|
||||
UINT8 mode,边沿捕捉模式选择
|
||||
0:T2ex从下降沿到下一个下降沿
|
||||
1:T2ex任意边沿之间
|
||||
3:T2ex从上升沿到下一个上升沿
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CAP2Init(UINT8 mode)
|
||||
{
|
||||
RCLK = 0;
|
||||
TCLK = 0;
|
||||
C_T2 = 0;
|
||||
EXEN2 = 1;
|
||||
CP_RL2 = 1; //启动T2ex的捕捉功能
|
||||
T2MOD |= mode << 2; //边沿捕捉模式选择
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CAP1Init(UINT8 mode)
|
||||
* Description : CH554定时计数器2 T2引脚捕捉功能初始化T2
|
||||
UINT8 mode,边沿捕捉模式选择
|
||||
0:T2ex从下降沿到下一个下降沿
|
||||
1:T2ex任意边沿之间
|
||||
3:T2ex从上升沿到下一个上升沿
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CAP1Init(UINT8 mode)
|
||||
{
|
||||
RCLK = 0;
|
||||
TCLK = 0;
|
||||
CP_RL2 = 1;
|
||||
C_T2 = 0;
|
||||
T2MOD = T2MOD & ~T2OE | (mode << 2) | bT2_CAP1_EN; //使能T2引脚捕捉功能,边沿捕捉模式选择
|
||||
}
|
||||
|
||||
#ifdef T0_INT
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer0Interrupt()
|
||||
* Description : CH554定时计数器0定时计数器中断处理函数
|
||||
*******************************************************************************/
|
||||
void mTimer0Interrupt( void ) interrupt INT_NO_TMR0 using 1 //timer0中断服务程序,使用寄存器组1
|
||||
{ //方式3时,TH0使用Timer1的中断资源
|
||||
SCK = ~SCK;
|
||||
// mTimer_x_SetData(0,0x0000); //非自动重载方式需重新给TH0和TL0赋值
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef T1_INT
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer1Interrupt()
|
||||
* Description : CH554定时计数器0定时计数器中断处理函数
|
||||
*******************************************************************************/
|
||||
void mTimer1Interrupt( void ) interrupt INT_NO_TMR1 using 2 //timer1中断服务程序,使用寄存器组2
|
||||
{ //方式3时,Timer1停止
|
||||
SCK = ~SCK;
|
||||
// mTimer_x_SetData(1,0x0000); //非自动重载方式需重新给TH1和TL1赋值
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer2Interrupt()
|
||||
* Description : CH554定时计数器0定时计数器中断处理函数
|
||||
*******************************************************************************/
|
||||
#ifdef T2_INT
|
||||
void mTimer2Interrupt(void) interrupt INT_NO_TMR2 using 3 //timer2中断服务程序,使用寄存器组3
|
||||
{
|
||||
mTimer2RunCTL( 0 ); //关定时器
|
||||
#ifdef T2_CAP
|
||||
if(EXF2) //T2ex电平变化中断中断标志
|
||||
{
|
||||
SCK = ~SCK; //P17电平指示监控
|
||||
Cap[FLAG++] = RCAP2; //T2EX
|
||||
printf("RCAP2 %04x \n",RCAP2);
|
||||
EXF2 = 0; //清空T2ex捕捉中断标志
|
||||
}
|
||||
if(CAP1F) //T2电平捕捉中断标志
|
||||
{
|
||||
Cap[FLAG++] = T2CAP1; //T2;
|
||||
printf("T2CAP1 %04x \n",T2CAP1);
|
||||
CAP1F = 0; //清空T2捕捉中断标志
|
||||
}
|
||||
#endif
|
||||
if(TF2)
|
||||
{
|
||||
Tim_3ms++;
|
||||
TF2 = 0; //清空定时器2溢出中断
|
||||
}
|
||||
mTimer2RunCTL(1); //开定时器
|
||||
}
|
||||
#endif
|
94
usr/Timer.h
Normal file
94
usr/Timer.h
Normal file
@ -0,0 +1,94 @@
|
||||
|
||||
|
||||
// #define T0_INT 1 //T中断开启
|
||||
//#define T1_INT 1
|
||||
#define T2_INT 1
|
||||
// #define T2_CAP 1
|
||||
|
||||
extern UINT8 Tim_3ms;
|
||||
|
||||
extern UINT8 FLAG;
|
||||
extern UINT16 Cap[8];
|
||||
|
||||
//CH554 Timer0时钟选择
|
||||
//bTMR_CLK同时影响Timer0&1&2,使用时要注意 (除定时使用标准时钟)
|
||||
#define mTimer0Clk12DivFsys( ) (T2MOD &= ~bT0_CLK) //定时器,时钟=Fsys/12 T0标准时钟
|
||||
#define mTimer0ClkFsys( ) (T2MOD |= bTMR_CLK | bT0_CLK) //定时器,时钟=Fsys
|
||||
#define mTimer0Clk4DivFsys( ) (T2MOD &= ~bTMR_CLK;T2MOD |= bT0_CLK) //定时器,时钟=Fsys/4
|
||||
#define mTimer0CountClk( ) (TMOD |= bT0_CT) //计数器,T0引脚的下降沿有效
|
||||
|
||||
//CH554 Timer0 开始(SS=1)/结束(SS=0)
|
||||
#define mTimer0RunCTL( SS ) (TR0 = SS ? START : STOP)
|
||||
|
||||
|
||||
#define mTimer1Clk12DivFsys( ) (T2MOD &= ~bT1_CLK) //定时器,时钟=Fsys/12 T1标准时钟
|
||||
#define mTimer1ClkFsys( ) (T2MOD |= bTMR_CLK | bT1_CLK) //定时器,时钟=Fsys
|
||||
#define mTimer1Clk4DivFsys( ) (T2MOD &= ~bTMR_CLK;T2MOD |= bT1_CLK) //定时器,时钟=Fsys/4
|
||||
#define mTimer1CountClk( ) (TMOD |= bT1_CT) //计数器,T0引脚的下降沿有效
|
||||
|
||||
//CH554 Timer1 开始(SS=1)/结束(SS=0)
|
||||
#define mTimer1RunCTL( SS ) (TR1 = SS ? START : STOP)
|
||||
|
||||
|
||||
#define mTimer2Clk12DivFsys( ) {T2MOD &= ~(bTMR_CLK | bT2_CLK);C_T2 = 0;} //定时器,时钟=Fsys/12 T2标准时钟
|
||||
#define mTimer2ClkFsys( ) {T2MOD |= (bTMR_CLK | bT2_CLK);C_T2=0;} //定时器,时钟=Fsys
|
||||
#define mTimer2Clk4DivFsys( ) {T2MOD &= ~bTMR_CLK;T2MOD |= bT2_CLK;C_T2 = 0;}//定时器,时钟=Fsys/4
|
||||
#define mTimer2CountClk( ) {C_T2 = 1;} //计数器,T2引脚的下降沿有效
|
||||
|
||||
//CH554 Timer2 开始(SS=1)/结束(SS=0)
|
||||
#define mTimer2RunCTL( SS ) {TR2 = SS ? START : STOP;}
|
||||
#define mTimer2OutCTL( ) (T2MOD |= T2OE) //T2输出 频率TF2/2
|
||||
#define CAP1Alter( ) (PIN_FUNC |= bT2_PIN_X;) //CAP1由P10 映射到P14
|
||||
#define CAP2Alter( ) (PIN_FUNC |= bT2EX_PIN_X;) //CAP2由P11 映射RST
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer_x_ModInit(UINT8 x ,UINT8 mode)
|
||||
* Description : CH554定时计数器x模式设置
|
||||
* Input : UINT8 mode,Timer模式选择
|
||||
0:模式0,13位定时器,TLn的高3位无效
|
||||
1:模式1,16位定时器
|
||||
2:模式2,8位自动重装定时器
|
||||
3:模式3,两个8位定时器 Timer0
|
||||
3:模式3,Timer1停止
|
||||
UINT8 x 定时器 0 1 2
|
||||
* Output : None
|
||||
* Return : 成功 SUCCESS
|
||||
失败 FAIL
|
||||
*******************************************************************************/
|
||||
UINT8 mTimer_x_ModInit(UINT8 x ,UINT8 mode);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mTimer_x_SetData(UINT8 x,UINT16 dat)
|
||||
* Description : CH554Timer
|
||||
* Input : UINT16 dat;定时器赋值
|
||||
UINT8 x 定时器 0 1 2
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mTimer_x_SetData(UINT8 x,UINT16 dat);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CAP2Init(UINT8 mode)
|
||||
* Description : CH554定时计数器2 T2EX引脚捕捉功能初始化
|
||||
UINT8 mode,边沿捕捉模式选择
|
||||
0:T2ex从下降沿到下一个下降沿
|
||||
1:T2ex任意边沿之间
|
||||
3:T2ex从上升沿到下一个上升沿
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CAP2Init(UINT8 mode);
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CAP1Init(UINT8 mode)
|
||||
* Description : CH554定时计数器2 T2引脚捕捉功能初始化T2
|
||||
UINT8 mode,边沿捕捉模式选择
|
||||
0:T2ex从下降沿到下一个下降沿
|
||||
1:T2ex任意边沿之间
|
||||
3:T2ex从上升沿到下一个上升沿
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CAP1Init(UINT8 mode);
|
789
usr/USB.c
Normal file
789
usr/USB.c
Normal file
@ -0,0 +1,789 @@
|
||||
/********************************** (C) COPYRIGHT ******************************
|
||||
* File Name : USB.C
|
||||
* Author : QITAS
|
||||
* Version : V1.0
|
||||
* Date : 2018/06/05
|
||||
* Description : USB通信定义
|
||||
********************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "CH554.h"
|
||||
#include "common.h"
|
||||
#include "USB.h"
|
||||
|
||||
#pragma NOAREGS
|
||||
|
||||
#define BUFFER_SIZE 64
|
||||
//#define DUAL_BUFFER_SIZE 128
|
||||
#define UsbSetupBuf ((PUSB_SETUP_REQ)Ep0Buffer)
|
||||
|
||||
|
||||
UINT8X Ep0Buffer[DEFAULT_ENDP0_SIZE] _at_ 0x0000; // Endpoint 0, buffer OUT/OUT,the address must be even.
|
||||
UINT8X Ep1Buffer[BUFFER_SIZE] _at_ 0x000A; // Endpoint 1, buffer IN,the address must be even.
|
||||
UINT8X Ep2Buffer[BUFFER_SIZE*2] _at_ 0x0050; // Endpoint 2, buffer OUT[64]+IN[64],the address must be even.
|
||||
|
||||
/**************************** Global variable ********************************/
|
||||
UINT8 volatile SetupReq, SetupLen, UsbConfig;
|
||||
UINT8 volatile EnumOK, FLAG;
|
||||
|
||||
PUINT8 pDescr; // USB enumerate complete flag.
|
||||
USB_SETUP_REQ SetupReqBuf; // A buffer for Setup package.
|
||||
|
||||
UINT8 HIDKey[8] = {0};
|
||||
|
||||
//UINT8X TX[64] = {0};
|
||||
//UINT8X RX[64] = {0};
|
||||
//UINT8X DIS_LED[56*3] = {0};
|
||||
|
||||
UINT8X USB_BUF[128] = {0};
|
||||
|
||||
UINT8 TXflag = 0;
|
||||
UINT8 RXflag = 0;
|
||||
|
||||
/****************************LV.4 其他描述符 *********************************/
|
||||
// 语言描述符
|
||||
UINT8C MyLangDescr[] = { 0x04, 0x03, 0x09, 0x04 };
|
||||
// 厂家信息
|
||||
UINT8C MyManuInfo[] = { 0x0E, 0x03, 'O', 0, 'A', 0, 'Z', 0, 'O', 0, 'N', 0 };
|
||||
// 产品信息
|
||||
UINT8C MyProdInfo[] = { 0x0C, 0x03, 'Q', 0, 'i', 0, 't', 0, 'a', 0, 's', 0 };
|
||||
|
||||
|
||||
/**************************** Device Descriptor *************************************/
|
||||
UINT8C DevDesc[18] = { // Device Descriptor
|
||||
0x12,0x01,
|
||||
0x10,0x01, //USB1.1
|
||||
0x00,0x00,
|
||||
0x00,
|
||||
0x08, //PACKAGE SIZE 8B
|
||||
|
||||
0x31,0x51, // Vendor ID | VID = 0X5131///413c
|
||||
0x07,0x20, // Product ID | PID = 0X2007 /// 2105
|
||||
// 0x00,0x01,
|
||||
// 0x05,0x21,
|
||||
0x01,0x00, // bcdDevice:ver 1.00
|
||||
0x02,0x04, // manufactor / product
|
||||
0x00,0x01 //serialnum /confignum
|
||||
};
|
||||
/**************************** HID Report Descriptor *********************************/
|
||||
UINT8C KeyRepDesc[65] = // Report Descriptor, DELL Keyboard
|
||||
{
|
||||
0x05, 0x01, // Usage page Generatic Desktop
|
||||
0x09, 0x06, // Usage keyboard
|
||||
0xa1, 0x01, // Collation Application
|
||||
0x05, 0x07, // Usafe page (key code)
|
||||
0x19, 0xe0, // Usage Min ( E0 --> L_CTL)
|
||||
0x29, 0xe7, // Usage MAX ( E7 --> R_GUI )
|
||||
0x15, 0x00, // Logical min
|
||||
0x25, 0x01, // Logical max
|
||||
0x95, 0x08, // Report count ( 8 )
|
||||
0x75, 0x01, // Report size ( 1 )
|
||||
0x81, 0x02, // Input ( Data, Variable, Absolute )
|
||||
0x95, 0x08, // Report count ( 8 )
|
||||
0x75, 0x01, // Report size ( 1 )
|
||||
0x81, 0x01, // Input ( const )
|
||||
0x05, 0x08, // Usage page( LED )
|
||||
0x19, 0x01, // Usage min ( 1 )
|
||||
0x29, 0x03, // Usage max ( 3 )
|
||||
0x95, 0x03, // Report count ( 3 )
|
||||
0x75, 0x01, // Report size ( 1 )
|
||||
0x91, 0x02, // Output ( Data, Variable, Absolute )
|
||||
0x95, 0x01, // Report count ( 1 )
|
||||
0x75, 0x05, // Report size ( 5 )
|
||||
0x91, 0x01, // Output ( const )
|
||||
0x05, 0x07, // Usage page ( key code )
|
||||
0x19, 0x00, // Usage min ( 0H )
|
||||
0x2a, 0xff, 0x00, // Usage max ( FFH )
|
||||
0x15, 0x00, // Logical min ( 0H )
|
||||
0x26, 0xff, 0x00, // Logical max ( FFH )
|
||||
0x95, 0x06, // Report count ( 6 )
|
||||
0x75, 0x08, // Report size ( 8 )
|
||||
0x81, 0x00, // Input ( Data, Array, Absolute )
|
||||
0xc0 // End collection
|
||||
};
|
||||
|
||||
UINT8C ComRepDesc[34] = // Report Descriptor, Composite device
|
||||
{
|
||||
0x06, 0x00, 0xff, // Usage page Vendor defined
|
||||
0x09, 0x01, // Usage keyboard
|
||||
0xa1, 0x01, // Collation Application
|
||||
0x09, 0x02, // Mouse
|
||||
0x15, 0x00, // Logical min ( 0H )
|
||||
0x26, 0x00, 0xff, // Logical max ( FFH )
|
||||
0x75, 0x08, // Report size ( 08H )
|
||||
0x95, 0x40, // Report count ( 40H )
|
||||
0x81, 0x06, // Input ( Data, Relative, Wrap )
|
||||
0x09, 0x02, // Mouse
|
||||
0x15, 0x00, // Logical min ( 0H )
|
||||
0x26, 0x00, 0xff, // Logical max ( FFH )
|
||||
0x75, 0x08, // Report size ( 08H )
|
||||
0x95, 0x40, // Report count ( 40H )
|
||||
0x91, 0x06, // Output ( Data, Relative, Wrap )
|
||||
0xc0,
|
||||
};
|
||||
|
||||
/****************************LV.2 配置描述符 *********************************/
|
||||
//USB_DESCR_TYP_INTERF==4
|
||||
//USB_DESCR_TYP_CONFIG==2
|
||||
//USB_DESCR_TYP_ENDP==5
|
||||
|
||||
UINT8C CfgDesc[9+9+9+7+9+9+7+7] =
|
||||
{
|
||||
0x09,0x02,0x42,0x00,0x02,0x01,0x00,0xA0,0x32, // Configure Descriptor
|
||||
|
||||
0x09,0x04,0x00,0x00,0x02,0x03,0x00,0x00,0x00, // Interface Descriptor: Composite device, 2 EPs
|
||||
0x09,0x21,0x10,0x01,0x21,0x01,0X22,sizeof(ComRepDesc),0x00, // HID Descriptor
|
||||
|
||||
0x07,0x05,0x82,0x03,0x40,0x00,0x32, // Endpoint Descriptor, 10ms, IN
|
||||
0x07,0x05,0x02,0x03,0x40,0x00,0x0a, // Endpoint Descriptor, 10ms, OUT
|
||||
|
||||
0x09,0x04,0x01,0x00,0x01,0x03,0x01,0x01,0x00, // Interface Descriptor: keyboard
|
||||
0x09,0x21,0x11,0x01,0x00,0x01,0x22,sizeof(KeyRepDesc),0x00, // HID Descriptor
|
||||
|
||||
0x07,0x05,0x81,0x03,0x08,0x00,0x0a // Endpoint Descriptor, 50ms
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : USBDeviceInit()
|
||||
* Description : Configure USB mode ,USB device init configure.Configure tie Endpoint, compound device,
|
||||
Endpoint 0 control trans, Endpoint 1/2 interrupt(IN).
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void USBDeviceInit()
|
||||
{
|
||||
IE_USB = 0;
|
||||
USB_CTRL = 0x00; // Device mode
|
||||
|
||||
UEP1_DMA = Ep1Buffer; // Endpoint 1 uploard address
|
||||
UEP0_DMA = Ep0Buffer; // Endpoint 0 trans address
|
||||
UEP2_DMA = Ep2Buffer; // Endpoint 2 uploard address
|
||||
|
||||
UEP4_1_MOD = UEP4_1_MOD | bUEP1_TX_EN & ~(bUEP1_RX_EN | bUEP1_BUF_MOD | bUEP4_RX_EN | bUEP4_TX_EN); // Endpoint 1 sigle 64 byte send buffer, Endpoint 4 disable
|
||||
UEP1_CTRL = bUEP_AUTO_TOG | UEP_T_RES_NAK; // Endpoint 1 auto Toggle flag, In translation return NAK
|
||||
UEP0_CTRL = UEP_R_RES_ACK | UEP_T_RES_NAK; // Endpoint 0 OUT trans return ACK, IN trans return NAK
|
||||
|
||||
UEP2_3_MOD = UEP2_3_MOD | bUEP2_TX_EN | bUEP2_RX_EN & ~bUEP2_BUF_MOD; // Endpoint 2 sigle 64 byte send buffer OUT[64]+IN[64] (OUT first)
|
||||
UEP2_CTRL = bUEP_AUTO_TOG | UEP_T_RES_NAK; // Endpoint 2 auto Toggle flag, IN trans return NAK
|
||||
|
||||
USB_DEV_AD = 0x00; // Initial the device address
|
||||
UDEV_CTRL = bUD_PD_DIS; // Disable DM/PM PULL_DOWN.
|
||||
USB_CTRL = bUC_DEV_PU_EN | bUC_INT_BUSY | bUC_DMA_EN; // Enable inter PULL_UP. Auto return NAK, during interrupt routing, if the interrupt flag.
|
||||
UDEV_CTRL |= bUD_PORT_EN; // Enable USB port.
|
||||
USB_INT_FG = 0xFF; // Clear interrupt flag.
|
||||
USB_INT_EN = bUIE_SUSPEND | bUIE_TRANSFER | bUIE_BUS_RST; // Enable USB interrupt
|
||||
IE_USB = 1; // Enable USB interrupt
|
||||
UEP1_T_LEN = 0; // Reset the trans length register
|
||||
UEP2_T_LEN = 0;
|
||||
}
|
||||
/*******************************************************************************
|
||||
* Function Name : Enp1IntIn()
|
||||
* Description : USB Device mode Endpoint 1 upload data, Interrupt mode
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
static void Enp1IntIn( void )
|
||||
{
|
||||
memcpy( Ep1Buffer, HIDKey, sizeof(HIDKey)); // Upload data
|
||||
UEP1_T_LEN = sizeof(HIDKey); // Upload length
|
||||
UEP1_CTRL = UEP1_CTRL & ~ MASK_UEP_T_RES | UEP_T_RES_ACK; // Return ACK
|
||||
while(( UEP1_CTRL & MASK_UEP_T_RES ) == UEP_T_RES_ACK); // Waiting upload complete, avoid overwriting
|
||||
}
|
||||
/*******************************************************************************
|
||||
* Function Name : Enp2IntIn(UINT8 len)
|
||||
* Description : USB Device mode Endpoint 2 upload data, Interrupt mode
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void Enp2IntIn(UINT8 len)
|
||||
{
|
||||
memcpy( Ep2Buffer+MAX_PACKET_SIZE, USB_BUF, len); // Upload data
|
||||
UEP2_T_LEN = len; // Upload length
|
||||
UEP2_CTRL = UEP2_CTRL & ~ MASK_UEP_T_RES | UEP_T_RES_ACK; // Return ACK
|
||||
//while(( UEP2_CTRL & MASK_UEP_T_RES ) == UEP_T_RES_ACK); // Waiting upload complete, avoid overwriting
|
||||
}
|
||||
/*******************************************************************************
|
||||
* Function Name : Enp2TX(UINT8)
|
||||
* Description : USB Device mode Endpoint 2 upload data, Interrupt mode
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void Enp2TX(UINT8 len)
|
||||
{
|
||||
memcpy( Ep2Buffer+MAX_PACKET_SIZE, USB_BUF, len); // Upload data
|
||||
UEP2_T_LEN = len; // Upload length
|
||||
UEP2_CTRL = UEP2_CTRL & ~ MASK_UEP_T_RES | UEP_T_RES_ACK; // 允许上传 Return ACK
|
||||
while(( UEP2_CTRL & MASK_UEP_T_RES ) == UEP_T_RES_ACK); // Waiting upload complete, avoid overwriting
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : Enp2RX()
|
||||
* Description : USB Device mode Endpoint 2 upload data, Interrupt mode
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void Enp2RX()
|
||||
{
|
||||
UINT8 len;
|
||||
if(Ep2Buffer[2]==HEADER_MAGIC)
|
||||
{
|
||||
RXflag = Ep2Buffer[3];
|
||||
len = Ep2Buffer[4]*Ep2Buffer[5];
|
||||
if(len<128) memcpy(USB_BUF+len,Ep2Buffer+6, Ep2Buffer[5]);
|
||||
if(RXflag==CMD_SET_USB)
|
||||
{
|
||||
|
||||
}
|
||||
else if(RXflag==CMD_SET_POP)
|
||||
{
|
||||
|
||||
}
|
||||
else if(RXflag==CMD_SET_TST)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
len = USB_RX_LEN;
|
||||
memcpy(USB_BUF,Ep2Buffer,len);
|
||||
Enp2IntIn(len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : DeviceInterrupt()
|
||||
* Description : USB ISR
|
||||
*******************************************************************************/
|
||||
void DeviceInterrupt( void ) interrupt INT_NO_USB using 1 //USB ISR, Using register 1
|
||||
{
|
||||
UINT8 len;
|
||||
|
||||
if( UIF_TRANSFER ) //USB trans flag
|
||||
{
|
||||
switch (USB_INT_ST & (MASK_UIS_TOKEN | MASK_UIS_ENDP) )
|
||||
{
|
||||
case UIS_TOKEN_IN | 1: // Endpoint 1 upload
|
||||
{
|
||||
UEP1_T_LEN = 0; // Reset length
|
||||
UEP1_CTRL = UEP1_CTRL & ~ MASK_UEP_T_RES | UEP_T_RES_NAK; // Default return NAK
|
||||
FLAG |= 0x01; // Upload complete flag
|
||||
break;
|
||||
}
|
||||
case UIS_TOKEN_IN | 2: // Endpoint 2 upload
|
||||
{
|
||||
UEP2_T_LEN = 0; // Reset length
|
||||
UEP2_CTRL = UEP2_CTRL & ~ MASK_UEP_T_RES | UEP_T_RES_NAK; // Default return NAK
|
||||
break;
|
||||
}
|
||||
case UIS_TOKEN_OUT | 2: // Eendpoint 2 download
|
||||
if ( U_TOG_OK ) // 不同步的数据包将丢弃
|
||||
{
|
||||
Enp2RX();
|
||||
}
|
||||
case UIS_TOKEN_SETUP | 0:
|
||||
{
|
||||
len = USB_RX_LEN;
|
||||
if( len == (sizeof(USB_SETUP_REQ)) )
|
||||
{
|
||||
SetupLen = UsbSetupBuf->wLengthL;
|
||||
if(UsbSetupBuf->wLengthH || SetupLen > 0x7F )
|
||||
{
|
||||
SetupLen = 0x7F; // Total length less than 0X7F
|
||||
}
|
||||
len = 0; // Default length is 0
|
||||
if( (UsbSetupBuf->bRequestType & USB_REQ_TYP_MASK) != USB_REQ_TYP_STANDARD ) /* 非标准请求 */
|
||||
{
|
||||
if( (UsbSetupBuf->bRequestType == 0x21)&&(UsbSetupBuf->bRequest == HID_SET_REPORT) )//Init ok
|
||||
{
|
||||
EnumOK = 1; // Class require, SET REPORT, indicate the enumerate complete
|
||||
}
|
||||
if( (UsbSetupBuf->bRequestType == 0x21)&&(UsbSetupBuf->bRequest == HID_SET_IDLE) )
|
||||
{
|
||||
UEP0_T_LEN = 0; //Status stage complete, upload 0 data packet, end the control trans
|
||||
// UEP0_CTRL = bUEP_R_TOG | bUEP_T_TOG | UEP_R_RES_STALL | UEP_T_RES_STALL;
|
||||
}
|
||||
len = 0; // Fail
|
||||
}
|
||||
else
|
||||
{ // Deal with the standard require
|
||||
SetupReq = UsbSetupBuf->bRequest;
|
||||
switch( SetupReq ) // Require code
|
||||
{
|
||||
case USB_GET_DESCRIPTOR:
|
||||
{
|
||||
switch( UsbSetupBuf->wValueH )
|
||||
{
|
||||
case 1: // Device descriptor// 设备描述符
|
||||
pDescr = DevDesc; // Write device descriptor to buffer
|
||||
len = sizeof( DevDesc );
|
||||
break;
|
||||
case 2: // Configuration descriptor // 配置描述符
|
||||
pDescr = CfgDesc; // Write configuration descriptor to buffer
|
||||
len = sizeof( CfgDesc );
|
||||
break;
|
||||
case 3: // 字符串描述符
|
||||
{
|
||||
switch( UsbSetupBuf->wValueL )
|
||||
{
|
||||
case 0:
|
||||
pDescr = (PUINT8)( &MyLangDescr[0] );
|
||||
len = sizeof( MyLangDescr );
|
||||
break;
|
||||
case 2:
|
||||
pDescr = (PUINT8)( &MyManuInfo[0] );
|
||||
len = sizeof( MyManuInfo );
|
||||
break;
|
||||
case 4:
|
||||
pDescr = (PUINT8)( &MyProdInfo[0] );
|
||||
len = sizeof( MyProdInfo );
|
||||
break;
|
||||
|
||||
default:
|
||||
len = 0xFF; // 不支持的字符串描述符
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x22: // HID report descriptor
|
||||
{
|
||||
if( UsbSetupBuf->wIndexL == 1 ) // Interface index 0 HID report --> keyboard
|
||||
{
|
||||
pDescr = KeyRepDesc; // Write to buffer
|
||||
len = sizeof( KeyRepDesc );
|
||||
}
|
||||
// if( UsbSetupBuf->wIndexL == 0 ) // Interface index 1 HID report --> Composite device
|
||||
// {
|
||||
// pDescr = ComRepDesc; // Write to buffer
|
||||
// len = sizeof( ComRepDesc );
|
||||
// }
|
||||
else if(UsbSetupBuf->wIndexL == 0) // Interface index 1 HID report --> Composite device
|
||||
{
|
||||
pDescr = ComRepDesc; // Write to buffer
|
||||
len = sizeof( ComRepDesc );
|
||||
}
|
||||
else
|
||||
{
|
||||
len = 0xff; // Add interface index, if required
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
len = 0xff; // Length equal 0 if code error
|
||||
break;
|
||||
}
|
||||
|
||||
if ( len == 0xff ){
|
||||
break; // Error code, jump out the swith sentence
|
||||
}
|
||||
if ( SetupLen > len ){
|
||||
SetupLen = len; // Limit the total length
|
||||
}
|
||||
len = SetupLen >= 8 ? 8 : SetupLen; // Upload this length
|
||||
memcpy( Ep0Buffer, pDescr, len ); // Upload data
|
||||
SetupLen -= len;
|
||||
pDescr += len;
|
||||
break;
|
||||
}
|
||||
case USB_SET_ADDRESS:
|
||||
SetupLen = UsbSetupBuf->wValueL; // Save the device address
|
||||
break;
|
||||
case USB_GET_CONFIGURATION:
|
||||
{
|
||||
Ep0Buffer[0] = UsbConfig;
|
||||
if ( SetupLen >= 1 )
|
||||
{
|
||||
len = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case USB_SET_CONFIGURATION:
|
||||
{
|
||||
UsbConfig = UsbSetupBuf->wValueL;
|
||||
break;
|
||||
}
|
||||
case 0x0A:
|
||||
break;
|
||||
case USB_CLEAR_FEATURE: //Clear Feature
|
||||
{
|
||||
if ( (UsbSetupBuf->bRequestType & USB_REQ_RECIP_MASK) == USB_REQ_RECIP_ENDP )
|
||||
{
|
||||
switch( UsbSetupBuf->wIndexL )
|
||||
{
|
||||
case 0x82:
|
||||
UEP2_CTRL = UEP2_CTRL & ~ (bUEP_T_TOG | MASK_UEP_T_RES) | UEP_T_RES_NAK;
|
||||
break;
|
||||
case 0x81:
|
||||
UEP1_CTRL = UEP1_CTRL & ~ (bUEP_T_TOG | MASK_UEP_T_RES) | UEP_T_RES_NAK;
|
||||
break;
|
||||
case 0x01:
|
||||
UEP1_CTRL = UEP1_CTRL & ~ (bUEP_R_TOG | MASK_UEP_R_RES) | UEP_R_RES_ACK;
|
||||
break;
|
||||
default:
|
||||
len = 0xFF; // Error endpoint
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
len = 0xFF; // Deal with the error endpoint
|
||||
}
|
||||
break;
|
||||
}
|
||||
case USB_SET_FEATURE: // Set Feature
|
||||
{
|
||||
if( (UsbSetupBuf->bRequestType & 0x1F) == 0x00 )
|
||||
{
|
||||
if( ( ((UINT16)UsbSetupBuf->wValueH << 8) | UsbSetupBuf->wValueL ) == 0x01 )
|
||||
{
|
||||
if( CfgDesc[ 7 ] & 0x20 )
|
||||
{
|
||||
/* Awake the device */
|
||||
}
|
||||
else
|
||||
{
|
||||
len = 0xFF; // Error routing
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
len = 0xFF; // Error routing
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( (UsbSetupBuf->bRequestType & 0x1F) == 0x02 ) // Set endpoint
|
||||
{
|
||||
if( ( ((UINT16)UsbSetupBuf->wValueH << 8) | UsbSetupBuf->wValueL ) == 0x00 )
|
||||
{
|
||||
switch( ((UINT16)UsbSetupBuf->wIndexH << 8) | UsbSetupBuf->wIndexL )
|
||||
{
|
||||
case 0x82:
|
||||
UEP2_CTRL = UEP2_CTRL & (~bUEP_T_TOG) | UEP_T_RES_STALL;/* Endpoint 2 IN STALL */
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
UEP2_CTRL = UEP2_CTRL & (~bUEP_R_TOG) | UEP_R_RES_STALL;/* Endpoint 2 OUT STALL */
|
||||
break;
|
||||
|
||||
case 0x81:
|
||||
UEP1_CTRL = UEP1_CTRL & (~bUEP_T_TOG) | UEP_T_RES_STALL;/* Endpoint 1 IN STALL */
|
||||
break;
|
||||
|
||||
default:
|
||||
len = 0xFF; // Error routing
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
len = 0xFF; // Error routing
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
len = 0xFF; // Error routing
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case USB_GET_STATUS: // Get status
|
||||
{
|
||||
Ep0Buffer[0] = 0x00;
|
||||
Ep0Buffer[1] = 0x00;
|
||||
if ( SetupLen >= 2 )
|
||||
{
|
||||
len = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
len = SetupLen;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
len = 0xff; // Error routing
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
len = 0xff; //Packet length error
|
||||
}
|
||||
if(len == 0xff)
|
||||
{
|
||||
SetupReq = 0xFF;
|
||||
// UEP0_CTRL = bUEP_R_TOG | bUEP_T_TOG | UEP_R_RES_STALL | UEP_T_RES_STALL; // Control endpoint should not return STALL,
|
||||
// if Send STALL, that means the device has no ability to communicate with the host
|
||||
}
|
||||
else if(len <= 8) // Upload the data or return the 0 data packet
|
||||
{
|
||||
UEP0_T_LEN = len;
|
||||
UEP0_CTRL = bUEP_R_TOG | bUEP_T_TOG | UEP_R_RES_ACK | UEP_T_RES_ACK; // Default data packet is DATA1, and return ACK
|
||||
}
|
||||
else
|
||||
{
|
||||
UEP0_T_LEN = 0; // Upload 0 data packet, incase the host go to status stage ahead, and get fault code
|
||||
UEP0_CTRL = bUEP_R_TOG | bUEP_T_TOG | UEP_R_RES_ACK | UEP_T_RES_ACK; // Default data packet is DATA1, and return ACK
|
||||
}
|
||||
break;
|
||||
}
|
||||
case UIS_TOKEN_IN | 0: // Endpoint 0 IN
|
||||
{
|
||||
switch(SetupReq)
|
||||
{
|
||||
case USB_GET_DESCRIPTOR:
|
||||
len = SetupLen >= 8 ? 8 : SetupLen; // Current length
|
||||
memcpy( Ep0Buffer, pDescr, len ); // Upload the data
|
||||
SetupLen -= len;
|
||||
pDescr += len;
|
||||
UEP0_T_LEN = len;
|
||||
UEP0_CTRL ^= bUEP_T_TOG; //Toggle Sysc flag
|
||||
break;
|
||||
case USB_SET_ADDRESS:
|
||||
USB_DEV_AD = USB_DEV_AD & bUDA_GP_BIT | SetupLen;
|
||||
UEP0_CTRL = UEP_R_RES_ACK | UEP_T_RES_NAK;
|
||||
break;
|
||||
default:
|
||||
// UEP0_T_LEN = 0; //Status stage complete, upload 0 data packet, end the control trans
|
||||
// UEP0_CTRL = UEP_R_RES_ACK | UEP_T_RES_NAK;
|
||||
break;
|
||||
}
|
||||
if(len == 0xff)
|
||||
{
|
||||
UEP0_T_LEN = 0; //Status stage complete, upload 0 data packet, end the control trans
|
||||
UEP0_CTRL = UEP_R_RES_ACK | UEP_T_RES_NAK;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case UIS_TOKEN_OUT | 0: // Endpoint 0 OUT
|
||||
{
|
||||
len = USB_RX_LEN;
|
||||
if( SetupReq == 0x09 )
|
||||
{
|
||||
if( Ep0Buffer[0] )
|
||||
{
|
||||
|
||||
}
|
||||
else if( Ep0Buffer[0] == 0)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
UEP0_T_LEN = 0; // Upload 0 data packet, incase the host go to status stage ahead, and get fault code
|
||||
UEP0_CTRL = UEP_R_RES_ACK | UEP_T_RES_ACK; // Default data packet is DATA1, and return ACK
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
UIF_TRANSFER = 0; // Reset the trans interrupt
|
||||
}// end if( UIF_TRANSFER )
|
||||
if( UIF_BUS_RST ) // Device mode Bus reset
|
||||
{
|
||||
UEP0_CTRL = UEP_R_RES_ACK | UEP_T_RES_NAK;
|
||||
UEP1_CTRL = bUEP_AUTO_TOG | UEP_R_RES_ACK;
|
||||
UEP2_CTRL = bUEP_AUTO_TOG | UEP_R_RES_ACK | UEP_T_RES_NAK;
|
||||
USB_DEV_AD = 0x00;
|
||||
UIF_SUSPEND = 0;
|
||||
UIF_TRANSFER = 0;
|
||||
UIF_BUS_RST = 0; // Reset Reset interrupt
|
||||
}
|
||||
if( UIF_SUSPEND ) // USB Suspended and Awake interrupt
|
||||
{
|
||||
UIF_SUSPEND = 0;
|
||||
if ( USB_MIS_ST & bUMS_SUSPEND ) // Suspended
|
||||
{
|
||||
while ( XBUS_AUX & bUART0_TX ); // Waiting send complete ...
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xAA;
|
||||
WAKE_CTRL = bWAK_BY_USB | bWAK_RXD0_LO; // Action on USB Bus, or RXD0, will awake the device
|
||||
PCON |= PD; // LPM
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xAA;
|
||||
WAKE_CTRL = 0x00;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Unexpected interrupt
|
||||
USB_INT_FG = 0xFF; // Reset the interrupt
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : static SendKey( char *p)
|
||||
* Description : ASCII to key code
|
||||
* Input : char *p
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
static void SendKey( char *p )
|
||||
{
|
||||
char c = *p;
|
||||
if( (c >= 'a') && (c <= 'z' ))
|
||||
{
|
||||
c = c - 'a' + 'A';
|
||||
}
|
||||
if( (c >= 'A') && (c <= 'Z' ))
|
||||
{
|
||||
HIDKey[2] = c - 'A' + 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( c >= '1' && c <= '9' ) HIDKey[2] = c - '1' + 0X1E;
|
||||
else
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
case '`' :
|
||||
HIDKey[0] = 0X08;
|
||||
HIDKey[2] = 0X15;
|
||||
break;
|
||||
case '\\':
|
||||
HIDKey[2] = 0x31;
|
||||
break;
|
||||
case ' ':
|
||||
HIDKey[2] = L_SHIFT;
|
||||
break;
|
||||
case '\r':
|
||||
HIDKey[2] = ENTER;
|
||||
break;
|
||||
case ':':
|
||||
HIDKey[0] = 0x02;
|
||||
HIDKey[2] = 0x33;
|
||||
break;
|
||||
case '+':
|
||||
HIDKey[0] = 0x000;
|
||||
HIDKey[2] = 0x57;
|
||||
break;
|
||||
case '_':
|
||||
HIDKey[0] = 0X02;
|
||||
HIDKey[2] = 0X2D;
|
||||
break;
|
||||
case '/':
|
||||
HIDKey[0] = L_CTL + L_ALT;
|
||||
HIDKey[2] = 0X16;
|
||||
break;
|
||||
case '0':
|
||||
HIDKey[2] = 0X27;
|
||||
break;
|
||||
case '.':
|
||||
HIDKey[2] = 0X37;
|
||||
break;
|
||||
case '~':
|
||||
HIDKey[0] = L_ALT;
|
||||
HIDKey[2] = 0X05;
|
||||
break;
|
||||
case '!':
|
||||
HIDKey[0] = L_ALT;
|
||||
HIDKey[2] = 0X08;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
delayms( 20 ); //emulate the press down and pop up
|
||||
while(FLAG == 0); // Upload the key
|
||||
Enp1IntIn();
|
||||
while(FLAG == 0);
|
||||
delayms( 20 );
|
||||
HIDKey[0] = 0X00;
|
||||
HIDKey[2] = 0X00; // Reset the key
|
||||
while(FLAG == 0);
|
||||
Enp1IntIn();
|
||||
while(FLAG == 0);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : extern HIDValueHandle( void )
|
||||
* Description : Upload the HID code
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
|
||||
void TSTKey(void)
|
||||
{
|
||||
// UINT16 KeyData;
|
||||
// if(TKEY_CTRL&bTKC_IF)
|
||||
// {
|
||||
// KeyData = TKEY_DAT;
|
||||
// if (KeyData < (TouchKeyButton-100)) //100 灵敏度调节
|
||||
// {
|
||||
// TXflag =SENDK;
|
||||
// }
|
||||
// mDelaymS( 200 );
|
||||
// }
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : TXflagHandle(UINT8 val)
|
||||
* Description :
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
|
||||
char code sPath[] = "` E:\\vck1\\hid_recv.exe \r "; // The path for the software. SPACE for delay
|
||||
char *pStr = sPath;
|
||||
|
||||
|
||||
void TXflagHandle(UINT8 val)
|
||||
{
|
||||
UINT8 i;
|
||||
char btn[4];
|
||||
//TSTKey();
|
||||
if(TXflag & 0X01) //测试激活指令,不启用
|
||||
{
|
||||
SendKey(pStr); // Upload path
|
||||
pStr++;
|
||||
if(*pStr == '\0')
|
||||
{
|
||||
SendKey( "~" ); // Upload ALT+B
|
||||
delayms( 200 );
|
||||
TXflag = 0;
|
||||
}
|
||||
}
|
||||
else if(TXflag & SENDK) //键盘按键发送
|
||||
{
|
||||
btn[0]= val;
|
||||
SendKey(btn);
|
||||
TXflag &= ~SENDK;
|
||||
}
|
||||
else if(TXflag & SENDD) //数据通道发送
|
||||
{
|
||||
if(val>0)
|
||||
{
|
||||
Enp2TX(val);
|
||||
TXflag &= ~SENDD;
|
||||
}
|
||||
}
|
||||
else if(TXflag & 0x08) //键盘发送数字,暂时无应用
|
||||
{
|
||||
btn[3]= '\r';
|
||||
btn[2]= (val%10)+ 0x30;
|
||||
i = (val/10);
|
||||
btn[1]= (i%10)+ 0x30;
|
||||
btn[0]= (i/10)+ 0x30;
|
||||
|
||||
for(i=0;i<4;i++)
|
||||
{
|
||||
SendKey(btn+i);
|
||||
}
|
||||
memset(btn,0,4);
|
||||
TXflag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************** END *************************************/
|
72
usr/USB.h
Normal file
72
usr/USB.h
Normal file
@ -0,0 +1,72 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : USB.C *
|
||||
* Author : QITAS *
|
||||
* Version : V1.0 *
|
||||
* Date : 2018/06/06 *
|
||||
* Description : USB通信定义
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
#ifndef __USB_H__
|
||||
#define __USB_H__
|
||||
|
||||
#define L_WIN 0X08
|
||||
#define L_ALT 0X04
|
||||
#define L_SHIFT 0X02
|
||||
#define L_CTL 0X01
|
||||
#define R_WIN 0X80
|
||||
#define R_ALT 0X40
|
||||
#define R_SHIFT 0X20
|
||||
#define R_CTL 0X10
|
||||
#define SPACE 0X2C
|
||||
#define ENTER 0X28
|
||||
|
||||
#define PowerON 26 //&
|
||||
#define PowerOFF 21 //!
|
||||
#define KEY_1 65 //A
|
||||
#define KEY_2 66
|
||||
#define KEY_3 67
|
||||
#define KEY_4 68
|
||||
#define KEY_5 69
|
||||
#define KEY_6 70
|
||||
#define KEY_0 71
|
||||
|
||||
//发送通道选择,通过TXflag标记
|
||||
#define SENDK 0x02
|
||||
#define SENDD 0x04
|
||||
|
||||
|
||||
//发送通道选择,通过RXflag标记
|
||||
#define ERROR 0xEE
|
||||
#define LONG 0xFF
|
||||
|
||||
|
||||
|
||||
//帧头数据
|
||||
#define HEADER_MAGIC 0x5A
|
||||
|
||||
//上位机发送给MCU的命令类型
|
||||
|
||||
#define CMD_SET_USB 0x01
|
||||
#define CMD_SET_POP 0x02
|
||||
#define CMD_SET_TST 0x40
|
||||
|
||||
//MCU返回给上位机的命令类型
|
||||
#define RTNN 0x60
|
||||
#define CMD_RTN_SET_DISPLAY RTNN+CMD_SET_DISPLAY
|
||||
#define CMD_RTN_GET_VOLUME RTNN+CMD_GET_VOLUME
|
||||
|
||||
extern UINT16I TouchKeyButton;
|
||||
|
||||
//extern UINT8X TX[64]; //发送数据
|
||||
//extern UINT8X RX[64]; //放置其他接收数据
|
||||
extern UINT8X USB_BUF[128];
|
||||
|
||||
extern UINT8 TXflag;
|
||||
extern UINT8 RXflag;
|
||||
|
||||
extern void USBDeviceInit();
|
||||
extern void TXflagHandle(UINT8 val); //val参数根据TXflag有不同的意义
|
||||
|
||||
#endif
|
||||
/**************************** END *************************************/
|
244
usr/common.c
Normal file
244
usr/common.c
Normal file
@ -0,0 +1,244 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : Debug.C
|
||||
* Author : WCH
|
||||
* Version : V1.0
|
||||
* Date : 2017/01/20
|
||||
* Description : CH554 DEBUG Interface
|
||||
CH554主频修改、延时函数定义
|
||||
串口0和串口1初始化
|
||||
串口0和串口1的收发子函数
|
||||
看门狗初始化
|
||||
*******************************************************************************/
|
||||
#include <intrins.h>
|
||||
#include "CH554.H"
|
||||
#include "common.h"
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CfgFsys( )
|
||||
* Description : CH554时钟选择和配置函数,默认使用Fsys 6MHz,FREQ_SYS可以通过
|
||||
CLOCK_CFG配置得到,公式如下:
|
||||
Fsys = (Fosc * 4/(CLOCK_CFG & MASK_SYS_CK_SEL);具体时钟需要自己配置
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CfgFsys( )
|
||||
{
|
||||
// SAFE_MOD = 0x55;
|
||||
// SAFE_MOD = 0xAA; //进入安全模式 SFR寄存器修改必须先进入安全模式下
|
||||
|
||||
// CLOCK_CFG |= bOSC_EN_XT; //使能外部晶振
|
||||
// CLOCK_CFG &= ~bOSC_EN_INT; //关闭内部晶振 切换到外部晶振
|
||||
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xAA;
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x07; // 32MHz
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x06; // 24MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x05; // 16MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x04; // 12MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x03; // 6MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x02; // 3MHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x01; // 750KHz
|
||||
// CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x00; // 187.5MHz
|
||||
SAFE_MOD = 0x00; //退出安全模式
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : L0_nop_1us(void)
|
||||
* Description : 1us延时函数
|
||||
* Input : UNIT16 n
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void L0_nop_1us(void) // 以uS为单位延时
|
||||
{
|
||||
_nop_();_nop_();_nop_();_nop_();_nop_();
|
||||
_nop_();_nop_();_nop_();_nop_();_nop_();
|
||||
_nop_();_nop_();_nop_();_nop_();_nop_();
|
||||
_nop_();_nop_();_nop_();_nop_();_nop_();
|
||||
_nop_();_nop_();
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mDelayus(UNIT16 n)
|
||||
* Description : us延时函数
|
||||
* Input : UNIT16 n
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void delayus( UINT16 n ) // 以uS为单位延时
|
||||
{
|
||||
while( n )
|
||||
{
|
||||
L0_nop_1us();
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mDelayms(UNIT16 n)
|
||||
* Description : ms延时函数
|
||||
* Input : UNIT16 n
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void delayms( UINT16 n ) // 以mS为单位延时
|
||||
{
|
||||
while ( n )
|
||||
{
|
||||
delayus(1000);
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0Alter()
|
||||
* Description : CH554串口0引脚映射,串口映射到P0.2和P0.3
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART0Alter()
|
||||
{
|
||||
PIN_FUNC |= bUART0_PIN_X; //串口映射到P1.2和P1.3
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : mInitSTDIO()
|
||||
* Description : CH554串口0初始化,默认使用T1作UART0的波特率发生器,也可以使用T2
|
||||
作为波特率发生器
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void mInitSTDIO( )
|
||||
{
|
||||
UINT32 x;
|
||||
UINT8 x2;
|
||||
|
||||
SM0 = 0; //串口数据位数 8位
|
||||
SM1 = 1; //串口波特率选择 0-设置固定波特率 1-可变波特率 由t1t2产生
|
||||
SM2 = 0; //串口0使用模式1
|
||||
//使用Timer1作为波特率发生器
|
||||
RCLK = 0; //UART0接收时钟
|
||||
TCLK = 0; //UART0发送时钟
|
||||
PCON |= SMOD;
|
||||
x = 10 * FREQ_SYS / UART0_BUAD / 16; //如果更改主频,注意x的值不要溢出
|
||||
x2 = x % 10;
|
||||
x /= 10;
|
||||
if ( x2 >= 5 ) x ++; //四舍五入
|
||||
//PIN_FUNC
|
||||
TMOD = TMOD & ~ bT1_GATE & ~ bT1_CT & ~ MASK_T1_MOD | bT1_M1; //0X20,Timer1作为8位自动重载定时器
|
||||
T2MOD = T2MOD | bTMR_CLK | bT1_CLK; //Timer1时钟选择
|
||||
TH1 = 0-x; //12MHz晶振,buad/12为实际需设置波特率
|
||||
TR1 = 1; //启动定时器1
|
||||
TI = 1;
|
||||
REN = 1; //串口0接收使能
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0RcvByte()
|
||||
* Description : CH554UART0接收一个字节
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : SBUF
|
||||
*******************************************************************************/
|
||||
UINT8 CH554UART0RcvByte( )
|
||||
{
|
||||
while(RI == 0); //查询接收,中断方式可不用
|
||||
RI = 0;
|
||||
return SBUF;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART0SendByte(UINT8 SendDat)
|
||||
* Description : CH554UART0发送一个字节
|
||||
* Input : UINT8 SendDat;要发送的数据
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART0SendByte(UINT8 SendDat)
|
||||
{
|
||||
SBUF = SendDat; //查询发送,中断方式可不用下面2条语句,但发送前需TI=0
|
||||
while(TI ==0);
|
||||
TI = 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : UART1Setup()
|
||||
* Description : CH554串口1初始化
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void UART1Setup( )
|
||||
{
|
||||
U1SM0 = 0; //UART1选择8位数据位
|
||||
U1SMOD = 1; //快速模式
|
||||
U1REN = 1; //使能接收
|
||||
SBAUD1 = 0 - FREQ_SYS/16/UART1_BUAD;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART1RcvByte()
|
||||
* Description : CH554UART1接收一个字节
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : SBUF
|
||||
*******************************************************************************/
|
||||
UINT8 CH554UART1RcvByte( )
|
||||
{
|
||||
while(U1RI == 0); //查询接收,中断方式可不用
|
||||
U1RI = 0;
|
||||
return SBUF1;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554UART1SendByte(UINT8 SendDat)
|
||||
* Description : CH554UART1发送一个字节
|
||||
* Input : UINT8 SendDat;要发送的数据
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void CH554UART1SendByte(UINT8 SendDat)
|
||||
{
|
||||
SBUF1 = SendDat; //查询发送,中断方式可不用下面2条语句,但发送前需TI=0
|
||||
while(U1TI ==0);
|
||||
U1TI = 1;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554WDTModeSelect(UINT8 mode)
|
||||
* Description : CH554看门狗模式选择
|
||||
* Input : UINT8 mode
|
||||
0 timer
|
||||
1 watchDog
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void WDTModeSelect(UINT8 mode)
|
||||
{
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xaa; //进入安全模式
|
||||
if(mode){
|
||||
GLOBAL_CFG |= bWDOG_EN; //启动看门狗复位
|
||||
}
|
||||
else GLOBAL_CFG &= ~bWDOG_EN; //启动看门狗仅仅作为定时器
|
||||
SAFE_MOD = 0x00; //退出安全模式
|
||||
WDOG_COUNT = 0; //看门狗赋初值
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : CH554WDTFeed(UINT8 tim)
|
||||
* Description : CH554看门狗定时时间设置
|
||||
* Input : UINT8 tim 看门狗复位时间设置
|
||||
00H(6MHz)=2.8s
|
||||
80H(6MHz)=1.4s
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void WDTFeed(UINT8 tim)
|
||||
{
|
||||
WDOG_COUNT = tim; //看门狗计数器赋值
|
||||
}
|
49
usr/common.h
Normal file
49
usr/common.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* 调试 */
|
||||
/* 提供printf子程序和延时函数 */
|
||||
|
||||
#ifndef __DEBUG_H__
|
||||
#define __DEBUG_H__
|
||||
|
||||
//定义函数返回值
|
||||
#ifndef SUCCESS
|
||||
#define SUCCESS 0
|
||||
#endif
|
||||
#ifndef FAIL
|
||||
#define FAIL 0xFF
|
||||
#endif
|
||||
|
||||
//定义定时器起始
|
||||
#ifndef START
|
||||
#define START 1
|
||||
#endif
|
||||
#ifndef STOP
|
||||
#define STOP 0
|
||||
#endif
|
||||
|
||||
#ifndef DE_PRINTF
|
||||
#define DE_PRINTF 0
|
||||
#endif
|
||||
#define FREQ_SYS 12000000 //系统主频12MHz
|
||||
#ifndef UART0_BUAD
|
||||
#define UART0_BUAD 9600
|
||||
#define UART1_BUAD 9600
|
||||
#endif
|
||||
|
||||
void CfgFsys( ); //CH554时钟选择和配置
|
||||
void L0_nop_1us(void);
|
||||
|
||||
void delayus( UINT16 n ); // 以uS为单位延时
|
||||
void delayms( UINT16 n ); // 以mS为单位延时
|
||||
|
||||
void CH554UART0Alter(); //CH554串口0引脚映射到P0.2/P0.3
|
||||
void mInitSTDIO( ); //T1作为波特率发生器
|
||||
UINT8 CH554UART0RcvByte( ); //CH554 UART0查询方式接收一个字节
|
||||
void CH554UART0SendByte(UINT8 SendDat); //CH554UART0发送一个字节
|
||||
|
||||
void UART1Setup( ); //
|
||||
UINT8 CH554UART1RcvByte( ); //CH554 UART1查询方式接收一个字节
|
||||
void CH554UART1SendByte(UINT8 SendDat); //CH554UART1发送一个字节
|
||||
|
||||
void WDTModeSelect(UINT8 mode); //CH554看门狗模式设置
|
||||
void WDTFeed(UINT8 tim); //CH554看门狗喂狗
|
||||
#endif
|
347
usr/font.c
Normal file
347
usr/font.c
Normal file
@ -0,0 +1,347 @@
|
||||
|
||||
#include "CH554.h"
|
||||
#include "Debug.h"
|
||||
#include "font.h"
|
||||
//#include "sys.h"
|
||||
|
||||
u8 code image[]={ /* 0X00,0X10,0X28,0X00,0X28,0X00,0X01,0X1B,*/
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XBE,0XF7,0X7D,0XEF,
|
||||
0XBA,0XD6,0XB6,0XB5,0XF3,0X9C,0XB2,0X94,0XB3,0X9C,0XB2,0X94,0X34,0XA5,0XF7,0XBD,
|
||||
0XFB,0XDE,0X7D,0XEF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XBE,0XF7,0XFB,0XDE,0XF3,0X9C,0XCB,0X5A,
|
||||
0XC7,0X39,0X04,0X21,0X82,0X10,0X42,0X10,0X42,0X10,0X41,0X08,0X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,0X86,0X31,0X45,0X29,0X45,0X29,
|
||||
0XC3,0X18,0XC3,0X18,0XB2,0X94,0X7D,0XEF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XBE,0XF7,0XB2,0X8C,0X41,0X08,
|
||||
0XC7,0X39,0X08,0X42,0X49,0X4A,0X49,0X4A,0X8A,0X52,0X8A,0X52,0X4A,0X4A,0XD0,0X7B,
|
||||
0X7A,0XC6,0X7B,0XBE,0X90,0X6B,0XC9,0X39,0X88,0X31,0XC9,0X39,0XB3,0X84,0XBB,0XC6,
|
||||
0XF8,0XB5,0XCC,0X5A,0X86,0X31,0XC7,0X39,0XC7,0X39,0X86,0X31,0X45,0X29,0X45,0X29,
|
||||
0XC4,0X20,0X41,0X08,0X30,0X84,0X3C,0XE7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X3C,0XE7,0X8A,0X4A,0XC3,0X10,
|
||||
0XC7,0X39,0X08,0X42,0X49,0X4A,0X49,0X4A,0X4A,0X4A,0X4A,0X42,0X09,0X3A,0X08,0X4A,
|
||||
0X09,0X6B,0X49,0X7B,0XC6,0X7A,0X05,0X83,0X46,0X83,0XC5,0X7A,0XC6,0X72,0X09,0X7B,
|
||||
0X48,0X5A,0X87,0X31,0X88,0X21,0X88,0X29,0X86,0X31,0X86,0X31,0X45,0X29,0X45,0X29,
|
||||
0X04,0X21,0X41,0X08,0X4A,0X4A,0XBA,0XD6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF7,0XC5,0X82,0X50,0X05,0X41,
|
||||
0XC7,0X29,0X08,0X42,0X49,0X4A,0X4A,0X42,0X49,0X4A,0X09,0X7B,0X88,0X9B,0XC6,0XB3,
|
||||
0X21,0XD4,0XA0,0XDC,0XE1,0XE4,0X61,0XED,0X61,0XED,0X21,0XED,0XA0,0XE4,0X20,0XDC,
|
||||
0X80,0XCB,0X43,0XAB,0XC4,0X82,0X06,0X5A,0X47,0X21,0X46,0X29,0X45,0X29,0X04,0X29,
|
||||
0X04,0X19,0X82,0X10,0X82,0X18,0XF3,0X9C,0X7D,0XEF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7D,0XEF,0X4D,0X93,0X00,0XA0,0X82,0XB8,
|
||||
0XC7,0X31,0X09,0X32,0X49,0X4A,0X86,0X7A,0X43,0XC3,0X6B,0XED,0XF4,0XF6,0XEB,0XFD,
|
||||
0X20,0XFD,0X20,0XFD,0X60,0XFD,0XA0,0XFD,0XA0,0XFD,0X60,0XFD,0X60,0XFD,0X20,0XFD,
|
||||
0XE0,0XFC,0XA0,0XFC,0X60,0XF4,0XC1,0XDB,0X83,0X9A,0XC5,0X49,0X45,0X29,0X04,0X19,
|
||||
0XC4,0X20,0X82,0X38,0X00,0X50,0XCB,0X6A,0XBA,0XD6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFB,0XEE,0X04,0XA1,0X00,0XC0,0X00,0XF0,
|
||||
0XC3,0XA0,0XC8,0X41,0X49,0X42,0X05,0X9B,0X20,0XFC,0XA4,0XFC,0X69,0XFD,0XE8,0XFD,
|
||||
0X63,0XFD,0X20,0XFD,0X60,0XFD,0X60,0XFD,0X60,0XFD,0X20,0XFD,0X20,0XFD,0XE0,0XFC,
|
||||
0XE0,0XFC,0XA0,0XFC,0X60,0XFC,0X20,0XFC,0X41,0XD3,0XC5,0X49,0X45,0X19,0XC4,0X38,
|
||||
0X82,0X68,0X41,0X88,0X00,0X70,0X49,0X5A,0X79,0XCE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFB,0XF6,0X82,0XC0,0X00,0XD0,0X86,0XC1,
|
||||
0X46,0XF1,0X41,0XC8,0X45,0X79,0X89,0X52,0X88,0X62,0X86,0X6A,0XC6,0X7A,0XC4,0XBB,
|
||||
0XE1,0XFC,0X60,0XFD,0X60,0XFD,0XA0,0XFD,0XA0,0XFD,0X60,0XFD,0X60,0XFD,0XE0,0XFC,
|
||||
0X60,0XE4,0X03,0X93,0X84,0X72,0X44,0X6A,0XC5,0X41,0X45,0X29,0XC3,0X58,0X41,0XA8,
|
||||
0X40,0X98,0X00,0XB0,0X00,0X60,0X0C,0X6B,0X79,0XCE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7D,0XEF,0XCE,0X83,0X82,0X88,0X00,0XF8,0XC4,0XD8,
|
||||
0X0C,0XF3,0X8A,0XFA,0X82,0XE8,0X82,0XB0,0X45,0X69,0XC7,0X51,0X08,0X42,0X08,0X3A,
|
||||
0X86,0X5A,0X83,0X9B,0XA2,0XBC,0X22,0XCD,0X21,0XCD,0XA1,0XC4,0X22,0XB4,0XC4,0X7A,
|
||||
0X06,0X3A,0X86,0X29,0X45,0X29,0X05,0X31,0XC4,0X50,0X41,0X90,0X00,0XC0,0X00,0XA8,
|
||||
0X00,0XA0,0X00,0XA8,0X00,0X30,0X4A,0X4A,0XBA,0XD6,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0X7D,0XEF,0X8E,0X73,0XC3,0X18,0X05,0X39,0X82,0XA8,0X00,0XF8,
|
||||
0XC3,0XF8,0X4D,0XFB,0X4D,0XFB,0XC7,0XF9,0XC3,0XF0,0X82,0XD8,0XC3,0XB0,0X04,0X81,
|
||||
0X45,0X61,0X46,0X51,0X86,0X49,0X86,0X49,0X46,0X41,0X45,0X41,0X45,0X41,0X45,0X41,
|
||||
0X05,0X49,0X04,0X61,0X82,0X90,0X41,0XB0,0X00,0XD0,0X00,0XC8,0X00,0XA8,0X00,0XA8,
|
||||
0X00,0XB8,0X41,0X58,0X82,0X10,0X82,0X10,0XB2,0X94,0XBE,0XF7,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XBE,0XF7,0XCF,0X7B,0X82,0X10,0X04,0X21,0X86,0X29,0X86,0X41,0X04,0X99,
|
||||
0X40,0XE8,0X41,0XF8,0X86,0XF9,0XCB,0XFA,0X49,0XFA,0X82,0XF8,0X00,0XF8,0X00,0XF0,
|
||||
0X00,0XE8,0X41,0XD8,0X41,0XD0,0X41,0XC0,0X41,0XC0,0X41,0XC0,0X41,0XC0,0X41,0XC8,
|
||||
0X00,0XD0,0X00,0XE0,0X00,0XE0,0X00,0XD8,0X00,0XD0,0X00,0XB8,0X00,0XA8,0X41,0X88,
|
||||
0X82,0X48,0X82,0X10,0X82,0X10,0X00,0X00,0X45,0X29,0X79,0XCE,0XFF,0XFF,0XFF,0XFF,
|
||||
0XBE,0XF7,0XF3,0X9C,0X82,0X10,0XC3,0X18,0X45,0X29,0X86,0X31,0XC7,0X31,0X30,0X7C,
|
||||
0XF3,0XDC,0X86,0XE1,0X00,0XF0,0X00,0XF8,0X41,0XF8,0X41,0XF8,0X00,0XF8,0X00,0XF8,
|
||||
0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,
|
||||
0X00,0XE8,0X00,0XE0,0X00,0XE0,0X00,0XD8,0X00,0XC8,0X41,0XA0,0X8A,0X9A,0X0C,0X63,
|
||||
0X04,0X11,0X82,0X10,0X82,0X10,0X41,0X08,0X00,0X00,0X4D,0X6B,0X7D,0XEF,0XFF,0XFF,
|
||||
0XFB,0XDE,0X08,0X42,0X42,0X10,0X45,0X29,0X86,0X31,0X86,0X31,0X49,0X4A,0X38,0XBE,
|
||||
0XFF,0XFF,0X38,0XD6,0X86,0XA9,0X00,0XC8,0X00,0XE0,0X00,0XF0,0X00,0XF8,0X00,0XF8,
|
||||
0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF8,0X00,0XF0,0X00,0XF0,
|
||||
0X00,0XE8,0X00,0XE0,0X00,0XD0,0XC3,0X98,0X8A,0X8A,0XB2,0XA4,0XBA,0XC6,0XF7,0XB5,
|
||||
0X08,0X42,0X41,0X08,0X82,0X10,0X41,0X08,0X00,0X00,0X45,0X29,0XF7,0XBD,0XFF,0XFF,
|
||||
0X71,0X8C,0X41,0X08,0X04,0X21,0X45,0X29,0X86,0X31,0X86,0X31,0X0C,0X63,0X3C,0XE7,
|
||||
0XFF,0XFF,0X79,0XD6,0X46,0XB9,0X00,0XE0,0X42,0XC8,0X82,0XA8,0X82,0XB0,0X41,0XD8,
|
||||
0X82,0XE8,0X82,0XF0,0X41,0XE8,0X41,0XE8,0X41,0XE8,0X41,0XF0,0X41,0XE8,0X41,0XD8,
|
||||
0X04,0XC1,0X08,0X92,0X4D,0X8B,0X34,0XA5,0XFB,0XC6,0XFB,0XD6,0XBA,0XCE,0X3C,0XE7,
|
||||
0X30,0X84,0XC3,0X18,0X41,0X08,0X41,0X08,0X00,0X00,0X41,0X08,0XCF,0X7B,0X7D,0XEF,
|
||||
0X49,0X4A,0X00,0X00,0X04,0X21,0X45,0X29,0X46,0X31,0X86,0X31,0X30,0X84,0XFF,0XFF,
|
||||
0XFF,0XF7,0XF7,0XDD,0X09,0XDA,0X83,0XF8,0X01,0XF0,0X42,0XC0,0X82,0X98,0X49,0X9A,
|
||||
0XF3,0XB4,0XF3,0XCC,0X71,0XBC,0X8E,0XBB,0X8E,0XBB,0X30,0XBC,0X71,0XBC,0XF3,0XBC,
|
||||
0XB6,0XBD,0XFB,0XCE,0XBE,0XE7,0X7D,0XE7,0X3B,0XDF,0XBA,0XD6,0X79,0XCE,0XFB,0XDE,
|
||||
0X75,0XAD,0X86,0X31,0X41,0X08,0X41,0X08,0X00,0X00,0X00,0X00,0X49,0X4A,0XFB,0XDE,
|
||||
0X04,0X21,0X41,0X08,0X04,0X21,0X45,0X29,0X45,0X29,0X87,0X39,0XB2,0X94,0XFF,0XFF,
|
||||
0XBE,0XF7,0X34,0XDD,0X0C,0XEB,0X09,0XFA,0X00,0XF0,0X01,0XD8,0X00,0XD8,0X8B,0XD2,
|
||||
0X7D,0XE7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XBE,0XFF,0X7D,0XEF,0XFB,0XDE,0XFB,0XDE,0XBA,0XD6,0X79,0XCE,0XBA,0XD6,
|
||||
0X78,0XC6,0XC7,0X39,0X00,0X00,0X41,0X08,0X00,0X00,0X00,0X00,0XC7,0X39,0X79,0XCE,
|
||||
0X00,0X00,0X82,0X10,0XC3,0X18,0X04,0X21,0X05,0X29,0X86,0X31,0XB3,0X9C,0XFF,0XFF,
|
||||
0XFF,0XF7,0X75,0XDD,0XC7,0XE9,0XC7,0XF9,0X01,0XF8,0X01,0XF0,0X00,0XE8,0X49,0XE2,
|
||||
0XFB,0XEE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XBE,0XF7,0X7D,0XEF,0XFB,0XDE,0XFB,0XDE,0XBA,0XD6,0X79,0XCE,0XBA,0XD6,
|
||||
0XB9,0XCE,0X08,0X42,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XC7,0X39,0X38,0XC6,
|
||||
0X00,0X00,0X82,0X10,0X82,0X10,0X04,0X21,0X04,0X21,0X45,0X29,0X30,0X84,0XFF,0XFF,
|
||||
0XFF,0XFF,0X38,0XDE,0XC4,0XD0,0X00,0XF0,0X01,0XF8,0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9D,0X35,0XA5,
|
||||
0XB7,0XAD,0X79,0XC6,0X3C,0XE7,0XBE,0XF7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
};
|
||||
|
||||
u8 code hanzi[]={
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x01,0x00,
|
||||
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
|
||||
0x10,0x80,0x01,0x0C,0xF0,0xFF,0xFF,0x0F,0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,
|
||||
0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,
|
||||
0x30,0x80,0x01,0x04,0x30,0x80,0x01,0x04,0xF0,0xFF,0xFF,0x07,0x30,0x80,0x01,0x04,
|
||||
0x30,0x80,0x01,0x04,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
|
||||
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,
|
||||
0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,/*"ヨミ",0*/
|
||||
/* (32 X 32 , ?? )*/
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,
|
||||
0x00,0xFF,0xFF,0x01,0x00,0x03,0x80,0x01,0x00,0x03,0x80,0x01,0x00,0xFF,0xFF,0x01,
|
||||
0x00,0x03,0x80,0x01,0x00,0x03,0x80,0x01,0x00,0xFF,0xFF,0x01,0x00,0x81,0x81,0x00,
|
||||
0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x1C,0xFC,0xFF,0xFF,0x3F,0x00,0x00,0x40,0x00,
|
||||
0x00,0x03,0xC0,0x01,0x00,0xFF,0xFF,0x01,0x00,0x03,0xC0,0x00,0x00,0x03,0xC0,0x00,
|
||||
0x00,0x03,0xC0,0x00,0x00,0xFF,0xFF,0x00,0x00,0x01,0x41,0x00,0x00,0x04,0x01,0x00,
|
||||
0x00,0x0E,0x71,0x00,0x00,0x07,0x81,0x01,0x80,0x01,0x01,0x07,0x60,0x00,0x01,0x0E,
|
||||
0x18,0x98,0x01,0x1C,0x04,0xE0,0x01,0x18,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,/*"セー",1*/
|
||||
/* (32 X 32 , ?? )*/
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0xF0,0xFF,0xFF,0x1F,
|
||||
0x30,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,0x30,0x00,0x10,0x0C,0x30,0xFE,0x3F,0x0C,
|
||||
0x30,0x04,0x00,0x0C,0x30,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,
|
||||
0x30,0x00,0xC0,0x0C,0xF0,0xFF,0xFF,0x0D,0x30,0x30,0x06,0x0E,0x30,0x30,0x06,0x0C,
|
||||
0x30,0x10,0x06,0x0C,0x30,0x10,0x06,0x0C,0x30,0x10,0x06,0x0C,0x30,0x18,0x86,0x0C,
|
||||
0x30,0x18,0x86,0x0C,0x30,0x08,0x06,0x0D,0x30,0x0C,0x86,0x0D,0x30,0x06,0xEE,0x0F,
|
||||
0x30,0x02,0xFC,0x0D,0x30,0x01,0x00,0x0C,0xF0,0x00,0x00,0x0C,0x30,0x00,0x00,0x0C,
|
||||
0xF0,0xFF,0xFF,0x0F,0x30,0x00,0x00,0x0C,0x10,0x00,0x00,0x04,0x00,0x00,0x00,0x00,/*"ヤー",2*/
|
||||
};
|
||||
u8 code asc2_1608[1520]={
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x18,0x18,0x00,0x00,
|
||||
0x00,0x48,0x6C,0x24,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x24,0x24,0x24,0x7F,0x12,0x12,0x12,0x7F,0x12,0x12,0x12,0x00,0x00,
|
||||
0x00,0x00,0x08,0x1C,0x2A,0x2A,0x0A,0x0C,0x18,0x28,0x28,0x2A,0x2A,0x1C,0x08,0x08,
|
||||
0x00,0x00,0x00,0x22,0x25,0x15,0x15,0x15,0x2A,0x58,0x54,0x54,0x54,0x22,0x00,0x00,
|
||||
0x00,0x00,0x00,0x0C,0x12,0x12,0x12,0x0A,0x76,0x25,0x29,0x11,0x91,0x6E,0x00,0x00,
|
||||
0x00,0x06,0x06,0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x00,
|
||||
0x00,0x02,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,0x02,0x00,
|
||||
0x00,0x00,0x00,0x00,0x08,0x08,0x6B,0x1C,0x1C,0x6B,0x08,0x08,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x7F,0x08,0x08,0x08,0x08,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x04,0x03,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x00,0x00,
|
||||
0x00,0x00,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x00,
|
||||
0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00,
|
||||
0x00,0x00,0x00,0x08,0x0E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x20,0x20,0x10,0x08,0x04,0x42,0x7E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x42,0x42,0x20,0x18,0x20,0x40,0x40,0x42,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x20,0x30,0x28,0x24,0x24,0x22,0x22,0x7E,0x20,0x20,0x78,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7E,0x02,0x02,0x02,0x1A,0x26,0x40,0x40,0x42,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x38,0x24,0x02,0x02,0x1A,0x26,0x42,0x42,0x42,0x24,0x18,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7E,0x22,0x22,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x3C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x64,0x58,0x40,0x40,0x24,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x04,
|
||||
0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x40,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x02,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x42,0x42,0x46,0x40,0x20,0x10,0x10,0x00,0x18,0x18,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1C,0x22,0x5A,0x55,0x55,0x55,0x55,0x2D,0x42,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x08,0x08,0x18,0x14,0x14,0x24,0x3C,0x22,0x42,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x1E,0x22,0x42,0x42,0x42,0x22,0x1F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7C,0x42,0x42,0x01,0x01,0x01,0x01,0x01,0x42,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1F,0x22,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3F,0x42,0x12,0x12,0x1E,0x12,0x12,0x02,0x42,0x42,0x3F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3F,0x42,0x12,0x12,0x1E,0x12,0x12,0x02,0x02,0x02,0x07,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3C,0x22,0x22,0x01,0x01,0x01,0x71,0x21,0x22,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x0F,
|
||||
0x00,0x00,0x00,0x77,0x22,0x12,0x0A,0x0E,0x0A,0x12,0x12,0x22,0x22,0x77,0x00,0x00,
|
||||
0x00,0x00,0x00,0x07,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x42,0x7F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x77,0x36,0x36,0x36,0x36,0x2A,0x2A,0x2A,0x2A,0x2A,0x6B,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE3,0x46,0x46,0x4A,0x4A,0x52,0x52,0x52,0x62,0x62,0x47,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1C,0x22,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x22,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x3F,0x42,0x42,0x42,0x42,0x3E,0x02,0x02,0x02,0x02,0x07,0x00,0x00,
|
||||
0x00,0x00,0x00,0x1C,0x22,0x41,0x41,0x41,0x41,0x41,0x4D,0x53,0x32,0x1C,0x60,0x00,
|
||||
0x00,0x00,0x00,0x3F,0x42,0x42,0x42,0x3E,0x12,0x12,0x22,0x22,0x42,0xC7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7C,0x42,0x42,0x02,0x04,0x18,0x20,0x40,0x42,0x42,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7F,0x49,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE7,0x42,0x42,0x22,0x24,0x24,0x14,0x14,0x18,0x08,0x08,0x00,0x00,
|
||||
0x00,0x00,0x00,0x6B,0x49,0x49,0x49,0x49,0x55,0x55,0x36,0x22,0x22,0x22,0x00,0x00,
|
||||
0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x18,0x18,0x18,0x24,0x24,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x77,0x22,0x22,0x14,0x14,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7E,0x21,0x20,0x10,0x10,0x08,0x04,0x04,0x42,0x42,0x3F,0x00,0x00,
|
||||
0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78,0x00,
|
||||
0x00,0x00,0x02,0x02,0x04,0x04,0x08,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x40,0x40,
|
||||
0x00,0x1E,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1E,0x00,
|
||||
0x00,0x38,0x44,0x00,0x00,0x00,0x00,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,
|
||||
0x00,0x06,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x78,0x44,0x42,0x42,0xFC,0x00,0x00,
|
||||
0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x1A,0x26,0x42,0x42,0x42,0x26,0x1A,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x02,0x02,0x02,0x44,0x38,0x00,0x00,
|
||||
0x00,0x00,0x00,0x60,0x40,0x40,0x40,0x78,0x44,0x42,0x42,0x42,0x64,0xD8,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x7E,0x02,0x02,0x42,0x3C,0x00,0x00,
|
||||
0x00,0x00,0x00,0xF0,0x88,0x08,0x08,0x7E,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x22,0x22,0x1C,0x02,0x3C,0x42,0x42,0x3C,
|
||||
0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x3A,0x46,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x0C,0x0C,0x00,0x00,0x0E,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x1E,
|
||||
0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x72,0x12,0x0A,0x16,0x12,0x22,0x77,0x00,0x00,
|
||||
0x00,0x00,0x00,0x0E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x92,0x92,0x92,0x92,0x92,0xB7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3B,0x46,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1B,0x26,0x42,0x42,0x42,0x22,0x1E,0x02,0x07,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x44,0x42,0x42,0x42,0x44,0x78,0x40,0xE0,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x77,0x4C,0x04,0x04,0x04,0x04,0x1F,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x42,0x02,0x3C,0x40,0x42,0x3E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x3E,0x08,0x08,0x08,0x08,0x08,0x30,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x42,0x42,0x42,0x42,0x62,0xDC,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x14,0x08,0x08,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEB,0x49,0x49,0x55,0x55,0x22,0x22,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x24,0x18,0x18,0x18,0x24,0x6E,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x14,0x18,0x08,0x08,0x07,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x22,0x10,0x08,0x08,0x44,0x7E,0x00,0x00,
|
||||
0x00,0xC0,0x20,0x20,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0x20,0x20,0xC0,0x00,
|
||||
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
|
||||
0x00,0x06,0x08,0x08,0x08,0x08,0x08,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x06,0x00,
|
||||
0x0C,0x32,0xC2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
13
usr/font.h
Normal file
13
usr/font.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef __FONT_H
|
||||
#define __FONT_H
|
||||
|
||||
extern unsigned char code image[];
|
||||
extern unsigned char code hanzi[];
|
||||
extern unsigned char code asc2_1608[1520];
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
118
usr/main.c
Normal file
118
usr/main.c
Normal file
@ -0,0 +1,118 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <intrins.h>
|
||||
|
||||
|
||||
#include "CH554.h"
|
||||
#include "common.h"
|
||||
#include "Timer.h"
|
||||
#include "USB.h"
|
||||
#include "GPIO.h"
|
||||
|
||||
#include "lcd.h"
|
||||
#include "font.h"
|
||||
/******************************************************
|
||||
GND=GND
|
||||
VCC=3.3V
|
||||
P00=CLK
|
||||
P01=MOSI
|
||||
P02=RES
|
||||
P03=DC
|
||||
P04=CS1
|
||||
BLK为LCD背光控制管脚,低电平关闭背光,高电平打开;默认可以不接打开背光
|
||||
////////////////////////以上是LCD工作所需要的/////////////////////////////////////
|
||||
P05=FSO
|
||||
P06=CS2
|
||||
|
||||
******************************************************/
|
||||
|
||||
u8 ref=0;//刷新显示
|
||||
|
||||
void xianshi()//显示信息
|
||||
{
|
||||
u16 lx,ly;
|
||||
BACK_COLOR=WHITE;
|
||||
POINT_COLOR=RED;
|
||||
showhanzi(10,0,0); //中
|
||||
showhanzi(45,0,1); //景
|
||||
showhanzi(80,0,2); //园
|
||||
LCD_ShowString(10,35,"3.2 TFT SPI 240*320");
|
||||
LCD_ShowString(10,55,"LCD_W:"); LCD_ShowNum(70,55,LCD_W,3);
|
||||
LCD_ShowString(110,55,"LCD_H:");LCD_ShowNum(160,55,LCD_H,3);
|
||||
lx=10;ly=75;
|
||||
}
|
||||
|
||||
void showimage() //显示40*40图片
|
||||
{
|
||||
int i,j,k;
|
||||
//LCD_Clear(WHITE); //清屏
|
||||
//xianshi(); //显示信息
|
||||
for(k=3;k<4;k++)
|
||||
{
|
||||
for(j=0;j<3;j++)
|
||||
{
|
||||
Address_set(40*j,40*k,40*j+39,40*k+39); //坐标设置
|
||||
for(i=0;i<1600;i++)
|
||||
{
|
||||
//LCD_WR_DATA8(image[i*2+1]);
|
||||
//LCD_WR_DATA8(image[i*2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
ref=0;
|
||||
}
|
||||
|
||||
void main1()
|
||||
{
|
||||
//Set_All_GPIO_Quasi_Mode; // Define in Function_define.h
|
||||
BACK_COLOR=WHITE;
|
||||
POINT_COLOR=RED;
|
||||
//Lcd_Init(); //tft初始化
|
||||
while(1)
|
||||
{
|
||||
LCD_CS1=0;
|
||||
LCD_DC=1;
|
||||
LCD_REST=0;
|
||||
delayms (200);
|
||||
LCD_CS1=1;
|
||||
LCD_DC=0;
|
||||
LCD_REST=1;
|
||||
delayms (200);
|
||||
|
||||
//delayms (200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
//Set_All_GPIO_Quasi_Mode; // Define in Function_define.h
|
||||
BACK_COLOR=WHITE;
|
||||
POINT_COLOR=RED;
|
||||
Lcd_Init(); //tft初始化
|
||||
LCD_Clear(WHITE); //清屏
|
||||
while(1)
|
||||
{
|
||||
//Display_Asc_String('6',0,0, "2.4'TFT"); //ASC 16X32点阵
|
||||
//Display_Asc_String('1',0,34, "ASCII_5x7");//ASC 5X7点阵
|
||||
//Display_Asc_String('2',0,45, "ASCII_7x8"); //ASC 7X8点阵
|
||||
//Display_Asc_String('3',0,54, "ASCII_6x12"); //ASC 6X12点阵
|
||||
//Display_Asc_String('4',0,70, "ASCII_8x16"); //ASC 8X16点阵
|
||||
//Display_Asc_String('5',0,90, "AS12x24");//ASC 12X24点阵
|
||||
//Display_Asc_String('6',0,130, "16x32"); //ASC 16X32点阵
|
||||
delayms (2000);
|
||||
LCD_Clear(RED); //清屏
|
||||
//Display_GB2312_String('1',0,0, "专业显示屏");//12x12汉字
|
||||
//Display_GB2312_String('2',0,16, "中景园电子");//15x16汉字
|
||||
//Display_GB2312_String('3',0,40, "中景园电子"); //24x24汉字
|
||||
//Display_GB2312_String('4',16,70, "中景园"); //32x32汉字
|
||||
//showimage(); //显示40*40图片
|
||||
delayms (2000);
|
||||
LCD_Clear(BLUE); //清屏
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user