time formatting

This commit is contained in:
Andy Killorin 2025-03-20 11:20:21 -04:00
commit 35d1ee2387
Signed by: ank
GPG key ID: 23F9463ECB67FE8C
22 changed files with 2036 additions and 0 deletions

19
.ccsproject Normal file
View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?ccsproject version="1.0"?>
<projectOptions>
<ccsVersion value="7.2.0"/>
<deviceVariant value="Cortex M.TM4C1294NCPDT"/>
<deviceFamily value="TMS470"/>
<deviceEndianness value="little"/>
<codegenToolVersion value="16.9.4.LTS"/>
<isElfFormat value="true"/>
<connection value="common/targetdb/connections/Stellaris_ICDI_Connection.xml"/>
<linkerCommandFile value="tm4c1294ncpdt.cmd"/>
<rts value="libc.a"/>
<createSlaveProjects value=""/>
<templateProperties value="id=com.ti.common.project.core.emptyProjectWithMainTemplate,"/>
<filesToOpen value="main.c,"/>
<isTargetManual value="false"/>
<origin value="C:/Users/gene/Documents/Work/ECE 3849/workspace_v8/ece3849_lab0_starter"/>
<activeTargetConfiguration value="targetConfigs/Tiva TM4C1294NCPDT.ccxml"/>
</projectOptions>

11
.clangd Normal file
View file

@ -0,0 +1,11 @@
# This is an auto-generated file - do not add it to source-control
CompileFlags:
CompilationDatabase: Debug/.clangd
Diagnostics:
Suppress: '*'
InlayHints:
Enabled: No

205
.cproject Normal file
View file

@ -0,0 +1,205 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule configRelations="2" moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.811962802">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.811962802" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<macros>
<stringMacro name="SW_ROOT" type="VALUE_PATH_DIR" value="${COM_TI_RTSC_TIRTOSTIVAC__TIVAWARE_C_SERIES}"/>
</macros>
<externalSettings/>
<extensions>
<extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="com.ti.ccs.project.ErrorParser"/>
<extension id="com.ti.ccs.errorparser.CompilerErrorParser_TI" point="com.ti.ccs.project.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.811962802" name="Debug" parent="com.ti.ccstudio.buildDefinitions.TMS470.Debug">
<folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.811962802." name="/" resourcePath="">
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exe.DebugToolchain.575859901" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exe.linkerDebug.752584841">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.214035546" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
<listOptionValue value="DEVICE_CONFIGURATION_ID=Cortex M.TM4C1294NCPDT"/>
<listOptionValue value="DEVICE_CORE_ID=CORTEX_M4_0"/>
<listOptionValue value="DEVICE_ENDIANNESS=little"/>
<listOptionValue value="OUTPUT_FORMAT=ELF"/>
<listOptionValue value="LINKER_COMMAND_FILE=tm4c1294ncpdt.cmd"/>
<listOptionValue value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
<listOptionValue value="CCS_MBS_VERSION=6.1.3"/>
<listOptionValue value="PRODUCTS=com.ti.rtsc.TIRTOStivac:2.16.1.14;"/>
<listOptionValue value="PRODUCT_MACRO_IMPORTS={&quot;com.ti.rtsc.TIRTOStivac&quot;:[&quot;${COM_TI_RTSC_TIRTOSTIVAC_INCLUDE_PATH}&quot;,&quot;${COM_TI_RTSC_TIRTOSTIVAC_LIBRARY_PATH}&quot;,&quot;${COM_TI_RTSC_TIRTOSTIVAC_LIBRARIES}&quot;,&quot;${COM_TI_RTSC_TIRTOSTIVAC_SYMBOLS}&quot;,&quot;${COM_TI_RTSC_TIRTOSTIVAC_SYSCONFIG_MANIFEST}&quot;]}"/>
<listOptionValue value="OUTPUT_TYPE=executable"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.2008839504" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="20.2.6.LTS" valueType="string"/>
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exe.targetPlatformDebug.476422421" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exe.targetPlatformDebug"/>
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exe.builderDebug.1661104788" name="GNU Make.Debug" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exe.builderDebug"/>
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exe.compilerDebug.455841075" name="Arm Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exe.compilerDebug">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.SILICON_VERSION.938153531" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.SILICON_VERSION.7M4" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.CODE_STATE.1336234527" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.CODE_STATE" value="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.CODE_STATE.16" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.ABI.305863088" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.ABI" value="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.ABI.eabi" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.FLOAT_SUPPORT.643365834" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.FLOAT_SUPPORT" value="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.FLOAT_SUPPORT.FPv4SPD16" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.GCC.408813242" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.GCC" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.DEFINE.2075147882" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.DEFINE" valueType="definedSymbols">
<listOptionValue value="${COM_TI_RTSC_TIRTOSTIVAC_SYMBOLS}"/>
<listOptionValue value="ccs=&quot;ccs&quot;"/>
<listOptionValue value="PART_TM4C1294NCPDT"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.LITTLE_ENDIAN.510775202" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.OPT_LEVEL.204267078" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.OPT_LEVEL.1" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.OPT_FOR_SPEED.1446579360" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.OPT_FOR_SPEED.3" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.INCLUDE_PATH.755767810" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.INCLUDE_PATH" valueType="includePath">
<listOptionValue value="${COM_TI_RTSC_TIRTOSTIVAC_INCLUDE_PATH}"/>
<listOptionValue value="${PROJECT_ROOT}"/>
<listOptionValue value="${SW_ROOT}"/>
<listOptionValue value="${CG_TOOL_ROOT}/include"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.DEBUGGING_MODEL.438646144" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.DIAG_WARNING.1333491972" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.DIAG_WARNING" valueType="stringList">
<listOptionValue value="225"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.DIAG_WRAP.838791632" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.DISPLAY_ERROR_NUMBER.2052754743" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compiler.inputType__C_SRCS.1313449152" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compiler.inputType__C_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compiler.inputType__CPP_SRCS.1811794717" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compiler.inputType__CPP_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compiler.inputType__ASM_SRCS.2066152744" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compiler.inputType__ASM_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compiler.inputType__ASM2_SRCS.1867906598" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.compiler.inputType__ASM2_SRCS"/>
</tool>
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exe.linkerDebug.752584841" name="Arm Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exe.linkerDebug">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.MAP_FILE.718846502" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.MAP_FILE" value="&quot;${ProjName}.map&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.STACK_SIZE.460493740" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.STACK_SIZE" value="2048" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.HEAP_SIZE.1231903231" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.HEAP_SIZE" value="0" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.OUTPUT_FILE.917912725" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.OUTPUT_FILE" value="${ProjName}.out" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.LIBRARY.1471815798" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.LIBRARY" valueType="libs">
<listOptionValue value="${COM_TI_RTSC_TIRTOSTIVAC_LIBRARIES}"/>
<listOptionValue value="libc.a"/>
<listOptionValue value="${SW_ROOT}/grlib/ccs/Debug/grlib.lib"/>
<listOptionValue value="${SW_ROOT}/driverlib/ccs/Debug/driverlib.lib"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.SEARCH_PATH.264691617" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.SEARCH_PATH" valueType="libPaths">
<listOptionValue value="${COM_TI_RTSC_TIRTOSTIVAC_LIBRARY_PATH}"/>
<listOptionValue value="${CG_TOOL_ROOT}/lib"/>
<listOptionValue value="${CG_TOOL_ROOT}/include"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.DIAG_WRAP.1422286035" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.DISPLAY_ERROR_NUMBER.816512582" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.XML_LINK_INFO.1317425332" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.linkerID.XML_LINK_INFO" value="&quot;${ProjName}_linkInfo.xml&quot;" valueType="string"/>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exeLinker.inputType__CMD_SRCS.1246232400" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exeLinker.inputType__CMD_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exeLinker.inputType__CMD2_SRCS.2092984050" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exeLinker.inputType__CMD2_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exeLinker.inputType__GEN_CMDS.355708276" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.exeLinker.inputType__GEN_CMDS"/>
</tool>
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_20.2.hex.2076379637" name="Arm Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_20.2.hex"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Release.59565178">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Release.59565178" moduleId="org.eclipse.cdt.core.settings" name="Release">
<macros>
<stringMacro name="SW_ROOT" type="VALUE_PATH_ANY" value="${COM_TI_RTSC_TIRTOSTIVAC__TIVAWARE_C_SERIES}"/>
</macros>
<externalSettings/>
<extensions>
<extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="com.ti.ccs.project.ErrorParser"/>
<extension id="com.ti.ccs.errorparser.CompilerErrorParser_TI" point="com.ti.ccs.project.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Release.59565178" name="Release" parent="com.ti.ccstudio.buildDefinitions.TMS470.Release">
<folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Release.59565178." name="/" resourcePath="">
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exe.ReleaseToolchain.1480371794" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exe.ReleaseToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exe.linkerRelease.1172657692">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1615398067" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
<listOptionValue value="DEVICE_CONFIGURATION_ID=Cortex M.TM4C1294NCPDT"/>
<listOptionValue value="DEVICE_ENDIANNESS=little"/>
<listOptionValue value="OUTPUT_FORMAT=ELF"/>
<listOptionValue value="CCS_MBS_VERSION=70.0.0"/>
<listOptionValue value="LINKER_COMMAND_FILE=tm4c1294ncpdt.cmd"/>
<listOptionValue value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
<listOptionValue value="OUTPUT_TYPE=executable"/>
<listOptionValue value="PRODUCTS=com.ti.rtsc.TIRTOStivac:2.16.1.14;"/>
<listOptionValue value="PRODUCT_MACRO_IMPORTS={&quot;com.ti.rtsc.TIRTOStivac&quot;:[&quot;${COM_TI_RTSC_TIRTOSTIVAC_INCLUDE_PATH}&quot;,&quot;${COM_TI_RTSC_TIRTOSTIVAC_LIBRARY_PATH}&quot;,&quot;${COM_TI_RTSC_TIRTOSTIVAC_LIBRARIES}&quot;,&quot;${COM_TI_RTSC_TIRTOSTIVAC_SYMBOLS}&quot;,&quot;${COM_TI_RTSC_TIRTOSTIVAC_SYSCONFIG_MANIFEST}&quot;]}"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.1423362229" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="16.9.4.LTS" valueType="string"/>
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exe.targetPlatformRelease.1392823537" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exe.targetPlatformRelease"/>
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exe.builderRelease.135615871" keepEnvironmentInBuildfile="false" name="GNU Make" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exe.builderRelease"/>
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exe.compilerRelease.1935517766" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exe.compilerRelease">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.SILICON_VERSION.126363828" name="Target processor version (--silicon_version, -mv)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.SILICON_VERSION.7M4" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.CODE_STATE.1785921174" name="Designate code state, 16-bit (thumb) or 32-bit (--code_state)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.CODE_STATE" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.CODE_STATE.16" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.ABI.1295861815" name="Application binary interface. (--abi)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.ABI" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.ABI.eabi" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.FLOAT_SUPPORT.1693417824" name="Specify floating point support (--float_support)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.FLOAT_SUPPORT" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.FLOAT_SUPPORT.FPv4SPD16" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.GCC.60553596" name="Enable support for GCC extensions (DEPRECATED) (--gcc)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.GCC" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DEFINE.1889023535" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DEFINE" valueType="definedSymbols">
<listOptionValue value="${COM_TI_RTSC_TIRTOSTIVAC_SYMBOLS}"/>
<listOptionValue value="ccs=&quot;ccs&quot;"/>
<listOptionValue value="PART_TM4C1294NCPDT"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WARNING.1539249686" name="Treat diagnostic &lt;id&gt; as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WARNING" valueType="stringList">
<listOptionValue value="225"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DISPLAY_ERROR_NUMBER.1532519648" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WRAP.1907959056" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.INCLUDE_PATH.424572233" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.INCLUDE_PATH" valueType="includePath">
<listOptionValue value="${COM_TI_RTSC_TIRTOSTIVAC_INCLUDE_PATH}"/>
<listOptionValue value="${PROJECT_ROOT}"/>
<listOptionValue value="${CG_TOOL_ROOT}/include"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.LITTLE_ENDIAN.298413901" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__C_SRCS.2018554747" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__C_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__CPP_SRCS.645820533" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__CPP_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__ASM_SRCS.1702151644" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__ASM_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__ASM2_SRCS.1949741964" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__ASM2_SRCS"/>
</tool>
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exe.linkerRelease.1172657692" name="ARM Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exe.linkerRelease">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.MAP_FILE.1459176998" name="Link information (map) listed into &lt;file&gt; (--map_file, -m)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.MAP_FILE" value="&quot;${ProjName}.map&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.STACK_SIZE.56136748" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.STACK_SIZE" value="512" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.HEAP_SIZE.229645010" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.HEAP_SIZE" value="0" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.OUTPUT_FILE.1647725922" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.OUTPUT_FILE" value="${ProjName}.out" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.XML_LINK_INFO.1582865100" name="Detailed link information data-base into &lt;file&gt; (--xml_link_info, -xml_link_info)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.XML_LINK_INFO" value="&quot;${ProjName}_linkInfo.xml&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.DISPLAY_ERROR_NUMBER.1255379064" name="Emit diagnostic identifier numbers (--display_error_number)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.DIAG_WRAP.373405607" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.SEARCH_PATH.685671336" name="Add &lt;dir&gt; to library search path (--search_path, -i)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.SEARCH_PATH" valueType="libPaths">
<listOptionValue value="${COM_TI_RTSC_TIRTOSTIVAC_LIBRARY_PATH}"/>
<listOptionValue value="${CG_TOOL_ROOT}/lib"/>
<listOptionValue value="${CG_TOOL_ROOT}/include"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.LIBRARY.1074603645" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.linkerID.LIBRARY" valueType="libs">
<listOptionValue value="${COM_TI_RTSC_TIRTOSTIVAC_LIBRARIES}"/>
<listOptionValue value="libc.a"/>
</option>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exeLinker.inputType__CMD_SRCS.684749391" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exeLinker.inputType__CMD_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exeLinker.inputType__CMD2_SRCS.1543943384" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exeLinker.inputType__CMD2_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exeLinker.inputType__GEN_CMDS.1484098492" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exeLinker.inputType__GEN_CMDS"/>
</tool>
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.hex.1381686598" name="ARM Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.hex"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="ece3849_b2017_lab0.com.ti.ccstudio.buildDefinitions.TMS470.ProjectType.197673397" name="ARM" projectType="com.ti.ccstudio.buildDefinitions.TMS470.ProjectType"/>
</storageModule>
<storageModule moduleId="scannerConfiguration"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping">
<project-mappings>
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.asmSource" language="com.ti.ccstudio.core.TIASMLanguage"/>
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cHeader" language="com.ti.ccstudio.core.TIGCCLanguage"/>
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cSource" language="com.ti.ccstudio.core.TIGCCLanguage"/>
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxHeader" language="com.ti.ccstudio.core.TIGPPLanguage"/>
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxSource" language="com.ti.ccstudio.core.TIGPPLanguage"/>
</project-mappings>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cproject>

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/Debug/

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.ti.ccstudio.debug.launchType.device.debugging">
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.Tiva TM4C1294NCPDT.ccxml.Stellaris In-Circuit Debug Interface/CORTEX_M4_0" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot; ?&gt;&#10;&lt;PropertyValues&gt;&#10;&#10; &lt;property id=&quot;ConnectOnStartup&quot;&gt;&#10; &lt;curValue&gt;1&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10; &lt;property id=&quot;EnableInstalledBreakpoint&quot;&gt;&#10; &lt;curValue&gt;1&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10; &lt;property id=&quot;IgnoreSoftLaunchFailures&quot;&gt;&#10; &lt;curValue&gt;0&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10;&lt;/PropertyValues&gt;&#10;"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.Tiva TM4C1294NCPDT.ccxml.Stellaris In-Circuit Debug Interface/CORTEX_M4_0" value="${build_artifact:ece3849_lab0_starter}"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.Tiva TM4C1294NCPDT.ccxml.Stellaris In-Circuit Debug Interface/CORTEX_M4_0" value="ece3849_lab0_starter"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_TARGET_CONFIG" value="${target_config_active_default:ece3849_lab0_starter}"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.Tiva TM4C1294NCPDT.ccxml.Stellaris In-Circuit Debug Interface/CORTEX_M4_0" value="${build_artifact:ece3849_lab0_starter}"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/ece3849_lab0_starter"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="com.ti.ccstudio.debug.sourceLocator"/>
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;sourceLookupDirector&gt;&#13;&#10; &lt;sourceContainers duplicates=&quot;false&quot;&gt;&#13;&#10; &lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;default/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#13;&#10; &lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;cpuSpecificContainer cpuName=&amp;quot;Stellaris In-Circuit Debug Interface/CORTEX_M4_0&amp;quot;&amp;gt;&amp;#13;&amp;#10; &amp;lt;childContainerEntry childMemento=&amp;quot;&amp;amp;lt;?xml version=&amp;amp;quot;1.0&amp;amp;quot; encoding=&amp;amp;quot;UTF-8&amp;amp;quot; standalone=&amp;amp;quot;no&amp;amp;quot;?&amp;amp;gt;&amp;amp;#13;&amp;amp;#10;&amp;amp;lt;project name=&amp;amp;quot;ece3849_lab0_starter&amp;amp;quot; referencedProjects=&amp;amp;quot;true&amp;amp;quot;/&amp;amp;gt;&amp;amp;#13;&amp;amp;#10;&amp;quot; childType=&amp;quot;org.eclipse.debug.core.containerType.project&amp;quot;/&amp;gt;&amp;#13;&amp;#10; &amp;lt;childContainerEntry childMemento=&amp;quot;&amp;amp;lt;?xml version=&amp;amp;quot;1.0&amp;amp;quot; encoding=&amp;amp;quot;UTF-8&amp;amp;quot; standalone=&amp;amp;quot;no&amp;amp;quot;?&amp;amp;gt;&amp;amp;#13;&amp;amp;#10;&amp;amp;lt;default/&amp;amp;gt;&amp;amp;#13;&amp;amp;#10;&amp;quot; childType=&amp;quot;org.eclipse.debug.core.containerType.default&amp;quot;/&amp;gt;&amp;#13;&amp;#10; &amp;lt;childContainerEntry childMemento=&amp;quot;&amp;amp;lt;?xml version=&amp;amp;quot;1.0&amp;amp;quot; encoding=&amp;amp;quot;UTF-8&amp;amp;quot; standalone=&amp;amp;quot;no&amp;amp;quot;?&amp;amp;gt;&amp;amp;#13;&amp;amp;#10;&amp;amp;lt;productsSource/&amp;amp;gt;&amp;amp;#13;&amp;amp;#10;&amp;quot; childType=&amp;quot;com.ti.ccstudio.debug.containerType.products.source&amp;quot;/&amp;gt;&amp;#13;&amp;#10; &amp;lt;childContainerEntry childMemento=&amp;quot;&amp;amp;lt;?xml version=&amp;amp;quot;1.0&amp;amp;quot; encoding=&amp;amp;quot;UTF-8&amp;amp;quot; standalone=&amp;amp;quot;no&amp;amp;quot;?&amp;amp;gt;&amp;amp;#13;&amp;amp;#10;&amp;amp;lt;deviceLibrarySource/&amp;amp;gt;&amp;amp;#13;&amp;amp;#10;&amp;quot; childType=&amp;quot;com.ti.ccstudio.debug.containerType.device.library.source&amp;quot;/&amp;gt;&amp;#13;&amp;#10; &amp;lt;childContainerEntry childMemento=&amp;quot;&amp;amp;lt;?xml version=&amp;amp;quot;1.0&amp;amp;quot; encoding=&amp;amp;quot;UTF-8&amp;amp;quot; standalone=&amp;amp;quot;no&amp;amp;quot;?&amp;amp;gt;&amp;amp;#13;&amp;amp;#10;&amp;amp;lt;librarySource/&amp;amp;gt;&amp;amp;#13;&amp;amp;#10;&amp;quot; childType=&amp;quot;com.ti.ccstudio.debug.containerType.library.source&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&amp;lt;/cpuSpecificContainer&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;com.ti.ccstudio.debug.containerType.cpu.specific&quot;/&gt;&#13;&#10; &lt;/sourceContainers&gt;&#13;&#10;&lt;/sourceLookupDirector&gt;&#13;&#10;"/>
</launchConfiguration>

33
.project Normal file
View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ece3849_lab0_starter</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.ti.ccstudio.core.ccsNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<variableList>
<variable>
<name>SW_ROOT</name>
<value>$%7BCOM_TI_RTSC_TIRTOSTIVAC__TIVAWARE_C_SERIES%7D</value>
</variable>
</variableList>
</projectDescription>

View file

@ -0,0 +1,3 @@
eclipse.preferences.version=1
inEditor=false
onBuild=false

View file

@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.cdt.debug.core.toggleBreakpointModel=com.ti.ccstudio.debug.CCSBreakpointMarker

View file

@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//Debug/makefile=UTF-8
encoding//Debug/objects.mk=UTF-8
encoding//Debug/sources.mk=UTF-8
encoding//Debug/subdir_rules.mk=UTF-8
encoding//Debug/subdir_vars.mk=UTF-8

View file

@ -0,0 +1,596 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2015, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
//
// Crystalfontz128x128.c - Display driver for the Crystalfontz
// 128x128 display with ST7735 controller.
//
// Modified by Gene Bogdanov 8/30/2017
//
//*****************************************************************************
#include "Crystalfontz128x128_ST7735.h"
#include <stdint.h>
#include <stdbool.h>
#include "grlib/grlib.h"
#include "HAL_EK_TM4C1294XL_Crystalfontz128x128_ST7735.h"
uint8_t Lcd_Orientation;
uint16_t Lcd_ScreenWidth, Lcd_ScreenHeigth;
uint8_t Lcd_PenSolid, Lcd_FontSolid, Lcd_FlagRead;
uint16_t Lcd_TouchTrim;
uint16_t Lcd_buffer[LCD_VERTICAL_MAX][LCD_HORIZONTAL_MAX] = {0}; // Gene Bogdanov: LCD frame buffer in RAM
static void Crystalfontz128x128_Flush(void *pvDisplayData);
static uint32_t Crystalfontz128x128_ColorTranslate(void *pvDisplayData, uint32_t ulValue);
//*****************************************************************************
//
//! Initializes the display driver.
//!
//! This function initializes the ST7735 display controller on the panel,
//! preparing it to display data.
//!
//! \return None.
//
//*****************************************************************************
void Crystalfontz128x128_Init(void)
{
HAL_LCD_PortInit();
HAL_LCD_SpiInit();
HAL_LCD_writeCommand(CM_SLPOUT);
HAL_LCD_delay(120000);
HAL_LCD_writeCommand(CM_GAMSET);
HAL_LCD_writeData(0x04);
HAL_LCD_writeCommand(CM_SETPWCTR);
HAL_LCD_writeData(0x0A);
HAL_LCD_writeData(0x14);
HAL_LCD_writeCommand(CM_SETSTBA);
HAL_LCD_writeData(0x0A);
HAL_LCD_writeData(0x00);
HAL_LCD_writeCommand(CM_COLMOD);
HAL_LCD_writeData(0x05);
HAL_LCD_delay(10);
HAL_LCD_writeCommand(CM_MADCTL);
HAL_LCD_writeData(CM_MADCTL_BGR);
HAL_LCD_writeCommand(CM_NORON);
Lcd_ScreenWidth = LCD_HORIZONTAL_MAX;
Lcd_ScreenHeigth = LCD_VERTICAL_MAX;
Lcd_PenSolid = 0;
Lcd_FontSolid = 1;
Lcd_FlagRead = 0;
Lcd_TouchTrim = 0;
Crystalfontz128x128_Flush(0); // Gene Bogdanov: flush the RAM buffer instead of filling LCD memory with fixed values
HAL_LCD_delay(10);
HAL_LCD_writeCommand(CM_DISPON);
}
void Crystalfontz128x128_SetDrawFrame(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1)
{
switch (Lcd_Orientation) {
case 0:
x0 += 2;
y0 += 3;
x1 += 2;
y1 += 3;
break;
case 1:
x0 += 3;
y0 += 2;
x1 += 3;
y1 += 2;
break;
case 2:
x0 += 2;
y0 += 1;
x1 += 2;
y1 += 1;
break;
case 3:
x0 += 1;
y0 += 2;
x1 += 1;
y1 += 2;
break;
default:
break;
}
HAL_LCD_writeCommand(CM_CASET);
HAL_LCD_writeData((uint8_t)(x0 >> 8));
HAL_LCD_writeData((uint8_t)(x0));
HAL_LCD_writeData((uint8_t)(x1 >> 8));
HAL_LCD_writeData((uint8_t)(x1));
HAL_LCD_writeCommand(CM_RASET);
HAL_LCD_writeData((uint8_t)(y0 >> 8));
HAL_LCD_writeData((uint8_t)(y0));
HAL_LCD_writeData((uint8_t)(y1 >> 8));
HAL_LCD_writeData((uint8_t)(y1));
}
//*****************************************************************************
//
//! Sets the LCD Orientation.
//!
//! \param orientation is the desired orientation for the LCD. Valid values are:
//! - \b LCD_ORIENTATION_UP,
//! - \b LCD_ORIENTATION_LEFT,
//! - \b LCD_ORIENTATION_DOWN,
//! - \b LCD_ORIENTATION_RIGHT,
//!
//! This function sets the orientation of the LCD
//!
//! \return None.
//
//*****************************************************************************
void Crystalfontz128x128_SetOrientation(uint8_t orientation)
{
Lcd_Orientation = orientation;
HAL_LCD_writeCommand(CM_MADCTL);
switch (Lcd_Orientation) {
case LCD_ORIENTATION_UP:
HAL_LCD_writeData(CM_MADCTL_MX | CM_MADCTL_MY | CM_MADCTL_BGR);
break;
case LCD_ORIENTATION_LEFT:
HAL_LCD_writeData(CM_MADCTL_MY | CM_MADCTL_MV | CM_MADCTL_BGR);
break;
case LCD_ORIENTATION_DOWN:
HAL_LCD_writeData(CM_MADCTL_BGR);
break;
case LCD_ORIENTATION_RIGHT:
HAL_LCD_writeData(CM_MADCTL_MX | CM_MADCTL_MV | CM_MADCTL_BGR);
break;
}
}
//*****************************************************************************
//
//! Draws a pixel on the screen.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param lX is the X coordinate of the pixel.
//! \param lY is the Y coordinate of the pixel.
//! \param ulValue is the color of the pixel.
//!
//! This function sets the given pixel to a particular color. The coordinates of
//! the pixel are assumed to be within the extents of the display.
//!
//! Gene Bogdanov: Added local frame buffer.
//!
//! \return None.
//
//*****************************************************************************
static void Crystalfontz128x128_PixelDraw(void *pvDisplayData, int32_t lX, int32_t lY,
uint32_t ulValue)
{
Lcd_buffer[lY][lX] = ulValue;
}
//*****************************************************************************
//
//! Draws a horizontal sequence of pixels on the screen.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param lX is the X coordinate of the first pixel.
//! \param lY is the Y coordinate of the first pixel.
//! \param lX0 is sub-pixel offset within the pixel data, which is valid for 1
//! or 4 bit per pixel formats.
//! \param lCount is the number of pixels to draw.
//! \param lBPP is the number of bits per pixel; must be 1, 4, or 8.
//! \param pucData is a pointer to the pixel data. For 1 and 4 bit per pixel
//! formats, the most significant bit(s) represent the left-most pixel.
//! \param pucPalette is a pointer to the palette used to draw the pixels.
//!
//! This function draws a horizontal sequence of pixels on the screen, using
//! the supplied palette. For 1 bit per pixel format, the palette contains
//! pre-translated colors; for 4 and 8 bit per pixel formats, the palette
//! contains 24-bit RGB values that must be translated before being written to
//! the display.
//!
//! \return None.
//
//*****************************************************************************
static void Crystalfontz128x128_PixelDrawMultiple(void *pvDisplayData, int32_t lX,
int32_t lY, int32_t lX0, int32_t lCount,
int32_t lBPP,
const uint8_t *pucData,
const uint8_t *pucPalette)
{
uint32_t Data, rgb, native;
uint16_t *pWrite = &Lcd_buffer[lY][lX]; // pointer to the write location in Lcd_buffer[]
//
// Determine how to interpret the pixel data based on the number of bits
// per pixel.
//
switch(lBPP)
{
// The pixel data is in 1 bit per pixel format
case 1:
{
// Loop while there are more pixels to draw
while(lCount > 0)
{
// Get the next byte of image data
Data = *pucData++;
// Loop through the pixels in this byte of image data
for(; (lX0 < 8) && lCount; lX0++, lCount--)
{
// Draw this pixel in the appropriate color
*pWrite++ = ((uint32_t *)pucPalette)[(Data >> (7 - lX0)) & 1];
}
// Start at the beginning of the next byte of image data
lX0 = 0;
}
// The image data has been drawn
break;
}
// The pixel data is in 4 bit per pixel format
case 4:
{
// Loop while there are more pixels to draw. "Duff's device" is
// used to jump into the middle of the loop if the first nibble of
// the pixel data should not be used. Duff's device makes use of
// the fact that a case statement is legal anywhere within a
// sub-block of a switch statement. See
// http://en.wikipedia.org/wiki/Duff's_device for detailed
// information about Duff's device.
switch(lX0 & 1)
{
case 0:
while(lCount)
{
// Get the upper nibble of the next byte of pixel data
// and extract the corresponding entry from the palette
Data = (*pucData >> 4);
rgb = *(uint32_t *)(pucPalette + 3*Data);
native = Crystalfontz128x128_ColorTranslate(pvDisplayData, rgb);
// Write to LCD screen
*pWrite++ = native;
// Decrement the count of pixels to draw
lCount--;
// See if there is another pixel to draw
if(lCount)
{
case 1:
// Get the lower nibble of the next byte of pixel
// data and extract the corresponding entry from
// the palette
Data = (*pucData++ & 15);
rgb = *(uint32_t *)(pucPalette + 3*Data);
native = Crystalfontz128x128_ColorTranslate(pvDisplayData, rgb);
// Write to LCD screen
*pWrite++ = native;
// Decrement the count of pixels to draw
lCount--;
}
}
}
// The image data has been drawn.
break;
}
// The pixel data is in 8 bit per pixel format
case 8:
{
// Loop while there are more pixels to draw
while(lCount--)
{
// Get the next byte of pixel data and extract the
// corresponding entry from the palette
Data = *pucData++;
rgb = *(uint32_t *)(pucPalette + 3*Data);
native = Crystalfontz128x128_ColorTranslate(pvDisplayData, rgb);
// Write to LCD screen
*pWrite++ = native;
}
// The image data has been drawn
break;
}
//
// We are being passed data in the display's native format. Merely
// write it directly to the display. This is a special case which is
// not used by the graphics library but which is helpful to
// applications which may want to handle, for example, JPEG images.
//
case 16:
{
uint16_t usData;
// Loop while there are more pixels to draw.
while(lCount--)
{
// Get the next byte of pixel data and extract the
// corresponding entry from the palette
usData = *((uint16_t *)pucData);
pucData += 2;
// Translate this palette entry and write it to the screen
*pWrite++ = usData;
}
}
}
}
//*****************************************************************************
//
//! Draws a horizontal line.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param lX1 is the X coordinate of the start of the line.
//! \param lX2 is the X coordinate of the end of the line.
//! \param lY is the Y coordinate of the line.
//! \param ulValue is the color of the line.
//!
//! This function draws a horizontal line on the display. The coordinates of
//! the line are assumed to be within the extents of the display.
//!
//! \return None.
//
//*****************************************************************************
static void Crystalfontz128x128_LineDrawH(void *pvDisplayData, int32_t lX1, int32_t lX2,
int32_t lY, uint32_t ulValue)
{
if (lX1 & 1) { // starts at an odd coordinate: fill in first pixel
Lcd_buffer[lY][lX1] = ulValue;
lX1++;
}
if (!(lX2 & 1)) { // ends at an even coordinate: fill in last pixel
Lcd_buffer[lY][lX2] = ulValue;
lX2--;
}
// fill in the bulk of the line 2 pixels at a time
uint32_t *pWrite = (uint32_t*)&Lcd_buffer[lY][lX1]; // pointer to the start of the line
uint32_t fill = ulValue | (ulValue << 16);
for (; lX1 < lX2; lX1 += 2) {
*pWrite++ = fill;
}
}
//*****************************************************************************
//
//! Draws a vertical line.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param lX is the X coordinate of the line.
//! \param lY1 is the Y coordinate of the start of the line.
//! \param lY2 is the Y coordinate of the end of the line.
//! \param ulValue is the color of the line.
//!
//! This function draws a vertical line on the display. The coordinates of the
//! line are assumed to be within the extents of the display.
//!
//! \return None.
//
//*****************************************************************************
static void Crystalfontz128x128_LineDrawV(void *pvDisplayData, int32_t lX, int32_t lY1,
int32_t lY2, uint32_t ulValue)
{
// fill the line
for (; lY1 <= lY2; lY1++) {
Lcd_buffer[lY1][lX] = ulValue;
}
}
//*****************************************************************************
//
//! Fills a rectangle.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param pRect is a pointer to the structure describing the rectangle.
//! \param ulValue is the color of the rectangle.
//!
//! This function fills a rectangle on the display. The coordinates of the
//! rectangle are assumed to be within the extents of the display, and the
//! rectangle specification is fully inclusive (in other words, both sXMin and
//! sXMax are drawn, along with sYMin and sYMax).
//!
//! \return None.
//
//*****************************************************************************
static void Crystalfontz128x128_RectFill(void *pvDisplayData, const tRectangle *pRect,
uint32_t ulValue)
{
int32_t lX1 = pRect->i16XMin;
int32_t lX2 = pRect->i16XMax;
int32_t lY1 = pRect->i16YMin;
int32_t lY2 = pRect->i16YMax;
uint32_t i;
if (lX1 & 1) { // starts at an odd coordinate: fill in first column
for (i = lY1; i <= lY2; i++) {
Lcd_buffer[i][lX1] = ulValue;
}
lX1++;
}
if (!(lX2 & 1)) { // ends at an even coordinate: fill in last column
for (i = lY1; i <= lY2; i++) {
Lcd_buffer[i][lX2] = ulValue;
}
lX2--;
}
// fill the bulk of the rectangle
uint32_t fill = ulValue | (ulValue << 16);
for (; lY1 <= lY2; lY1++) {
// fill 2 pixels at a time
uint32_t *pWrite = (uint32_t*)&Lcd_buffer[lY1][lX1]; // pointer to the start of the line
for (i = lX1; i < lX2; i += 2) {
*pWrite++ = fill;
}
}
}
//*****************************************************************************
//
//! Translates a 24-bit RGB color to a display driver-specific color.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param ulValue is the 24-bit RGB color. The least-significant byte is the
//! blue channel, the next byte is the green channel, and the third byte is the
//! red channel.
//!
//! This function translates a 24-bit RGB color into a value that can be
//! written into the display's frame buffer in order to reproduce that color,
//! or the closest possible approximation of that color.
//!
//! \return Returns the display-driver specific color.
//
//*****************************************************************************
static uint32_t Crystalfontz128x128_ColorTranslate(void *pvDisplayData,
uint32_t ulValue)
{
//
// Translate from a 24-bit RGB color to a 5-6-5 RGB color.
//
uint32_t rgb565 =
((((ulValue) & 0x00f80000) >> 8) |
(((ulValue) & 0x0000fc00) >> 5) |
(((ulValue) & 0x000000f8) >> 3));
return (rgb565 >> 8) | ((rgb565 << 8) & 0xff00); // swap bytes
}
//*****************************************************************************
//
//! Flushes any cached drawing operations.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//!
//! This functions flushes any cached drawing operations to the display. This
//! is useful when a local frame buffer is used for drawing operations, and the
//! flush would copy the local frame buffer to the display.
//!
//! Gene Bogdanov: Added local frame buffer.
//!
//! \return None.
//
//*****************************************************************************
static void
Crystalfontz128x128_Flush(void *pvDisplayData)
{
Crystalfontz128x128_SetDrawFrame(0, 0, LCD_HORIZONTAL_MAX-1, LCD_VERTICAL_MAX-1);
HAL_LCD_writeCommand(CM_RAMWR);
int i;
uint16_t *pRead = &Lcd_buffer[0][0];
uint32_t data;
for (i = 0; i < LCD_HORIZONTAL_MAX * LCD_VERTICAL_MAX; i++)
{
data = *pRead++;
HAL_LCD_writeData((uint8_t)data);
HAL_LCD_writeData((uint8_t)(data >> 8));
}
}
//*****************************************************************************
//
//! Send command to clear screen.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//!
//! This function does a clear screen and the Display Buffer contents
//! are initialized to the current background color.
//!
//! \return None.
//
//*****************************************************************************
//static void
//Crystalfontz128x128_ClearScreen (void *pvDisplayData, uint16_t ulValue)
//{
// tRectangle rect = { 0, 0, LCD_VERTICAL_MAX-1, LCD_VERTICAL_MAX-1};
// Crystalfontz128x128_RectFill(&pvDisplayData, &rect, ulValue);
//}
//*****************************************************************************
//
//! The display structure that describes the driver for the Kitronix
//! K350QVG-V1-F TFT panel with an SSD2119 controller.
//
//*****************************************************************************
const tDisplay g_sCrystalfontz128x128 =
{
sizeof(tDisplay),
0,
LCD_VERTICAL_MAX,
LCD_HORIZONTAL_MAX,
Crystalfontz128x128_PixelDraw,
Crystalfontz128x128_PixelDrawMultiple,
Crystalfontz128x128_LineDrawH,
Crystalfontz128x128_LineDrawV,
Crystalfontz128x128_RectFill,
Crystalfontz128x128_ColorTranslate,
Crystalfontz128x128_Flush
};

View file

@ -0,0 +1,114 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2015, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
//
// Crystalfontz128x128.h - Prototypes for the display driver for the Crystalfontz
// 128x128 display with ST7735 controller.
//
// Modified by Gene Bogdanov 8/30/2017
//
//*****************************************************************************
#ifndef __CRYSTALFONTZLCD_H__
#define __CRYSTALFONTZLCD_H__
#include <stdint.h>
#include <stdbool.h>
#include "grlib/grlib.h"
// LCD Screen Dimensions
#define LCD_VERTICAL_MAX 128
#define LCD_HORIZONTAL_MAX 128
#define LCD_ORIENTATION_UP 0
#define LCD_ORIENTATION_LEFT 1
#define LCD_ORIENTATION_DOWN 2
#define LCD_ORIENTATION_RIGHT 3
// ST7735 LCD controller Command Set
#define CM_NOP 0x00
#define CM_SWRESET 0x01
#define CM_RDDID 0x04
#define CM_RDDST 0x09
#define CM_SLPIN 0x10
#define CM_SLPOUT 0x11
#define CM_PTLON 0x12
#define CM_NORON 0x13
#define CM_INVOFF 0x20
#define CM_INVON 0x21
#define CM_GAMSET 0x26
#define CM_DISPOFF 0x28
#define CM_DISPON 0x29
#define CM_CASET 0x2A
#define CM_RASET 0x2B
#define CM_RAMWR 0x2C
#define CM_RGBSET 0x2d
#define CM_RAMRD 0x2E
#define CM_PTLAR 0x30
#define CM_MADCTL 0x36
#define CM_COLMOD 0x3A
#define CM_SETPWCTR 0xB1
#define CM_SETDISPL 0xB2
#define CM_FRMCTR3 0xB3
#define CM_SETCYC 0xB4
#define CM_SETBGP 0xb5
#define CM_SETVCOM 0xB6
#define CM_SETSTBA 0xC0
#define CM_SETID 0xC3
#define CM_GETHID 0xd0
#define CM_SETGAMMA 0xE0
#define CM_MADCTL_MY 0x80
#define CM_MADCTL_MX 0x40
#define CM_MADCTL_MV 0x20
#define CM_MADCTL_ML 0x10
#define CM_MADCTL_BGR 0x08
#define CM_MADCTL_MH 0x04
extern uint8_t Lcd_Orientation;
extern uint16_t Lcd_ScreenWidth, Lcd_ScreenHeigth;
extern uint8_t Lcd_PenSolid, Lcd_FontSolid, Lcd_FlagRead;
extern uint16_t Lcd_TouchTrim;
extern uint16_t Lcd_buffer[LCD_VERTICAL_MAX][LCD_HORIZONTAL_MAX];
extern const tDisplay g_sCrystalfontz128x128;
extern void Crystalfontz128x128_Init(void);
extern void Crystalfontz128x128_SetDrawFrame(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1);
extern void Crystalfontz128x128_SetOrientation(uint8_t orientation);
#endif /* __CRYSTALFONTZLCD_H__ */

View file

@ -0,0 +1,133 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2015, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
//
// HAL_EK_TM4C1294XL_Crystalfontz128x128_ST7735.c -
// Hardware abstraction layer for using the Educational Boosterpack's
// Crystalfontz128x128 LCD with EK-TM4C1294XL LaunchPad
//
// Ported by Gene Bogdanov 8/30/2017
//
//*****************************************************************************
#include <stdint.h>
#include <stdbool.h>
#include "HAL_EK_TM4C1294XL_Crystalfontz128x128_ST7735.h"
#include "grlib/grlib.h"
#include "inc/hw_memmap.h"
#include "driverlib/gpio.h"
#include "driverlib/ssi.h"
#include "driverlib/sysctl.h"
#include "driverlib/pin_map.h"
void HAL_LCD_PortInit(void)
{
// LCD_SCK
SysCtlPeripheralEnable(LCD_SCK_PERIPH);
GPIOPinTypeSSI(LCD_SCK_BASE, LCD_SCK_PIN);
GPIOPinConfigure(LCD_SCK_CONFIG);
// LCD_MOSI
SysCtlPeripheralEnable(LCD_MOSI_PERIPH);
GPIOPinTypeSSI(LCD_MOSI_BASE, LCD_MOSI_PIN);
GPIOPinConfigure(LCD_MOSI_CONFIG);
// LCD_RST
SysCtlPeripheralEnable(LCD_RST_PERIPH);
GPIOPinTypeGPIOOutput(LCD_RST_BASE, LCD_RST_PIN);
// LCD_RS (DC)
SysCtlPeripheralEnable(LCD_DC_PERIPH);
GPIOPinTypeGPIOOutput(LCD_DC_BASE, LCD_DC_PIN);
// LCD_CS
SysCtlPeripheralEnable(LCD_CS_PERIPH);
GPIOPinTypeGPIOOutput(LCD_CS_BASE, LCD_CS_PIN);
}
void HAL_LCD_SpiInit(void)
{
// configure SSI as SPI
SysCtlPeripheralEnable(LCD_SSI_PERIPH);
SSIConfigSetExpClk(LCD_SSI_BASE, LCD_SYSTEM_CLOCK, LCD_SSI_PROTOCOL, SSI_MODE_MASTER, LCD_SSI_CLOCK, LCD_SSI_DATA_WIDTH);
SSIEnable(LCD_SSI_BASE);
// set outputs to default state
GPIOPinWrite(LCD_CS_BASE, LCD_CS_PIN, 0);
GPIOPinWrite(LCD_DC_BASE, LCD_DC_PIN, LCD_DC_PIN);
// activate reset
GPIOPinWrite(LCD_RST_BASE, LCD_RST_PIN, 0);
HAL_LCD_delay(20);
// deactivate reset
GPIOPinWrite(LCD_RST_BASE, LCD_RST_PIN, LCD_RST_PIN);
// delay more than 120 ms after reset
HAL_LCD_delay(120000);
}
//*****************************************************************************
//
// Writes a command to the CFAF128128B-0145T. This function implements the basic SPI
// interface to the LCD display.
//
//*****************************************************************************
void HAL_LCD_writeCommand(uint8_t command)
{
// Set to command mode
while (SSIBusy(LCD_SSI_BASE)); // finish any transmission
GPIOPinWrite(LCD_DC_BASE, LCD_DC_PIN, 0);
// Transmit data
SSIDataPut(LCD_SSI_BASE, command);
while (SSIBusy(LCD_SSI_BASE)); // finish transmission
// Set back to data mode
GPIOPinWrite(LCD_DC_BASE, LCD_DC_PIN, LCD_DC_PIN);
}
//*****************************************************************************
//
// Writes a data to the CFAF128128B-0145T. This function implements the basic SPI
// interface to the LCD display.
//
//*****************************************************************************
void HAL_LCD_writeData(uint8_t data)
{
// Transmit data
SSIDataPut(LCD_SSI_BASE, data); // returns before data finishes transmitting
}

View file

@ -0,0 +1,101 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2015, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
//
// HAL_EK_TM4C1294XL_Crystalfontz128x128_ST7735.h -
// Hardware abstraction layer for using the Educational Boosterpack's
// Crystalfontz128x128 LCD with EK-TM4C1294XL LaunchPad
//
// Ported by Gene Bogdanov 8/30/2017
//
//*****************************************************************************
#ifndef __HAL_EK_TM4C1294XL_CRYSTALFONTZLCD_H_
#define __HAL_EK_TM4C1294XL_CRYSTALFONTZLCD_H_
#include <stdint.h>
#include "driverlib/sysctl.h"
//*****************************************************************************
//
// User Configuration for the LCD Driver
//
//*****************************************************************************
// System clock speed (in Hz)
#define LCD_SYSTEM_CLOCK 120000000 // EK-TM4C1294XL at full speed
// SPI clock speed (in Hz)
#define LCD_SSI_CLOCK 15000000
// Ports and pins from MCU connected to LCD (BOOSTXL-EDUMKII as BoosterPack 2 of EK-TM4C1294XL)
// SCK
#define LCD_SCK_PERIPH SYSCTL_PERIPH_GPIOQ
#define LCD_SCK_BASE GPIO_PORTQ_BASE
#define LCD_SCK_PIN GPIO_PIN_0
#define LCD_SCK_CONFIG GPIO_PQ0_SSI3CLK
// MOSI
#define LCD_MOSI_PERIPH SYSCTL_PERIPH_GPIOQ
#define LCD_MOSI_BASE GPIO_PORTQ_BASE
#define LCD_MOSI_PIN GPIO_PIN_2
#define LCD_MOSI_CONFIG GPIO_PQ2_SSI3XDAT0
// RST
#define LCD_RST_PERIPH SYSCTL_PERIPH_GPIOA
#define LCD_RST_BASE GPIO_PORTA_BASE
#define LCD_RST_PIN GPIO_PIN_7
// CS
#define LCD_CS_PERIPH SYSCTL_PERIPH_GPIOP
#define LCD_CS_BASE GPIO_PORTP_BASE
#define LCD_CS_PIN GPIO_PIN_3
// DC (RS)
#define LCD_DC_PERIPH SYSCTL_PERIPH_GPIOK
#define LCD_DC_BASE GPIO_PORTK_BASE
#define LCD_DC_PIN GPIO_PIN_7
// SPI (SSI) configuration
#define LCD_SSI_PERIPH SYSCTL_PERIPH_SSI3
#define LCD_SSI_BASE SSI3_BASE
#define LCD_SSI_PROTOCOL SSI_FRF_MOTO_MODE_0
#define LCD_SSI_DATA_WIDTH 8 // bits
//*****************************************************************************
//
// Prototypes for the globals exported by this driver.
//
//*****************************************************************************
extern void HAL_LCD_writeCommand(uint8_t command);
extern void HAL_LCD_writeData(uint8_t data);
extern void HAL_LCD_PortInit(void);
extern void HAL_LCD_SpiInit(void);
#define HAL_LCD_delay(x) SysCtlDelay((x) * 40) // delay in us
#endif /* __HAL_EK_TM4C1294XL_CRYSTALFONTZLCD_H_ */

168
buttons.c Normal file
View file

@ -0,0 +1,168 @@
/*
* buttons.c
*
* Created on: Aug 12, 2012, modified 9/8/2017
* Author: Gene Bogdanov
*
* ECE 3849 Lab button handling
*/
#include <stdint.h>
#include <stdbool.h>
#include <math.h>
#include "inc/hw_memmap.h"
#include "inc/hw_ints.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/timer.h"
#include "driverlib/interrupt.h"
#include "driverlib/adc.h"
#include "sysctl_pll.h"
#include "buttons.h"
// public globals
volatile uint32_t gButtons = 0; // debounced button state, one per bit in the lowest bits
// button is pressed if its bit is 1, not pressed if 0
uint32_t gJoystick[2] = {0}; // joystick coordinates
uint32_t gADCSamplingRate; // [Hz] actual ADC sampling rate
// imported globals
extern uint32_t gSystemClock; // [Hz] system clock frequency
extern volatile uint32_t gTime; // time in hundredths of a second
// initialize all button and joystick handling hardware
void ButtonInit(void)
{
// initialize a general purpose timer for periodic interrupts
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
TimerDisable(TIMER0_BASE, TIMER_BOTH);
TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
TimerLoadSet(TIMER0_BASE, TIMER_A, roundf((float)gSystemClock / BUTTON_SCAN_RATE) - 1);
TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
TimerEnable(TIMER0_BASE, TIMER_BOTH);
// initialize interrupt controller to respond to timer interrupts
IntPrioritySet(INT_TIMER0A, BUTTON_INT_PRIORITY);
IntEnable(INT_TIMER0A);
/*
// GPIO PJ0 and PJ1 = EK-TM4C1294XL buttons 1 and 2
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);
GPIOPinTypeGPIOInput(GPIO_PORTJ_BASE, GPIO_PIN_0 | GPIO_PIN_1);
GPIOPadConfigSet(GPIO_PORTJ_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
// analog input AIN13, at GPIO PD2 = BoosterPack Joystick HOR(X)
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_2);
// analog input AIN17, at GPIO PK1 = BoosterPack Joystick VER(Y)
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
GPIOPinTypeADC(GPIO_PORTK_BASE, GPIO_PIN_1);
// initialize ADC0 peripheral
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
uint32_t pll_frequency = SysCtlFrequencyGet(CRYSTAL_FREQUENCY);
uint32_t pll_divisor = (pll_frequency - 1) / (16 * ADC_SAMPLING_RATE) + 1; // round divisor up
gADCSamplingRate = pll_frequency / (16 * pll_divisor); // actual sampling rate may differ from ADC_SAMPLING_RATE
ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PLL | ADC_CLOCK_RATE_FULL, pll_divisor); // only ADC0 has PLL clock divisor control
// initialize ADC sampling sequence
ADCSequenceDisable(ADC0_BASE, 0);
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH13); // Joystick HOR(X)
ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_CH17 | ADC_CTL_IE | ADC_CTL_END); // Joystick VER(Y)
ADCSequenceEnable(ADC0_BASE, 0);
*/
}
// update the debounced button state gButtons
void ButtonDebounce(uint32_t buttons)
{
int32_t i, mask;
static int32_t state[BUTTON_COUNT]; // button state: 0 = released
// BUTTON_PRESSED_STATE = pressed
// in between = previous state
for (i = 0; i < BUTTON_COUNT; i++) {
mask = 1 << i;
if (buttons & mask) {
state[i] += BUTTON_STATE_INCREMENT;
if (state[i] >= BUTTON_PRESSED_STATE) {
state[i] = BUTTON_PRESSED_STATE;
gButtons |= mask; // update debounced button state
}
}
else {
state[i] -= BUTTON_STATE_DECREMENT;
if (state[i] <= 0) {
state[i] = 0;
gButtons &= ~mask;
}
}
}
}
// sample joystick and convert to button presses
void ButtonReadJoystick(void)
{
ADCProcessorTrigger(ADC0_BASE, 0); // trigger the ADC sample sequence for Joystick X and Y
while(!ADCIntStatus(ADC0_BASE, 0, false)); // wait until the sample sequence has completed
ADCSequenceDataGet(ADC0_BASE, 0, gJoystick);// retrieve joystick data
ADCIntClear(ADC0_BASE, 0); // clear ADC sequence interrupt flag
// process joystick movements as button presses using hysteresis
if (gJoystick[0] > JOYSTICK_UPPER_PRESS_THRESHOLD) gButtons |= 1 << 5; // joystick right in position 5
if (gJoystick[0] < JOYSTICK_UPPER_RELEASE_THRESHOLD) gButtons &= ~(1 << 5);
if (gJoystick[0] < JOYSTICK_LOWER_PRESS_THRESHOLD) gButtons |= 1 << 6; // joystick left in position 6
if (gJoystick[0] > JOYSTICK_LOWER_RELEASE_THRESHOLD) gButtons &= ~(1 << 6);
if (gJoystick[1] > JOYSTICK_UPPER_PRESS_THRESHOLD) gButtons |= 1 << 7; // joystick up in position 7
if (gJoystick[1] < JOYSTICK_UPPER_RELEASE_THRESHOLD) gButtons &= ~(1 << 7);
if (gJoystick[1] < JOYSTICK_LOWER_PRESS_THRESHOLD) gButtons |= 1 << 8; // joystick down in position 8
if (gJoystick[1] > JOYSTICK_LOWER_RELEASE_THRESHOLD) gButtons &= ~(1 << 8);
}
// autorepeat button presses if a button is held long enough
uint32_t ButtonAutoRepeat(void)
{
static int count[BUTTON_AND_JOYSTICK_COUNT] = {0}; // autorepeat counts
int i;
uint32_t mask;
uint32_t presses = 0;
for (i = 0; i < BUTTON_AND_JOYSTICK_COUNT; i++) {
mask = 1 << i;
if (gButtons & mask)
count[i]++; // increment count if button is held
else
count[i] = 0; // reset count if button is let go
if (count[i] >= BUTTON_AUTOREPEAT_INITIAL &&
(count[i] - BUTTON_AUTOREPEAT_INITIAL) % BUTTON_AUTOREPEAT_NEXT == 0)
presses |= mask; // register a button press due to auto-repeat
}
return presses;
}
// ISR for scanning and debouncing buttons
void ButtonISR(void) {
TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); // clear interrupt flag
/*
// read hardware button state
uint32_t gpio_buttons =
~GPIOPinRead(GPIO_PORTJ_BASE, 0xff) & (GPIO_PIN_1 | GPIO_PIN_0); // EK-TM4C1294XL buttons in positions 0 and 1
uint32_t old_buttons = gButtons; // save previous button state
ButtonDebounce(gpio_buttons); // Run the button debouncer. The result is in gButtons.
ButtonReadJoystick(); // Convert joystick state to button presses. The result is in gButtons.
uint32_t presses = ~old_buttons & gButtons; // detect button presses (transitions from not pressed to pressed)
presses |= ButtonAutoRepeat(); // autorepeat presses if a button is held long enough
*/
static bool tic = false;
static bool running = true;
/*
if (presses & 1) { // EK-TM4C1294XL button 1 pressed
running = !running;
}
*/
if (running) {
if (tic) gTime++; // increment time every other ISR call
tic = !tic;
}
}

55
buttons.h Normal file
View file

@ -0,0 +1,55 @@
/*
* buttons.h
*
* Created on: Aug 12, 2012, modified 9/8/2017
* Author: Gene Bogdanov
*
* Button debouncer, calibrated for 200 samples/sec.
*/
#ifndef BUTTONS_H_
#define BUTTONS_H_
#include <stdint.h>
#define BUTTON_COUNT 5 // number of buttons excluding joystick directions
#define BUTTON_AND_JOYSTICK_COUNT 9 // number of buttons including joystick directions
#define BUTTON_SAMPLES_PRESSED 2 // number of samples before a button is considered pressed
#define BUTTON_SAMPLES_RELEASED 5 // number of samples before a button is considered released
// counter value indicating button pressed state
#define BUTTON_PRESSED_STATE (BUTTON_SAMPLES_RELEASED*BUTTON_SAMPLES_PRESSED)
#define BUTTON_STATE_INCREMENT (BUTTON_PRESSED_STATE/BUTTON_SAMPLES_PRESSED)
#define BUTTON_STATE_DECREMENT (BUTTON_PRESSED_STATE/BUTTON_SAMPLES_RELEASED)
#define BUTTON_SCAN_RATE 200 // [Hz] button scanning interrupt rate
#define BUTTON_INT_PRIORITY 32 // button interrupt priority (higher number is lower priority)
#define BUTTON_AUTOREPEAT_INITIAL 100 // how many samples must read pressed before autorepeat starts
#define BUTTON_AUTOREPEAT_NEXT 10 // how many samples must read pressed before the next repetition
#define JOYSTICK_UPPER_PRESS_THRESHOLD 3595 // above this ADC value, button is pressed
#define JOYSTICK_UPPER_RELEASE_THRESHOLD 3095 // below this ADC value, button is released
#define JOYSTICK_LOWER_PRESS_THRESHOLD 500 // below this ADC value, button is pressed
#define JOYSTICK_LOWER_RELEASE_THRESHOLD 1000 // above this ADC value, button is released
#define ADC_SAMPLING_RATE 1000000 // [samples/sec] desired ADC sampling rate
#define CRYSTAL_FREQUENCY 25000000 // [Hz] crystal oscillator frequency used to calculate clock rates
extern volatile uint32_t gButtons; // debounced button state, one per bit in the lowest bits
extern uint32_t gJoystick[2]; // joystick coordinates
extern uint32_t gADCSamplingRate; // [Hz] actual ADC sampling rate
// initialize all button and joystick handling hardware
void ButtonInit(void);
// update the debounced button state in the global variable gButtons
// the input argument is a bitmap of raw button state from the hardware
void ButtonDebounce(uint32_t buttons);
// sample joystick and convert to button presses
void ButtonReadJoystick(void);
// autorepeat button presses if a button is held long enough
uint32_t ButtonAutoRepeat(void);
#endif /* BUTTONS_H_ */

59
main.c Normal file
View file

@ -0,0 +1,59 @@
/**
* main.c
*
* ECE 3849 Lab 0 Starter Project
* Gene Bogdanov 10/18/2017
*
* This version is using the new hardware for B2017: the EK-TM4C1294XL LaunchPad with BOOSTXL-EDUMKII BoosterPack.
*
*/
#include <stdint.h>
#include <stdbool.h>
#include "driverlib/fpu.h"
#include "driverlib/sysctl.h"
#include "driverlib/interrupt.h"
#include "Crystalfontz128x128_ST7735.h"
#include <stdio.h>
uint32_t gSystemClock; // [Hz] system clock frequency
volatile uint32_t gTime = 8345; // time in hundredths of a second
int main(void)
{
IntMasterDisable();
// Enable the Floating Point Unit, and permit ISRs to use it
FPUEnable();
FPULazyStackingEnable();
// Initialize the system clock to 120 MHz
gSystemClock = SysCtlClockFreqSet(SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480, 120000000);
Crystalfontz128x128_Init(); // Initialize the LCD display driver
Crystalfontz128x128_SetOrientation(LCD_ORIENTATION_UP); // set screen orientation
tContext sContext;
GrContextInit(&sContext, &g_sCrystalfontz128x128); // Initialize the grlib graphics context
GrContextFontSet(&sContext, &g_sFontFixed6x8); // select font
uint32_t time; // local copy of gTime
char str[50]; // string buffer
// full-screen rectangle
tRectangle rectFullScreen = {0, 0, GrContextDpyWidthGet(&sContext)-1, GrContextDpyHeightGet(&sContext)-1};
while (true) {
GrContextForegroundSet(&sContext, ClrBlack);
GrRectFill(&sContext, &rectFullScreen); // fill screen with black
time = gTime; // read shared global only once
uint32_t hundredths = time % 100;
uint32_t seconds = (time / 100) % 60;
uint32_t minutes = (time / (100 * 60));
snprintf(str, sizeof(str), "Time = %02u:%02u:%02u", minutes, seconds, hundredths); // convert time to string
GrContextForegroundSet(&sContext, ClrYellow); // yellow text
GrStringDraw(&sContext, str, /*length*/ -1, /*x*/ 0, /*y*/ 0, /*opaque*/ false);
GrFlush(&sContext); // flush the frame buffer to the LCD
}
}

115
sysctl_pll.c Normal file
View file

@ -0,0 +1,115 @@
//*****************************************************************************
//
// sysctl.c - Driver for the system controller.
//
// Copyright (c) 2005-2015 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Excerpt exporting the normally static function _SysCtlFrequencyGet.
//
//*****************************************************************************
#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_ints.h"
#include "inc/hw_nvic.h"
#include "inc/hw_sysctl.h"
#include "inc/hw_types.h"
#include "inc/hw_flash.h"
#include "driverlib/cpu.h"
#include "driverlib/debug.h"
#include "driverlib/interrupt.h"
#include "driverlib/sysctl.h"
//*****************************************************************************
//
// Calculate the system frequency from the register settings base on the
// oscillator input.
//
//*****************************************************************************
uint32_t SysCtlFrequencyGet(uint32_t ui32Xtal)
{
uint32_t ui32Result;
uint_fast16_t ui16F1, ui16F2;
uint_fast16_t ui16PInt, ui16PFract;
uint_fast8_t ui8Q, ui8N;
//
// Extract all of the values from the hardware registers.
//
ui16PFract = ((HWREG(SYSCTL_PLLFREQ0) & SYSCTL_PLLFREQ0_MFRAC_M) >>
SYSCTL_PLLFREQ0_MFRAC_S);
ui16PInt = HWREG(SYSCTL_PLLFREQ0) & SYSCTL_PLLFREQ0_MINT_M;
ui8Q = (((HWREG(SYSCTL_PLLFREQ1) & SYSCTL_PLLFREQ1_Q_M) >>
SYSCTL_PLLFREQ1_Q_S) + 1);
ui8N = (((HWREG(SYSCTL_PLLFREQ1) & SYSCTL_PLLFREQ1_N_M) >>
SYSCTL_PLLFREQ1_N_S) + 1);
//
// Divide the crystal value by N.
//
ui32Xtal /= (uint32_t)ui8N;
//
// Calculate the multiplier for bits 9:5.
//
ui16F1 = ui16PFract / 32;
//
// Calculate the multiplier for bits 4:0.
//
ui16F2 = ui16PFract - (ui16F1 * 32);
//
// Get the integer portion.
//
ui32Result = ui32Xtal * (uint32_t)ui16PInt;
//
// Add first fractional bits portion(9:0).
//
ui32Result += (ui32Xtal * (uint32_t)ui16F1) / 32;
//
// Add the second fractional bits portion(4:0).
//
ui32Result += (ui32Xtal * (uint32_t)ui16F2) / 1024;
//
// Divide the result by Q.
//
ui32Result = ui32Result / (uint32_t)ui8Q;
//
// Return the resulting PLL frequency.
//
return(ui32Result);
}

45
sysctl_pll.h Normal file
View file

@ -0,0 +1,45 @@
//*****************************************************************************
//
// sysctl.h - Prototypes for the system control driver.
//
// Copyright (c) 2005-2015 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Excerpt exporting the normally static function _SysCtlFrequencyGet.
//
//*****************************************************************************
#ifndef SYSCTL_PLL_H_
#define SYSCTL_PLL_H_
uint32_t SysCtlFrequencyGet(uint32_t ui32Xtal);
#endif /* SYSCTL_PLL_H_ */

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configurations XML_version="1.2" id="configurations_0">
<configuration XML_version="1.2" id="configuration_0">
<instance XML_version="1.2" desc="Stellaris In-Circuit Debug Interface" href="connections/Stellaris_ICDI_Connection.xml" id="Stellaris In-Circuit Debug Interface" xml="Stellaris_ICDI_Connection.xml" xmlpath="connections"/>
<connection XML_version="1.2" id="Stellaris In-Circuit Debug Interface">
<instance XML_version="1.2" href="drivers/stellaris_cs_dap.xml" id="drivers" xml="stellaris_cs_dap.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/stellaris_cortex_m4.xml" id="drivers" xml="stellaris_cortex_m4.xml" xmlpath="drivers"/>
<platform XML_version="1.2" id="platform_0">
<instance XML_version="1.2" desc="Tiva TM4C1294NCPDT" href="devices/tm4c1294ncpdt.xml" id="Tiva TM4C1294NCPDT" xml="tm4c1294ncpdt.xml" xmlpath="devices"/>
</platform>
</connection>
</configuration>
</configurations>

9
targetConfigs/readme.txt Normal file
View file

@ -0,0 +1,9 @@
The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based
on the device and connection settings specified in your project on the Properties > General page.
Please note that in automatic target-configuration management, changes to the project's device and/or
connection settings will either modify an existing or generate a new target-configuration file. Thus,
if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively,
you may create your own target-configuration file for this project and manage it manually. You can
always switch back to automatic target-configuration management by checking the "Manage the project's
target-configuration automatically" checkbox on the project's Properties > General page.

45
tm4c1294ncpdt.cmd Normal file
View file

@ -0,0 +1,45 @@
/******************************************************************************
*
* Default Linker Command file for the Texas Instruments TM4C1294NCPDT
*
* This is derived from revision 15071 of the TivaWare Library.
*
*****************************************************************************/
--retain=g_pfnVectors
MEMORY
{
FLASH (RX) : origin = 0x00000000, length = 0x00100000
SRAM (RWX) : origin = 0x20000000, length = 0x00040000
}
/* The following command line options are set as part of the CCS project. */
/* If you are building using the command line, or for some reason want to */
/* define them here, you can uncomment and modify these lines as needed. */
/* If you are using CCS for building, it is probably better to make any such */
/* modifications in your CCS project and leave this file alone. */
/* */
/* --heap_size=0 */
/* --stack_size=256 */
/* --library=rtsv7M4_T_le_eabi.lib */
/* Section allocation in memory */
SECTIONS
{
.intvecs: > 0x00000000
.text : > FLASH
.const : > FLASH
.cinit : > FLASH
.pinit : > FLASH
.init_array : > FLASH
.vtable : > 0x20000000
.data : > SRAM
.bss : > SRAM
.sysmem : > SRAM
.stack : > SRAM
}
__STACK_TOP = __stack + 512;

276
tm4c1294ncpdt_startup_ccs.c Normal file
View file

@ -0,0 +1,276 @@
//*****************************************************************************
//
// Startup code for use with TI's Code Composer Studio.
//
// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Software License Agreement
//
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
//*****************************************************************************
#include <stdint.h>
//*****************************************************************************
//
// Forward declaration of the default fault handlers.
//
//*****************************************************************************
void ResetISR(void);
static void NmiSR(void);
static void FaultISR(void);
static void IntDefaultHandler(void);
//*****************************************************************************
//
// External declaration for the reset handler that is to be called when the
// processor is started
//
//*****************************************************************************
extern void _c_int00(void);
//*****************************************************************************
//
// Linker variable that marks the top of the stack.
//
//*****************************************************************************
extern uint32_t __STACK_TOP;
//*****************************************************************************
//
// External declarations for the interrupt handlers used by the application.
//
//*****************************************************************************
// To be added by user
//*****************************************************************************
//
// The vector table. Note that the proper constructs must be placed on this to
// ensure that it ends up at physical address 0x0000.0000 or at the start of
// the program if located at a start address other than 0.
//
//*****************************************************************************
#pragma DATA_SECTION(g_pfnVectors, ".intvecs")
void (* const g_pfnVectors[])(void) =
{
(void (*)(void))((uint32_t)&__STACK_TOP),
// The initial stack pointer
ResetISR, // The reset handler
NmiSR, // The NMI handler
FaultISR, // The hard fault handler
IntDefaultHandler, // The MPU fault handler
IntDefaultHandler, // The bus fault handler
IntDefaultHandler, // The usage fault handler
0, // Reserved
0, // Reserved
0, // Reserved
0, // Reserved
IntDefaultHandler, // SVCall handler
IntDefaultHandler, // Debug monitor handler
0, // Reserved
IntDefaultHandler, // The PendSV handler
IntDefaultHandler, // The SysTick handler
IntDefaultHandler, // GPIO Port A
IntDefaultHandler, // GPIO Port B
IntDefaultHandler, // GPIO Port C
IntDefaultHandler, // GPIO Port D
IntDefaultHandler, // GPIO Port E
IntDefaultHandler, // UART0 Rx and Tx
IntDefaultHandler, // UART1 Rx and Tx
IntDefaultHandler, // SSI0 Rx and Tx
IntDefaultHandler, // I2C0 Master and Slave
IntDefaultHandler, // PWM Fault
IntDefaultHandler, // PWM Generator 0
IntDefaultHandler, // PWM Generator 1
IntDefaultHandler, // PWM Generator 2
IntDefaultHandler, // Quadrature Encoder 0
IntDefaultHandler, // ADC Sequence 0
IntDefaultHandler, // ADC Sequence 1
IntDefaultHandler, // ADC Sequence 2
IntDefaultHandler, // ADC Sequence 3
IntDefaultHandler, // Watchdog timer
IntDefaultHandler, // Timer 0 subtimer A
IntDefaultHandler, // Timer 0 subtimer B
IntDefaultHandler, // Timer 1 subtimer A
IntDefaultHandler, // Timer 1 subtimer B
IntDefaultHandler, // Timer 2 subtimer A
IntDefaultHandler, // Timer 2 subtimer B
IntDefaultHandler, // Analog Comparator 0
IntDefaultHandler, // Analog Comparator 1
IntDefaultHandler, // Analog Comparator 2
IntDefaultHandler, // System Control (PLL, OSC, BO)
IntDefaultHandler, // FLASH Control
IntDefaultHandler, // GPIO Port F
IntDefaultHandler, // GPIO Port G
IntDefaultHandler, // GPIO Port H
IntDefaultHandler, // UART2 Rx and Tx
IntDefaultHandler, // SSI1 Rx and Tx
IntDefaultHandler, // Timer 3 subtimer A
IntDefaultHandler, // Timer 3 subtimer B
IntDefaultHandler, // I2C1 Master and Slave
IntDefaultHandler, // CAN0
IntDefaultHandler, // CAN1
IntDefaultHandler, // Ethernet
IntDefaultHandler, // Hibernate
IntDefaultHandler, // USB0
IntDefaultHandler, // PWM Generator 3
IntDefaultHandler, // uDMA Software Transfer
IntDefaultHandler, // uDMA Error
IntDefaultHandler, // ADC1 Sequence 0
IntDefaultHandler, // ADC1 Sequence 1
IntDefaultHandler, // ADC1 Sequence 2
IntDefaultHandler, // ADC1 Sequence 3
IntDefaultHandler, // External Bus Interface 0
IntDefaultHandler, // GPIO Port J
IntDefaultHandler, // GPIO Port K
IntDefaultHandler, // GPIO Port L
IntDefaultHandler, // SSI2 Rx and Tx
IntDefaultHandler, // SSI3 Rx and Tx
IntDefaultHandler, // UART3 Rx and Tx
IntDefaultHandler, // UART4 Rx and Tx
IntDefaultHandler, // UART5 Rx and Tx
IntDefaultHandler, // UART6 Rx and Tx
IntDefaultHandler, // UART7 Rx and Tx
IntDefaultHandler, // I2C2 Master and Slave
IntDefaultHandler, // I2C3 Master and Slave
IntDefaultHandler, // Timer 4 subtimer A
IntDefaultHandler, // Timer 4 subtimer B
IntDefaultHandler, // Timer 5 subtimer A
IntDefaultHandler, // Timer 5 subtimer B
IntDefaultHandler, // FPU
0, // Reserved
0, // Reserved
IntDefaultHandler, // I2C4 Master and Slave
IntDefaultHandler, // I2C5 Master and Slave
IntDefaultHandler, // GPIO Port M
IntDefaultHandler, // GPIO Port N
0, // Reserved
IntDefaultHandler, // Tamper
IntDefaultHandler, // GPIO Port P (Summary or P0)
IntDefaultHandler, // GPIO Port P1
IntDefaultHandler, // GPIO Port P2
IntDefaultHandler, // GPIO Port P3
IntDefaultHandler, // GPIO Port P4
IntDefaultHandler, // GPIO Port P5
IntDefaultHandler, // GPIO Port P6
IntDefaultHandler, // GPIO Port P7
IntDefaultHandler, // GPIO Port Q (Summary or Q0)
IntDefaultHandler, // GPIO Port Q1
IntDefaultHandler, // GPIO Port Q2
IntDefaultHandler, // GPIO Port Q3
IntDefaultHandler, // GPIO Port Q4
IntDefaultHandler, // GPIO Port Q5
IntDefaultHandler, // GPIO Port Q6
IntDefaultHandler, // GPIO Port Q7
IntDefaultHandler, // GPIO Port R
IntDefaultHandler, // GPIO Port S
IntDefaultHandler, // SHA/MD5 0
IntDefaultHandler, // AES 0
IntDefaultHandler, // DES3DES 0
IntDefaultHandler, // LCD Controller 0
IntDefaultHandler, // Timer 6 subtimer A
IntDefaultHandler, // Timer 6 subtimer B
IntDefaultHandler, // Timer 7 subtimer A
IntDefaultHandler, // Timer 7 subtimer B
IntDefaultHandler, // I2C6 Master and Slave
IntDefaultHandler, // I2C7 Master and Slave
IntDefaultHandler, // HIM Scan Matrix Keyboard 0
IntDefaultHandler, // One Wire 0
IntDefaultHandler, // HIM PS/2 0
IntDefaultHandler, // HIM LED Sequencer 0
IntDefaultHandler, // HIM Consumer IR 0
IntDefaultHandler, // I2C8 Master and Slave
IntDefaultHandler, // I2C9 Master and Slave
IntDefaultHandler, // GPIO Port T
IntDefaultHandler, // Fan 1
0, // Reserved
};
//*****************************************************************************
//
// This is the code that gets called when the processor first starts execution
// following a reset event. Only the absolutely necessary set is performed,
// after which the application supplied entry() routine is called. Any fancy
// actions (such as making decisions based on the reset cause register, and
// resetting the bits in that register) are left solely in the hands of the
// application.
//
//*****************************************************************************
void
ResetISR(void)
{
//
// Jump to the CCS C initialization routine. This will enable the
// floating-point unit as well, so that does not need to be done here.
//
__asm(" .global _c_int00\n"
" b.w _c_int00");
}
//*****************************************************************************
//
// This is the code that gets called when the processor receives a NMI. This
// simply enters an infinite loop, preserving the system state for examination
// by a debugger.
//
//*****************************************************************************
static void
NmiSR(void)
{
//
// Enter an infinite loop.
//
while(1)
{
}
}
//*****************************************************************************
//
// This is the code that gets called when the processor receives a fault
// interrupt. This simply enters an infinite loop, preserving the system state
// for examination by a debugger.
//
//*****************************************************************************
static void
FaultISR(void)
{
//
// Enter an infinite loop.
//
while(1)
{
}
}
//*****************************************************************************
//
// This is the code that gets called when the processor receives an unexpected
// interrupt. This simply enters an infinite loop, preserving the system state
// for examination by a debugger.
//
//*****************************************************************************
static void
IntDefaultHandler(void)
{
//
// Go into an infinite loop.
//
while(1)
{
}
}