--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<?ccsproject version="1.0"?>\r
+\r
+<projectOptions>\r
+<deviceVariant value="MSP430F5438A"/>\r
+<deviceEndianness value="little"/>\r
+<codegenToolVersion value="3.3.1"/>\r
+<isElfFormat value="false"/>\r
+<linkerCommandFile value="lnk_msp430f5438a.cmd"/>\r
+<rts value="libc.a"/>\r
+</projectOptions>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<?fileVersion 3.1.0?>\r
+\r
+<ManagedProjectBuildInfo>\r
+<project id="RTOSDemo.com.ti.ccstudio.buildDefinitions.MSP430.ProjectType.390526873" name="MSP430" projectType="com.ti.ccstudio.buildDefinitions.MSP430.ProjectType">\r
+<configuration artifactExtension="out" artifactName="RTOSDemo" description="" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382" name="Debug" parent="com.ti.ccstudio.buildDefinitions.MSP430.Debug">\r
+<toolChain id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.DebugToolchain.1435545480" name="TI Code Generation Tools" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.linkerDebug.1882128094">\r
+<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1939561680" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">\r
+<listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=MSP430F5438A"/>\r
+<listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>\r
+<listOptionValue builtIn="false" value="OUTPUT_FORMAT=COFF"/>\r
+<listOptionValue builtIn="false" value="CCS_MBS_VERSION=4.2.0"/>\r
+<listOptionValue builtIn="false" value="LINKER_COMMAND_FILE=lnk_msp430f5438a.cmd"/>\r
+<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>\r
+<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>\r
+</option>\r
+<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.2036195343" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="3.3.1" valueType="string"/>\r
+<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug">\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DIAG_WARNING.621480247" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DIAG_WARNING" valueType="stringList">\r
+<listOptionValue builtIn="false" value="225"/>\r
+</option>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.PRINTF_SUPPORT.37183846" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.PRINTF_SUPPORT" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.PRINTF_SUPPORT.minimal" valueType="enumerated"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_VERSION.1568785139" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_VERSION.mspx" valueType="enumerated"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DEFINE.1497996645" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DEFINE" valueType="definedSymbols">\r
+<listOptionValue builtIn="false" value="__MSP430F5438A__"/>\r
+</option>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_ERRATA.CPU21.1362716564" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_ERRATA.CPU21" value="true" valueType="boolean"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_ERRATA.CPU22.844673927" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_ERRATA.CPU22" value="true" valueType="boolean"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_ERRATA.CPU23.2031322476" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_ERRATA.CPU23" value="true" valueType="boolean"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_ERRATA.CPU40.1655029752" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_ERRATA.CPU40" value="true" valueType="boolean"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.INCLUDE_PATH.2084743920" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.INCLUDE_PATH" valueType="includePath">\r
+<listOptionValue builtIn="false" value=""${CCS_INSTALL_ROOT}/msp430/include""/>\r
+<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo/Demo_Source/Common_Demo_Files/include}""/>\r
+<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo/Demo_Source/MSP-EXP430F5438_HAL}""/>\r
+<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo/Demo_Source/F5XX_6XX_Core_Lib}""/>\r
+<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo/Demo_Source}""/>\r
+<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo}""/>\r
+<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo/FreeRTOS_Source/include}""/>\r
+<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo/FreeRTOS_Source/portable/CCS4/MSP430X}""/>\r
+<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/include""/>\r
+</option>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.CODE_MODEL.446616973" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.CODE_MODEL" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.CODE_MODEL.large" valueType="enumerated"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DATA_MODEL.1471292597" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DATA_MODEL" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DATA_MODEL.large" valueType="enumerated"/>\r
+</tool>\r
+<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.linkerDebug.1882128094" name="MSP430 Linker" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.linkerDebug">\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE.1907940977" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE" value="300" valueType="string"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.STACK_SIZE.155131239" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.STACK_SIZE" value="300" valueType="string"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY.1895647999" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY.F5" valueType="enumerated"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.OUTPUT_FILE.2049770982" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.OUTPUT_FILE" value=""RTOSDemo.out"" valueType="string"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.MAP_FILE.572680980" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.MAP_FILE" value=""RTOSDemo.map"" valueType="string"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.LIBRARY.1698632584" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.LIBRARY" valueType="libs">\r
+<listOptionValue builtIn="false" value=""libc.a""/>\r
+</option>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.SEARCH_PATH.302988553" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.SEARCH_PATH" valueType="stringList">\r
+<listOptionValue builtIn="false" value=""${CCS_INSTALL_ROOT}/msp430/include""/>\r
+<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/lib""/>\r
+<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/include""/>\r
+</option>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.generatedLinkerCommandFiles.757897994" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.generatedLinkerCommandFiles" valueType="libs">\r
+<listOptionValue builtIn="false" value=""$(GEN_CMDS_QUOTED)""/>\r
+</option>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.INITIALIZATION_MODEL.2021374180" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.INITIALIZATION_MODEL" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.INITIALIZATION_MODEL.ROM_MODEL" valueType="enumerated"/>\r
+</tool>\r
+<macros expandEnvironmentMacros="true"/>\r
+</toolChain>\r
+<resourceConfiguration exclude="false" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382./RTOSDemo/source/F5XX_6XX_Core_Lib/hal_UCS.c" name="hal_UCS.c" rcbsApplicability="disable" resourcePath="/RTOSDemo/Demo_Source/F5XX_6XX_Core_Lib/hal_UCS.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/F5XX_6XX_Core_Lib/hal_UCS.c">\r
+<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/F5XX_6XX_Core_Lib/hal_UCS.c" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398"/>\r
+</resourceConfiguration>\r
+<resourceConfiguration exclude="false" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382./RTOSDemo/source/MSP-EXP430F5438_HAL/hal_board.c" name="hal_board.c" rcbsApplicability="disable" resourcePath="/RTOSDemo/Demo_Source/MSP-EXP430F5438_HAL/hal_board.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/MSP-EXP430F5438_HAL/hal_board.c">\r
+<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/MSP-EXP430F5438_HAL/hal_board.c" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398"/>\r
+</resourceConfiguration>\r
+<resourceConfiguration exclude="false" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382./RTOSDemo/source/MSP-EXP430F5438_HAL/hal_buttons.c" name="hal_buttons.c" rcbsApplicability="disable" resourcePath="/RTOSDemo/Demo_Source/MSP-EXP430F5438_HAL/hal_buttons.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/MSP-EXP430F5438_HAL/hal_buttons.c">\r
+<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/MSP-EXP430F5438_HAL/hal_buttons.c" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398"/>\r
+</resourceConfiguration>\r
+<resourceConfiguration exclude="false" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382./RTOSDemo/source/MSP-EXP430F5438_HAL/hal_lcd.c" name="hal_lcd.c" rcbsApplicability="disable" resourcePath="/RTOSDemo/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/MSP-EXP430F5438_HAL/hal_lcd.c">\r
+<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/MSP-EXP430F5438_HAL/hal_lcd.c" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398"/>\r
+</resourceConfiguration>\r
+<resourceConfiguration exclude="false" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382./RTOSDemo/source/MSP-EXP430F5438_HAL/hal_lcd_fonts.c" name="hal_lcd_fonts.c" rcbsApplicability="disable" resourcePath="/RTOSDemo/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd_fonts.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/MSP-EXP430F5438_HAL/hal_lcd_fonts.c">\r
+<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/MSP-EXP430F5438_HAL/hal_lcd_fonts.c" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398"/>\r
+</resourceConfiguration>\r
+<resourceConfiguration exclude="false" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382./RTOSDemo/source/ParTest.c" name="ParTest.c" rcbsApplicability="disable" resourcePath="/RTOSDemo/Demo_Source/ParTest.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/ParTest.c">\r
+<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/ParTest.c" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398"/>\r
+</resourceConfiguration>\r
+<resourceConfiguration exclude="true" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382./RTOSDemo/source/RunTimeStatsConfig.c" name="RunTimeStatsConfig.c" rcbsApplicability="disable" resourcePath="/RTOSDemo/Demo_Source/RunTimeStatsConfig.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/RunTimeStatsConfig.c">\r
+<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/RunTimeStatsConfig.c" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398"/>\r
+</resourceConfiguration>\r
+<resourceConfiguration exclude="false" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382./RTOSDemo/source/main.c" name="main.c" rcbsApplicability="disable" resourcePath="/RTOSDemo/Demo_Source/main.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/main.c">\r
+<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/main.c" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398"/>\r
+</resourceConfiguration>\r
+<resourceConfiguration exclude="false" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382./RTOSDemo/source/serial.c" name="serial.c" rcbsApplicability="disable" resourcePath="/RTOSDemo/Demo_Source/serial.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/serial.c">\r
+<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/serial.c" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398"/>\r
+</resourceConfiguration>\r
+<resourceConfiguration exclude="false" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382./RTOSDemo/source/RegTest.s43" name="RegTest.s43" rcbsApplicability="disable" resourcePath="/RTOSDemo/Demo_Source/RegTest.asm" toolsToInvoke="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/RegTest.s43">\r
+<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/source/RegTest.s43" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398"/>\r
+</resourceConfiguration>\r
+<resourceConfiguration exclude="false" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382./RTOSDemo/FreeRTOS_Source/portable/CCS4/MSP430X/portext.s43" name="portext.s43" rcbsApplicability="disable" resourcePath="/RTOSDemo/FreeRTOS_Source/portable/CCS4/MSP430X/portext.asm" toolsToInvoke="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/FreeRTOS_Source/portable/CCS4/MSP430X/portext.s43">\r
+<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398./RTOSDemo/FreeRTOS_Source/portable/CCS4/MSP430X/portext.s43" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.compilerDebug.2087986398"/>\r
+</resourceConfiguration>\r
+</configuration>\r
+<macros/>\r
+</project>\r
+</ManagedProjectBuildInfo>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<?eclipse-cdt version="2.0"?>\r
+\r
+<cdtproject id="org.eclipse.cdt.managedbuilder.core.managedMake">\r
+<extension id="org.eclipse.cdt.managedbuilder.core.ManagedBuildManager" point="org.eclipse.cdt.core.ScannerInfoProvider"/>\r
+<extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/>\r
+<data>\r
+<item id="org.eclipse.cdt.core.pathentry">\r
+<pathentry kind="src" path=""/>\r
+<pathentry kind="out" path=""/>\r
+<pathentry kind="con" path="org.eclipse.cdt.managedbuilder.MANAGED_CONTAINER"/>\r
+<pathentry kind="con" path="com.ti.ccstudio.managedbuild.core.CCS_CONTAINER"/>\r
+</item>\r
+</data>\r
+</cdtproject>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>RTOSDemo</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.cdt.core.cnature</nature>\r
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>\r
+ <nature>org.eclipse.cdt.core.ccnature</nature>\r
+ <nature>com.ti.ccstudio.managedbuild.core.ccsNature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+#Sat Jan 01 13:05:50 GMT 2011\r
+com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382/internalBuilder/enabled=false\r
+com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382/internalBuilder/ignoreErr=true\r
+eclipse.preferences.version=1\r
+environment/project=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<environment/>\r\n\r
+environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<environment/>\r\n\r
--- /dev/null
+#Sat Jan 01 16:11:34 GMT 2011\r
+eclipse.preferences.version=1\r
+org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false\r
--- /dev/null
+REM This file should be executed from the command line prior to the first\r
+REM build. It will be necessary to refresh the Eclipse project once the\r
+REM .bat file has been executed (normally just press F5 to refresh).\r
+\r
+REM Copies all the required files from their location within the standard\r
+REM FreeRTOS directory structure to under the Eclipse project directory.\r
+REM This permits the Eclipse project to be used in 'managed' mode and without\r
+REM having to setup any linked resources.\r
+\r
+REM Have the files already been copied?\r
+IF EXIST FreeRTOS_Source Goto END\r
+\r
+ REM Create the required directory structure.\r
+ MD FreeRTOS_Source\r
+ MD FreeRTOS_Source\include \r
+ MD FreeRTOS_Source\portable\CCS4\r
+ MD FreeRTOS_Source\portable\CCS4\MSP430X\r
+ MD FreeRTOS_Source\portable\MemMang \r
+ MD Demo_Source\Common_Demo_Files\r
+ MD Demo_Source\Common_Demo_Files\include\r
+ \r
+ REM Copy the core kernel files.\r
+ copy ..\..\Source\tasks.c FreeRTOS_Source\r
+ copy ..\..\Source\queue.c FreeRTOS_Source\r
+ copy ..\..\Source\list.c FreeRTOS_Source\r
+ \r
+ REM Copy the common header files\r
+\r
+ copy ..\..\Source\include\*.* FreeRTOS_Source\include\r
+ \r
+ REM Copy the portable layer files\r
+ copy ..\..\Source\portable\GCC\ARM_CM3\*.* FreeRTOS_Source\portable\CCS4\MSP430X\r
+ \r
+ REM Copy the basic memory allocation files\r
+ copy ..\..\Source\portable\MemMang\heap_1.c FreeRTOS_Source\portable\MemMang\r
+\r
+ REM Copy the files that define the common demo tasks.\r
+ copy ..\Common\minimal\dynamic.c Demo_Source\Common_Demo_Files\r
+ copy ..\Common\minimal\comtest.c Demo_Source\Common_Demo_Files\r
+ copy ..\Common\minimal\GenQTest.c Demo_Source\Common_Demo_Files\r
+ \r
+ REM Copy the common demo file headers.\r
+ copy ..\Common\include\dynamic.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\Common\include\comtest.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\Common\include\comtest2.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\Common\include\GenQTest.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\Common\include\serial.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\Common\include\partest.h Demo_Source\Common_Demo_Files\include\r
+ \r
+: END
\ No newline at end of file
--- /dev/null
+//*******************************************************************************\r
+// Provides Functions to Initialize the UCS/FLL and clock sources\r
+// File: hal_ucs.c\r
+//\r
+// Texas Instruments\r
+//\r
+// Version 1.2\r
+// 11/24/09\r
+//\r
+// V1.0 Initial Version\r
+// V1.1 Added timeout function\r
+// V1.1 Added parameter for XTDrive\r
+//*******************************************************************************\r
+\r
+#include "msp430.h"\r
+#include "hal_UCS.h"\r
+\r
+//************************************************************************\r
+// Check and define required Defines\r
+//************************************************************************\r
+\r
+#ifndef XT1LFOFFG // Defines if not available in header file\r
+#define XT1LFOFFG 0\r
+#endif\r
+#ifndef XT1HFOFFG // Defines if not available in header file\r
+#define XT1HFOFFG 0\r
+#endif\r
+#ifndef XT2OFFG // Defines if not available in header file\r
+#define XT2OFFG 0\r
+#endif\r
+#ifndef XTS // Defines if not available in header file\r
+#define XTS 0\r
+#endif\r
+#ifndef XT2DRIVE_3 // Defines if not available in header file\r
+#define XT2DRIVE_3 0\r
+#endif\r
+\r
+//====================================================================\r
+/**\r
+ * Startup routine for 32kHz Cristal on LFXT1\r
+ *\r
+*/\r
+void LFXT_Start(uint16_t xtdrive)\r
+{\r
+ UCSCTL6_L |= XT1DRIVE1_L+XT1DRIVE0_L; // Highest drive setting for XT1 startup\r
+\r
+ while (SFRIFG1 & OFIFG) { // check OFIFG fault flag\r
+ UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags fault flags\r
+ SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag\r
+ }\r
+ UCSCTL6 = (UCSCTL6 & ~(XT1DRIVE_3)) |(xtdrive); // set Drive mode\r
+}\r
+\r
+//====================================================================\r
+/**\r
+ * Startup routine for 32kHz Cristal on LFXT1 with timeout counter\r
+ *\r
+*/\r
+uint16_t LFXT_Start_Timeout(uint16_t xtdrive, uint16_t timeout)\r
+{\r
+ UCSCTL6_L |= XT1DRIVE1_L+XT1DRIVE0_L; // Highest drive setting for XT1 startup\r
+\r
+ while ((SFRIFG1 & OFIFG) && timeout--){ // check OFIFG fault flag\r
+ UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags fault flags\r
+ SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag\r
+ }\r
+ UCSCTL6 = (UCSCTL6 & ~(XT1DRIVE_3)) |(xtdrive); // set Drive mode\r
+ if (timeout)\r
+ return (UCS_STATUS_OK);\r
+ else\r
+ return (UCS_STATUS_ERROR);\r
+}\r
+\r
+\r
+//====================================================================\r
+/**\r
+ * Startup routine for XT1\r
+ *\r
+*/\r
+void XT1_Start(uint16_t xtdrive)\r
+{\r
+ UCSCTL6 &= ~(XT1OFF | XT1DRIVE_3); // enable XT1\r
+ UCSCTL6 |= (XTS | xtdrive); // enable XT1 and set XT1Drive\r
+\r
+ while (SFRIFG1 & OFIFG) { // check OFIFG fault flag\r
+ UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags\r
+ SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag\r
+ }\r
+}\r
+\r
+//====================================================================\r
+/**\r
+ * Startup routine for XT1 with timeout counter\r
+ *\r
+*/\r
+uint16_t XT1_Start_Timeout(uint16_t xtdrive, uint16_t timeout)\r
+{\r
+ UCSCTL6 &= ~(XT1OFF | XT1DRIVE_3); // enable XT1\r
+ UCSCTL6 |= (XTS | xtdrive); // enable XT1 and set XT1Drive\r
+\r
+ while ((SFRIFG1 & OFIFG) && timeout--) { // check OFIFG fault flag\r
+ UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags\r
+ SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag\r
+ }\r
+ if (timeout)\r
+ return (UCS_STATUS_OK);\r
+ else\r
+ return (UCS_STATUS_ERROR);\r
+}\r
+\r
+//====================================================================\r
+/**\r
+ * Use XT1 in Bypasss mode\r
+ *\r
+*/\r
+void XT1_Bypass(void)\r
+{\r
+ UCSCTL6 |= XT1BYPASS;\r
+\r
+ while (SFRIFG1 & OFIFG) { // check OFIFG fault flag\r
+ UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags\r
+ SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag\r
+ }\r
+}\r
+\r
+//====================================================================\r
+/**\r
+ * Startup routine for XT2\r
+ *\r
+*/\r
+void XT2_Start(uint16_t xtdrive)\r
+{\r
+ UCSCTL6 &= ~(XT2OFF | XT2DRIVE_3); // enable XT2\r
+ UCSCTL6 |= (xtdrive); // Set XT2Drive\r
+\r
+ while (SFRIFG1 & OFIFG) { // check OFIFG fault flag\r
+ UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags\r
+ SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag\r
+ }\r
+\r
+}\r
+\r
+//====================================================================\r
+/**\r
+ * Startup routine for XT2 with timeout counter\r
+ *\r
+*/\r
+uint16_t XT2_Start_Timeout(uint16_t xtdrive, uint16_t timeout)\r
+{\r
+ UCSCTL6 &= ~XT2OFF; // Set XT2 On\r
+ UCSCTL6 &= ~XT2DRIVE_3; // enable XT2\r
+ UCSCTL6 |= (xtdrive); // Set XT2Drive\r
+\r
+ while ((SFRIFG1 & OFIFG) && timeout--){ // check OFIFG fault flag\r
+ UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags\r
+ SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag\r
+ }\r
+ if (timeout)\r
+ return (UCS_STATUS_OK);\r
+ else\r
+ return (UCS_STATUS_ERROR);\r
+}\r
+\r
+//====================================================================\r
+/**\r
+ * Use XT2 in Bypasss mode\r
+ *\r
+*/\r
+void XT2_Bypass(void)\r
+{\r
+#ifdef XT2BYPASS // on devices without XT2 this function will be empty\r
+ UCSCTL6 |= XT2BYPASS;\r
+\r
+ while (SFRIFG1 & OFIFG) { // check OFIFG fault flag\r
+ UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags\r
+ SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag\r
+ }\r
+#endif\r
+}\r
+\r
+//====================================================================\r
+/**\r
+ * Initializes FLL of the UCS and wait till settled\r
+ *\r
+ * \param fsystem required system frequency (MCLK) in kHz\r
+ * \param ratio ratio between MCLK and FLLREFCLK\r
+ */\r
+void Init_FLL_Settle(uint16_t fsystem, uint16_t ratio)\r
+{\r
+ volatile uint16_t x = ratio * 32; \r
+ // save actual state of FLL loop control\r
+ uint16_t globalInterruptState = __get_SR_register() & SCG0;\r
+ \r
+ __bic_SR_register(SCG0); // Enable FLL loop control\r
+\r
+ Init_FLL(fsystem, ratio);\r
+ \r
+ while(x--)\r
+ {\r
+ __delay_cycles(30); \r
+ }\r
+ \r
+ __bis_SR_register(globalInterruptState); // restore previous state\r
+\r
+}\r
+\r
+//====================================================================\r
+/**\r
+ * Initializes FLL of the UCS\r
+ *\r
+ * \param fsystem required system frequency (MCLK) in kHz\r
+ * \param ratio ratio between fsystem and FLLREFCLK\r
+ */\r
+static void Init_FLL(uint16_t fsystem, uint16_t ratio)\r
+{\r
+ uint16_t d, dco_div_bits;\r
+ uint16_t mode = 0;\r
+\r
+ d = ratio;\r
+ dco_div_bits = FLLD__2; // Have at least a divider of 2\r
+ if (fsystem > 16000){\r
+ d >>= 1 ;\r
+ mode = 1;\r
+ }\r
+ else\r
+ fsystem <<= 1; // fsystem = fsystem * 2\r
+\r
+ while (d > 512)\r
+ {\r
+ dco_div_bits = dco_div_bits + FLLD0; // set next higher div level\r
+ d >>= 1;\r
+ }\r
+\r
+ UCSCTL0 = 0x000; // Set DCO to lowest Tap\r
+\r
+ UCSCTL2 &= ~(0x3FF); // Reset FN bits\r
+ UCSCTL2 = dco_div_bits | (d - 1);\r
+\r
+ if (fsystem <= 630) // fsystem < 0.63MHz\r
+ UCSCTL1= DCORSEL_0 ;\r
+ else if (fsystem < 1250) // 0.63MHz < fsystem < 1.25MHz\r
+ UCSCTL1= DCORSEL_1 ;\r
+ else if (fsystem < 2500) // 1.25MHz < fsystem < 2.5MHz\r
+ UCSCTL1= DCORSEL_2 ;\r
+ else if (fsystem < 5000) // 2.5MHz < fsystem < 5MHz\r
+ UCSCTL1= DCORSEL_3 ;\r
+ else if (fsystem < 10000) // 5MHz < fsystem < 10MHz\r
+ UCSCTL1= DCORSEL_4 ;\r
+ else if (fsystem < 20000) // 10MHz < fsystem < 20MHz\r
+ UCSCTL1= DCORSEL_5 ;\r
+ else if (fsystem < 40000) // 20MHz < fsystem < 40MHz\r
+ UCSCTL1= DCORSEL_6 ;\r
+ else\r
+ UCSCTL1= DCORSEL_7 ;\r
+\r
+ while (SFRIFG1 & OFIFG) { // check OFIFG fault flag\r
+ UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags\r
+ SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag\r
+ }\r
+\r
+ if (mode == 1) // fsystem > 16000\r
+ SELECT_MCLK_SMCLK(SELM__DCOCLK + SELS__DCOCLK); // select DCOCLK\r
+ else\r
+ SELECT_MCLK_SMCLK(SELM__DCOCLKDIV + SELS__DCOCLKDIV); // selcet DCODIVCLK\r
+\r
+ \r
+} // End of fll_init()\r
--- /dev/null
+//*******************************************************************************\r
+// Provides Functions to Initialize the UCS/FLL and clock sources\r
+// File: hal_ucs.c\r
+//\r
+// Texas Instruments\r
+//\r
+// Version 1.2\r
+// 11/24/09\r
+//\r
+// V1.0 Initial Version\r
+// V1.1 Added timeout function\r
+// V1.1 Added parameter for XTDrive\r
+//*******************************************************************************\r
+\r
+\r
+#ifndef __hal_UCS\r
+#define __hal_UCS\r
+\r
+#include <stdint.h>\r
+#include "hal_macros.h"\r
+\r
+/*************************************************************************\r
+* MACROS\r
+**************************************************************************/\r
+\r
+/* Select source for FLLREF e.g. SELECT_FLLREF(SELREF__XT1CLK) */\r
+#define SELECT_FLLREF(source) st(UCSCTL3 = (UCSCTL3 & ~(SELREF_7)) | (source);) \r
+/* Select source for ACLK e.g. SELECT_ACLK(SELA__XT1CLK) */\r
+#define SELECT_ACLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELA_7)) | (source);) \r
+/* Select source for MCLK e.g. SELECT_MCLK(SELM__XT2CLK) */\r
+#define SELECT_MCLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELM_7)) | (source);) \r
+/* Select source for SMCLK e.g. SELECT_SMCLK(SELS__XT2CLK) */\r
+#define SELECT_SMCLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELS_7)) | (source);) \r
+/* Select source for MCLK and SMCLK e.g. SELECT_MCLK_SMCLK(SELM__DCOCLK + SELS__DCOCLK) */\r
+#define SELECT_MCLK_SMCLK(sources) st(UCSCTL4 = (UCSCTL4 & ~(SELM_7 + SELS_7)) | (sources);)\r
+\r
+/* set ACLK/x */\r
+#define ACLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVA_7)) | (DIVA__##x);) \r
+/* set MCLK/x */\r
+#define MCLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVM_7)) | (DIVM__##x);) \r
+/* set SMCLK/x */\r
+#define SMCLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVS_7)) | (DIVS__##x);) \r
+/* Select divider for FLLREF e.g. SELECT_FLLREFDIV(2) */\r
+#define SELECT_FLLREFDIV(x) st(UCSCTL3 = (UCSCTL3 & ~(FLLREFDIV_7))|(FLLREFDIV__##x);) \r
+\r
+//************************************************************************\r
+// Defines\r
+//************************************************************************\r
+\r
+#define UCS_STATUS_OK 0\r
+#define UCS_STATUS_ERROR 1\r
+\r
+//====================================================================\r
+/**\r
+ * Startup routine for 32kHz Cristal on LFXT1\r
+ *\r
+ * \param xtdrive: Bits defining the LFXT drive mode after startup\r
+ *\r
+*/\r
+extern void LFXT_Start(uint16_t xtdrive);\r
+\r
+//====================================================================\r
+/**\r
+ * Startup routine for 32kHz Cristal on LFXT1 with timeout counter\r
+ *\r
+ * \param xtdrive: Bits defining the LFXT drive mode after startup\r
+ * \param timeout: value for the timeout counter\r
+ *\r
+*/\r
+extern uint16_t LFXT_Start_Timeout(uint16_t xtdrive, uint16_t timeout);\r
+\r
+//====================================================================\r
+/**\r
+ * Startup routine for XT1\r
+ *\r
+ * \param xtdrive: Bits defining the XT drive mode\r
+ *\r
+*/\r
+extern void XT1_Start(uint16_t xtdrive);\r
+\r
+//====================================================================\r
+/**\r
+ * Startup routine for XT1 with timeout counter\r
+ *\r
+ * \param xtdrive: Bits defining the XT drive mode\r
+ * \param timeout: value for the timeout counter\r
+ *\r
+*/\r
+extern uint16_t XT1_Start_Timeout(uint16_t xtdrive, uint16_t timeout);\r
+\r
+//====================================================================\r
+/**\r
+ * Use XT1 in Bypasss mode\r
+ *\r
+*/\r
+extern void XT1_Bypass(void);\r
+\r
+//====================================================================\r
+/**\r
+ * Startup routine for XT2\r
+ *\r
+ * \param xtdrive: Bits defining the XT drive mode\r
+ *\r
+*/\r
+extern void XT2_Start(uint16_t xtdrive);\r
+\r
+//====================================================================\r
+/**\r
+ * Startup routine for XT2 with timeout counter\r
+ *\r
+ * \param xtdrive: Bits defining the XT drive mode\r
+ * \param timeout: value for the timeout counter\r
+ *\r
+*/\r
+extern uint16_t XT2_Start_Timeout(uint16_t xtdrive, uint16_t timeout);\r
+\r
+//====================================================================\r
+/**\r
+ * Use XT2 in Bypasss mode for MCLK\r
+ *\r
+*/\r
+extern void XT2_Bypass(void);\r
+\r
+//====================================================================\r
+/**\r
+ * Initializes FLL of the UCS and wait till settled\r
+ *\r
+ * \param fsystem required system frequency (MCLK) in kHz\r
+ * \param ratio ratio between fsystem and FLLREFCLK\r
+ */\r
+extern void Init_FLL_Settle(uint16_t fsystem, uint16_t ratio);\r
+\r
+\r
+//====================================================================\r
+/**\r
+ * Initializes FLL of the UCS\r
+ *\r
+ * \param fsystem required system frequency (MCLK) in kHz\r
+ * \param ratio ratio between fsystem and FLLREFCLK\r
+ */\r
+static void Init_FLL(uint16_t fsystem, uint16_t ratio);\r
+\r
+#endif /* __hal_UCS */\r
--- /dev/null
+/*\r
+ * This macro is for use by other macros to form a fully valid C statement.\r
+ */\r
+#define st(x) do { x } while (__LINE__ == -1)\r
--- /dev/null
+/*\r
+ FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * If you are: *\r
+ * *\r
+ * + New to FreeRTOS, *\r
+ * + Wanting to learn FreeRTOS or multitasking in general quickly *\r
+ * + Looking for basic training, *\r
+ * + Wanting to improve your FreeRTOS skills and productivity *\r
+ * *\r
+ * then take a look at the FreeRTOS books - available as PDF or paperback *\r
+ * *\r
+ * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ * A pdf reference manual is also available. Both are usually delivered *\r
+ * to your inbox within 20 minutes to two hours when purchased between 8am *\r
+ * and 8pm GMT (although please allow up to 24 hours in case of *\r
+ * exceptional circumstances). Thank you for your support! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+ ***NOTE*** The exception to the GPL is included to allow you to distribute\r
+ a combined work that includes FreeRTOS without being obliged to provide the\r
+ source code for proprietary components outside of the FreeRTOS kernel.\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+ more details. You should have received a copy of the GNU General Public\r
+ License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+ can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+ by writing to Richard Barry, contact details for whom are available on the\r
+ FreeRTOS WEB site.\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
+ licensing and training services.\r
+*/\r
+\r
+#ifndef FREERTOS_CONFIG_H\r
+#define FREERTOS_CONFIG_H\r
+\r
+/*-----------------------------------------------------------\r
+ * Application specific definitions.\r
+ *\r
+ * These definitions should be adjusted for your particular hardware and\r
+ * application requirements.\r
+ *\r
+ * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE\r
+ * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.\r
+ *\r
+ * See http://www.freertos.org/a00110.html.\r
+ *----------------------------------------------------------*/\r
+\r
+#define configUSE_PREEMPTION 1\r
+#define configUSE_IDLE_HOOK 1\r
+#define configUSE_TICK_HOOK 1\r
+#define configCPU_CLOCK_HZ ( 16000000UL ) \r
+#define configTICK_RATE_HZ ( ( portTickType ) 1000 )\r
+#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )\r
+#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 )\r
+#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 9 * 1024 ) )\r
+#define configMAX_TASK_NAME_LEN ( 10 )\r
+#define configUSE_TRACE_FACILITY 0\r
+#define configUSE_16_BIT_TICKS 0\r
+#define configIDLE_SHOULD_YIELD 1\r
+#define configUSE_MUTEXES 1\r
+#define configQUEUE_REGISTRY_SIZE 5\r
+#define configGENERATE_RUN_TIME_STATS 0\r
+#define configCHECK_FOR_STACK_OVERFLOW 2\r
+#define configUSE_RECURSIVE_MUTEXES 0\r
+#define configUSE_MALLOC_FAILED_HOOK 1\r
+#define configUSE_APPLICATION_TASK_TAG 0\r
+\r
+/* Co-routine definitions. */\r
+#define configUSE_CO_ROUTINES 0\r
+#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )\r
+\r
+/* Set the following definitions to 1 to include the API function, or zero\r
+to exclude the API function. */\r
+#define INCLUDE_vTaskPrioritySet 1\r
+#define INCLUDE_uxTaskPriorityGet 1\r
+#define INCLUDE_vTaskDelete 0\r
+#define INCLUDE_vTaskCleanUpResources 0\r
+#define INCLUDE_vTaskSuspend 1\r
+#define INCLUDE_vTaskDelayUntil 1\r
+#define INCLUDE_vTaskDelay 1\r
+\r
+/* The MSP430X port uses a callback function to configure its tick interrupt.\r
+This allows the application to choose the tick interrupt source.\r
+configTICK_INTERRUPT_VECTOR must also be set in FreeRTOSConfig.h to the correct\r
+interrupt vector for the chosen tick interrupt source. This implementation of\r
+vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this\r
+case configTICK_INTERRUPT_VECTOR is set to TIMER0_A0_VECTOR. */\r
+#define configTICK_INTERRUPT_VECTOR TIMER0_A0_VECTOR\r
+\r
+/* Prevent the following definitions being included when FreeRTOSConfig.h\r
+is included from an asm file. */\r
+#ifdef __ICC430__\r
+ extern void vConfigureTimerForRunTimeStats( void );\r
+ extern inline unsigned long ulGetRunTimeStatsTime( void );\r
+ extern volatile unsigned long ulStatsOverflowCount;\r
+#endif /* __ICCARM__ */\r
+\r
+//#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()\r
+//#define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeStatsTime()\r
+\r
+#endif /* FREERTOS_CONFIG_H */\r
+\r
--- /dev/null
+/*******************************************************************************\r
+ Filename: hal_MSP-EXP430F5438.h\r
+\r
+ Copyright 2010 Texas Instruments, Inc.\r
+\r
+This is the master header file and also the only necessary file to be included\r
+in order to use MSP-EXP430F5438 HAL.\r
+***************************************************************************/\r
+#ifndef HAL_MSP_EXP430F5438_H\r
+#define HAL_MSP_EXP430F5438_H\r
+\r
+#include "msp430.h"\r
+\r
+//#include "hal_PMM.h"\r
+#include "hal_UCS.h"\r
+\r
+#include "hal_lcd.h"\r
+#include "hal_buttons.h"\r
+//#include "hal_adc.h"\r
+#include "hal_board.h"\r
+//#include "hal_usb.h"\r
+#include "hal_buttons.h"\r
+//#include "hal_rf.h"\r
+//#include "hal_rtc.h"\r
+//#include "hal_tlv.h"\r
+\r
+#endif /* HAL_MSP_EXP430F5438_H */\r
--- /dev/null
+/**\r
+ * @file hal_board.c\r
+ *\r
+ * Copyright 2010 Texas Instruments, Inc.\r
+******************************************************************************/\r
+#include "msp430.h"\r
+#include "hal_MSP-EXP430F5438.h"\r
+\r
+/**********************************************************************//**\r
+ * @brief Initializes ACLK, MCLK, SMCLK outputs on P11.0, P11.1,\r
+ * and P11.2, respectively.\r
+ *\r
+ * @param none\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halBoardOutputSystemClock(void) //outputs clock to testpoints\r
+{\r
+ CLK_PORT_DIR |= 0x07;\r
+ CLK_PORT_SEL |= 0x07;\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Stops the output of ACLK, MCLK, SMCLK on P11.0, P11.1, and P11.2.\r
+ *\r
+ * @param none\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halBoardStopOutputSystemClock(void)\r
+{\r
+ CLK_PORT_OUT &= ~0x07;\r
+ CLK_PORT_DIR |= 0x07; \r
+ CLK_PORT_SEL &= ~0x07;\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Initializes all GPIO configurations.\r
+ *\r
+ * @param none\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halBoardInit(void)\r
+{\r
+ //Tie unused ports\r
+ PAOUT = 0;\r
+ PADIR = 0xFFFF;\r
+ PASEL = 0;\r
+ PBOUT = 0;\r
+ PBDIR = 0xFFFF;\r
+ PBSEL = 0;\r
+ PCOUT = 0;\r
+ PCDIR = 0xFFFF;\r
+ PCSEL = 0;\r
+ PDOUT = 0;\r
+ PDDIR = 0xFFFF;\r
+ PDSEL = 0x0003;\r
+ PEOUT = 0;\r
+ PEDIR = 0xFEFF; // P10.0 to USB RST pin,\r
+ // ...if enabled with J5\r
+ PESEL = 0;\r
+ P11OUT = 0;\r
+ P11DIR = 0xFF;\r
+ PJOUT = 0;\r
+ PJDIR = 0xFF;\r
+ P11SEL = 0;\r
+}\r
--- /dev/null
+/**********************************************************************//**\r
+ Filename: hal_board.h\r
+\r
+ Copyright 2010 Texas Instruments, Inc.\r
+***************************************************************************/\r
+#ifndef HAL_BOARD_H\r
+#define HAL_BOARD_H\r
+\r
+#define LED_PORT_DIR P1DIR\r
+#define LED_PORT_OUT P1OUT\r
+#define LED_1 BIT0\r
+#define LED_2 BIT1\r
+\r
+#define CLK_PORT_DIR P11DIR //outputs clocks to testpoints\r
+#define CLK_PORT_OUT P11OUT\r
+#define CLK_PORT_SEL P11SEL\r
+\r
+/*----------------------------------------------------------------\r
+ * Function Prototypes\r
+ *----------------------------------------------------------------\r
+ */\r
+static void halBoardGetSystemClockSettings(unsigned char systemClockSpeed, \r
+ unsigned char *setDcoRange,\r
+ unsigned char *setVCore,\r
+ unsigned int *setMultiplier);\r
+\r
+extern void halBoardOutputSystemClock(void);\r
+extern void halBoardStopOutputSystemClock(void);\r
+extern void halBoardInit(void);\r
+\r
+#endif /* HAL_BOARD_H */\r
--- /dev/null
+/** \r
+ * @file hal_buttons.c\r
+ * \r
+ * Copyright 2010 Texas Instruments, Inc.\r
+***************************************************************************/\r
+#include "msp430.h"\r
+#include "hal_MSP-EXP430F5438.h"\r
+\r
+/**********************************************************************//**\r
+ * @brief Initializes the GPIO ports to act as buttons.\r
+ * \r
+ * @param buttonsMask The mask that specifies the button pins.\r
+ * \r
+ * @return none\r
+ *************************************************************************/ \r
+void halButtonsInit(unsigned char buttonsMask)\r
+{ \r
+ BUTTON_PORT_OUT |= buttonsMask;\r
+ BUTTON_PORT_DIR &= ~buttonsMask;\r
+ BUTTON_PORT_REN |= buttonsMask; \r
+ BUTTON_PORT_SEL &= ~buttonsMask; \r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Returns LOW for the buttons pressed.\r
+ * \r
+ * @param none\r
+ * \r
+ * @return The buttons that have been pressed, identified by a bit = 0. \r
+ *************************************************************************/\r
+unsigned char halButtonsPressed(void)\r
+{\r
+ unsigned char value;\r
+ value = BUTTON_PORT_IN;\r
+ return (0xFF - value); //Low==ButtonPressed\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Enables button interrupt(s) with low to high transitions.\r
+ * \r
+ * @param buttonIntEnableMask The button pin(s) for which the interrupt(s) \r
+ * should be enabled.\r
+ * \r
+ * @return none\r
+ *************************************************************************/\r
+void halButtonsInterruptEnable(unsigned char buttonIntEnableMask)\r
+{\r
+ BUTTON_PORT_IES &= ~buttonIntEnableMask;\r
+ BUTTON_PORT_IFG &= ~buttonIntEnableMask;\r
+ BUTTON_PORT_IE |= buttonIntEnableMask;\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Disables button interrupts \r
+ * \r
+ * @param buttonIntEnableMask The button pin(s) for which the interrupt(s)\r
+ * should be disabled. \r
+ * \r
+ * @return none\r
+ *************************************************************************/\r
+void halButtonsInterruptDisable(unsigned char buttonIntEnableMask)\r
+{\r
+ BUTTON_PORT_IE &= ~buttonIntEnableMask;\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Clears the button GPIO settings, disables the buttons. \r
+ * \r
+ * @param none\r
+ *************************************************************************/\r
+void halButtonsShutDown()\r
+{\r
+ //All output, outputting 0s\r
+ BUTTON_PORT_OUT &= ~(BUTTON_ALL);\r
+ BUTTON_PORT_DIR |= BUTTON_ALL; \r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ Filename: hal_buttons.h\r
+\r
+ Copyright 2010 Texas Instruments, Inc.\r
+***************************************************************************/\r
+#ifndef HAL_BUTTONS_H\r
+#define HAL_BUTTONS_H\r
+\r
+#define BUTTON_PORT_DIR P2DIR\r
+#define BUTTON_PORT_SEL P2SEL\r
+#define BUTTON_PORT_OUT P2OUT\r
+#define BUTTON_PORT_REN P2REN\r
+#define BUTTON_PORT_IE P2IE\r
+#define BUTTON_PORT_IES P2IES\r
+#define BUTTON_PORT_IFG P2IFG\r
+#define BUTTON_PORT_IN P2IN\r
+\r
+#define BUTTON_SELECT BIT3\r
+#define BUTTON_DOWN BIT5\r
+#define BUTTON_UP BIT4\r
+#define BUTTON_RIGHT BIT2\r
+#define BUTTON_LEFT BIT1 \r
+#define BUTTON_S1 BIT6 \r
+#define BUTTON_S2 BIT7 \r
+#define BUTTON_ALL 0xFE\r
+\r
+extern volatile unsigned char buttonsPressed;\r
+\r
+/*-------------------------------------------------------------\r
+ * Function Prototypes \r
+ * ------------------------------------------------------------*/ \r
+extern void halButtonsInit(unsigned char buttonsMask);\r
+extern unsigned char halButtonsPressed(void);\r
+extern void halButtonsInterruptEnable(unsigned char buttonIntEnableMask);\r
+extern void halButtonsInterruptDisable(unsigned char buttonIntEnableMask);\r
+extern void halButtonsShutDown();\r
+\r
+#endif /* HAL_BUTTONS_H */\r
--- /dev/null
+/**\r
+ * @file hal_lcd.c\r
+ *\r
+ * Copyright 2010 Texas Instruments, Inc.\r
+***************************************************************************/\r
+\r
+#include "msp430.h"\r
+#include "hal_MSP-EXP430F5438.h"\r
+#include "hal_lcd_fonts.h"\r
+\r
+unsigned char LcdInitMacro[]={\r
+ 0x74,0x00,0x00,0x76,0x00,0x01, // R00 start oscillation\r
+ 0x74,0x00,0x01,0x76,0x00,0x0D, // R01 driver output control\r
+ 0x74,0x00,0x02,0x76,0x00,0x4C, // R02 LCD - driving waveform control\r
+ 0x74,0x00,0x03,0x76,0x12,0x14, // R03 Power control\r
+ 0x74,0x00,0x04,0x76,0x04,0x66, // R04 Contrast control\r
+ 0x74,0x00,0x05,0x76,0x00,0x10, // R05 Entry mode\r
+ 0x74,0x00,0x06,0x76,0x00,0x00, // R06 RAM data write mask\r
+ 0x74,0x00,0x07,0x76,0x00,0x15, // R07 Display control\r
+ 0x74,0x00,0x08,0x76,0x00,0x03, // R08 Cursor Control\r
+ 0x74,0x00,0x09,0x76,0x00,0x00, // R09 RAM data write mask\r
+ 0x74,0x00,0x0A,0x76,0x00,0x15, // R0A\r
+ 0x74,0x00,0x0B,0x76,0x00,0x03, // R0B Horizontal Cursor Position\r
+ 0x74,0x00,0x0C,0x76,0x00,0x03, // R0C Vertical Cursor Position\r
+ 0x74,0x00,0x0D,0x76,0x00,0x00, // R0D\r
+ 0x74,0x00,0x0E,0x76,0x00,0x15, // R0E\r
+ 0x74,0x00,0x0F,0x76,0x00,0x03, // R0F\r
+ 0x74,0x00,0x10,0x76,0x00,0x15, // R0E\r
+ 0x74,0x00,0x11,0x76,0x00,0x03, // R0F\r
+};\r
+\r
+unsigned char Read_Block_Address_Macro[]= {0x74,0x00,0x12,0x77,0x00,0x00};\r
+unsigned char Draw_Block_Value_Macro[]={0x74,0x00,0x12,0x76,0xFF,0xFF};\r
+unsigned char Draw_Block_Address_Macro[]={0x74,0x00,0x11,0x76,0x00,0x00};\r
+\r
+unsigned int LcdAddress = 0, LcdTableAddress = 0;\r
+unsigned char contrast = 0x66;\r
+unsigned char backlight = 8;\r
+int LCD_MEM[110*17]; //This array stores a copy of all data on the LCD\r
+ //screen. If memory is an issue though, this array\r
+ //can be eliminated and the halLcdReadBlock()\r
+ //command can be used instead whenever you are\r
+ //manipulating the currently displayed data.\r
+\r
+/**********************************************************************//**\r
+ * @brief Sends 3+3 bytes of data to the LCD using the format specified\r
+ * by the LCD Guide.\r
+ *\r
+ * @param Data[] Data array for transmission\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdSendCommand(unsigned char Data[])\r
+{\r
+ unsigned char i;\r
+\r
+ LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer\r
+ for ( i = 0; i < 6; i++ )\r
+ {\r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = Data[i]; // Load data\r
+\r
+ if (i == 2) //Pull CS up after 3 bytes\r
+ {\r
+ while (UCB2STAT & UCBUSY); \r
+ LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer\r
+ LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer \r
+ }\r
+ }\r
+ while (UCB2STAT & UCBUSY); \r
+ LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Initializes the USCI module, LCD device for communication.\r
+ *\r
+ * - Sets up the SPI2C Communication Module\r
+ * - Performs Hitachi LCD Initialization Procedure\r
+ *\r
+ * @param none\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdInit(void)\r
+{\r
+ volatile unsigned int i=0;\r
+\r
+ LCD_CS_RST_OUT |= LCD_CS_PIN | LCD_RESET_PIN ;\r
+ LCD_CS_RST_DIR |= LCD_CS_PIN | LCD_RESET_PIN ;\r
+\r
+ LCD_BACKLT_SEL |= LCD_BACKLIGHT_PIN;\r
+\r
+ LCD_CS_RST_OUT &= ~LCD_RESET_PIN; // Reset LCD\r
+ __delay_cycles(0x47FF); //Reset Pulse\r
+ LCD_CS_RST_OUT |= LCD_RESET_PIN;\r
+\r
+ // UCLK,MOSI setup, SOMI cleared\r
+ LCD_SPI_SEL |= LCD_MOSI_PIN + LCD_CLK_PIN;\r
+ LCD_SPI_SEL &= ~LCD_MISO_PIN;\r
+ LCD_SPI_DIR &= ~(LCD_MISO_PIN + LCD_MOSI_PIN); // Pin direction controlled by module,\r
+ // Set both pins to input as default\r
+\r
+ // Initialize the USCI_B2 module for SPI operation\r
+ UCB2CTL1 = UCSWRST; // Hold USCI in SW reset mode while configuring it\r
+ UCB2CTL0 = UCMST+UCSYNC+UCCKPL+UCMSB; // 3-pin, 8-bit SPI master\r
+ UCB2CTL1 |= UCSSEL_2; // SMCLK\r
+ UCB2BR0 = 4; // Note: Do not exceed D/S spec for UCLK!\r
+ UCB2BR1 = 0;\r
+ UCB2CTL1 &= ~UCSWRST; // Release USCI state machine\r
+ UCB2IFG &= ~UCRXIFG;\r
+\r
+ // Wake-up the LCD as per datasheet specifications\r
+ halLcdActive();\r
+\r
+ // LCD Initialization Routine Using Predefined Macros\r
+ halLcdSendCommand(&LcdInitMacro[ 1 * 6 ]);\r
+ halLcdSendCommand(&LcdInitMacro[ 2 * 6 ]);\r
+ halLcdSendCommand(&LcdInitMacro[ 4 * 6 ]);\r
+ halLcdSendCommand(&LcdInitMacro[ 5 * 6 ]);\r
+ halLcdSendCommand(&LcdInitMacro[ 6 * 6 ]);\r
+ halLcdSendCommand(&LcdInitMacro[ 7 * 6 ]);\r
+\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Shuts down the LCD display and hdisables the USCI communication.\r
+ *\r
+ * @param none\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdShutDown(void)\r
+{\r
+ halLcdStandby();\r
+\r
+ LCD_CS_RST_DIR |= LCD_CS_PIN | LCD_RESET_PIN ;\r
+ LCD_CS_RST_OUT &= ~(LCD_CS_PIN | LCD_RESET_PIN );\r
+ LCD_CS_RST_OUT &= ~LCD_RESET_PIN;\r
+\r
+ LCD_SPI_SEL &= ~(LCD_MOSI_PIN + LCD_CLK_PIN + LCD_MISO_PIN);\r
+ LCD_CS_RST_DIR |= LCD_MOSI_PIN + LCD_CLK_PIN + LCD_MISO_PIN;\r
+ LCD_CS_RST_OUT &= ~(LCD_MOSI_PIN + LCD_CLK_PIN + LCD_MISO_PIN);\r
+\r
+ UCB2CTL0 = UCSWRST;\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Initializes the LCD backlight PWM signal.\r
+ *\r
+ * @param none\r
+ *\r
+ * @return none\r
+ *\r
+ *************************************************************************/\r
+void halLcdBackLightInit(void)\r
+{\r
+ LCD_BACKLT_DIR |= LCD_BACKLIGHT_PIN;\r
+ LCD_BACKLT_OUT |= LCD_BACKLIGHT_PIN;\r
+ LCD_BACKLT_SEL |= LCD_BACKLIGHT_PIN;\r
+\r
+ TA0CCTL3 = OUTMOD_7;\r
+ TA0CCR3 = TA0CCR0 >> 1 ;\r
+ backlight = 8;\r
+\r
+ TA0CCR0 = 400;\r
+ TA0CTL = TASSEL_2+MC_1;\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Get function for the backlight PWM's duty cycle.\r
+ *\r
+ * @param none\r
+ *\r
+ * @return backlight One of the the 17 possible settings - valued 0 to 16.\r
+ *\r
+ *************************************************************************/\r
+unsigned int halLcdGetBackLight(void)\r
+{\r
+ return backlight;\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Set function for the backlight PWM's duty cycle\r
+ *\r
+ * @param BackLightLevel The target backlight duty cycle - valued 0 to 16.\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdSetBackLight(unsigned char BackLightLevel)\r
+{\r
+ unsigned int dutyCycle = 0, i, dummy;\r
+\r
+ if (BackLightLevel > 0)\r
+ {\r
+ TA0CCTL3 = OUTMOD_7;\r
+ dummy = (TA0CCR0 >> 4);\r
+\r
+ for (i = 0; i < BackLightLevel; i++)\r
+ dutyCycle += dummy;\r
+\r
+ TA0CCR3 = dutyCycle;\r
+\r
+ // If the backlight was previously turned off, turn it on.\r
+ if (!backlight)\r
+ TA0CTL |= MC0;\r
+ }\r
+ else\r
+ { \r
+ TA0CCTL3 = 0;\r
+ TA0CTL &= ~MC0;\r
+ }\r
+ backlight = BackLightLevel;\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Turns off the backlight.\r
+ *\r
+ * Clears the respective GPIO and timer settings.\r
+ *\r
+ * @param none\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdShutDownBackLight(void)\r
+{\r
+ LCD_BACKLT_DIR |= LCD_BACKLIGHT_PIN;\r
+ LCD_BACKLT_OUT &= ~(LCD_BACKLIGHT_PIN);\r
+ LCD_BACKLT_SEL &= ~LCD_BACKLIGHT_PIN;\r
+\r
+ TA0CCTL3 = 0;\r
+ TA0CTL = 0;\r
+\r
+ backlight = 0;\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Set function for the contrast level of the LCD.\r
+ *\r
+ * @param ContrastLevel The target contrast level\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdSetContrast(unsigned char ContrastLevel)\r
+{\r
+ if (ContrastLevel > 127) ContrastLevel = 127;\r
+ if (ContrastLevel < 70) ContrastLevel = 70;\r
+ LcdInitMacro[ 0x04 * 6 + 5 ] = ContrastLevel;\r
+ halLcdSendCommand(&LcdInitMacro[ 0x04 * 6 ]);\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Get function for the contrast level of the LCD.\r
+ *\r
+ * @param none\r
+ *\r
+ * @return ContrastLevel The LCD constrast level\r
+ *************************************************************************/\r
+unsigned char halLcdGetContrast(void)\r
+{\r
+ return LcdInitMacro[ 0x04 * 6 + 5 ] ;\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Turns the LCD cursor on at the current text position.\r
+ *\r
+ * @param none\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdCursor(void)\r
+{\r
+ LcdInitMacro[ 8 * 6 + 5 ] ^= BIT2;\r
+ halLcdSendCommand(&LcdInitMacro[ 8 * 6 ]);\r
+\r
+ LcdInitMacro[ 0x0B * 6 + 5 ] = ((LcdAddress & 0x1F) << 3) ;\r
+ LcdInitMacro[ 0x0B * 6 + 4 ] = ( (LcdAddress & 0x1F) << 3 ) + 3;\r
+ LcdInitMacro[ 0x0C * 6 + 5 ] = (LcdAddress >> 5);\r
+ LcdInitMacro[ 0x0C * 6 + 4 ] = (LcdAddress >> 5) + 7;\r
+ halLcdSendCommand(&LcdInitMacro[ 0x0B * 6 ]);\r
+ halLcdSendCommand(&LcdInitMacro[ 0x0C * 6 ]);\r
+\r
+ halLcdSetAddress(LcdAddress);\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Turns off the LCD cursor.\r
+ *\r
+ * @param none\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdCursorOff(void)\r
+{\r
+ LcdInitMacro[ 8 * 6 + 5 ] &= ~BIT2;\r
+ halLcdSendCommand(&LcdInitMacro[ 8 * 6 ]);\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Inverts the grayscale values of the LCD display (Black <> white).\r
+ *\r
+ * @param none\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdReverse(void)\r
+{\r
+ LcdInitMacro[ 7 * 6 + 5 ] ^= BIT1;\r
+ halLcdSendCommand(&LcdInitMacro[ 7 * 6 ]);\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Sets the LCD in standby mode to reduce power consumption.\r
+ *\r
+ * @param none\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdStandby(void)\r
+{\r
+ LcdInitMacro[ 3 * 6 + 5 ] &= (~BIT3) & (~BIT2);\r
+ LcdInitMacro[ 3 * 6 + 5 ] |= BIT0;\r
+ halLcdSendCommand(&LcdInitMacro[ 3 * 6 ]);\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Puts the LCD into active mode.\r
+ *\r
+ * @param none\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdActive(void)\r
+{\r
+ halLcdSendCommand(LcdInitMacro); // R00 start oscillation\r
+\r
+ // Wait a minimum of 25ms after issuing "start oscillation"\r
+ // command (to accomodate for MCLK up to 25MHz)\r
+ __delay_cycles(250000);\r
+\r
+ LcdInitMacro[ 3 * 6 + 5 ] |= BIT3;\r
+ LcdInitMacro[ 3 * 6 + 5 ] &= ~BIT0;\r
+ halLcdSendCommand(&LcdInitMacro[ 3 * 6 ]); // R03 Power control\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Sets the pointer location in the LCD.\r
+ *\r
+ * - LcdAddress = Address \r
+ * - LcdTableAddress = Correct Address Row + Column\r
+ * = (Address / 0x20)* 17 + Column\r
+ *\r
+ * @param Address The target pointer location in the LCD.\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdSetAddress(int Address)\r
+{\r
+ int temp;\r
+\r
+ Draw_Block_Address_Macro[4] = Address >> 8;\r
+ Draw_Block_Address_Macro[5] = Address & 0xFF;\r
+ halLcdSendCommand(Draw_Block_Address_Macro);\r
+ LcdAddress = Address;\r
+ temp = Address >> 5; // Divided by 0x20\r
+ temp = temp + (temp << 4);\r
+ //Multiplied by (1+16) and added by the offset\r
+ LcdTableAddress = temp + (Address & 0x1F);\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Draws a block at the specified LCD address.\r
+ *\r
+ * A block is the smallest addressable memory on the LCD and is\r
+ * equivalent to 8 pixels, each of which is represented by 2 bits\r
+ * that represent a grayscale value between 00b and 11b.\r
+ *\r
+ * @param Address The address at which to draw the block.\r
+ *\r
+ * @param Value The value of the block\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdDrawBlock(unsigned int Address, unsigned int Value)\r
+{\r
+ halLcdSetAddress(Address);\r
+ halLcdDrawCurrentBlock(Value);\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Writes Value to LCD CGram and MSP430 internal LCD table.\r
+ *\r
+ * Also updates the LcdAddress and LcdTableAddress to the correct values.\r
+ *\r
+ * @param Value The value of the block to be written to the LCD.\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdDrawCurrentBlock(unsigned int Value)\r
+{\r
+ int temp;\r
+\r
+ Draw_Block_Value_Macro[4] = Value >> 8;\r
+ Draw_Block_Value_Macro[5] = Value & 0xFF;\r
+ LCD_MEM[ LcdTableAddress ] = Value;\r
+\r
+ halLcdSendCommand(Draw_Block_Value_Macro);\r
+\r
+ LcdAddress++;\r
+ temp = LcdAddress >> 5; // Divided by 0x20\r
+ temp = temp + (temp << 4);\r
+ // Multiplied by (1+16) and added by the offset\r
+ LcdTableAddress = temp + (LcdAddress & 0x1F);\r
+\r
+ // If LcdAddress gets off the right edge, move to next line\r
+ if ((LcdAddress & 0x1F) > 0x11)\r
+ halLcdSetAddress( (LcdAddress & 0xFFE0) + 0x20 );\r
+ if (LcdAddress == LCD_Size)\r
+ halLcdSetAddress( 0 );\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Returns the LCD CGRAM value at location Address.\r
+ *\r
+ * @param Address The address of the block to be read from the LCD.\r
+ *\r
+ * @return Value The value held at the specified address.\r
+ *************************************************************************/\r
+int halLcdReadBlock(unsigned int Address)\r
+{\r
+ int i = 0, Value = 0, ReadData[7];\r
+\r
+ halLcdSetAddress( Address );\r
+ halLcdSendCommand(Read_Block_Address_Macro);\r
+\r
+ LCD_CS_RST_OUT &= ~LCD_CS_PIN; // start transfer CS=0\r
+ UCB2TXBUF = 0x77; // Transmit first character 0x77\r
+\r
+ while (!(UCB2IFG & UCTXIFG));\r
+ while (UCB2STAT & UCBUSY);\r
+\r
+ //Read 5 dummies values and 2 valid address data\r
+ LCD_SPI_SEL &= ~LCD_MOSI_PIN; //Change SPI2C Dir\r
+ LCD_SPI_SEL |= LCD_MISO_PIN;\r
+\r
+ for (i = 0; i < 7; i ++ )\r
+ {\r
+ UCB2IFG &= ~UCRXIFG;\r
+ UCB2TXBUF = 1; // load dummy byte 1 for clk\r
+ while (!(UCB2IFG & UCRXIFG));\r
+ ReadData[i] = UCB2RXBUF;\r
+ }\r
+ LCD_CS_RST_OUT |= LCD_CS_PIN; // Stop Transfer CS = 1\r
+\r
+ LCD_SPI_SEL |= LCD_MOSI_PIN; //Change SPI2C Dir\r
+ LCD_SPI_SEL &= ~LCD_MISO_PIN;\r
+ LCD_CS_RST_DIR |= LCD_MOSI_PIN + LCD_CLK_PIN;\r
+ LCD_CS_RST_DIR &= ~LCD_MISO_PIN;\r
+\r
+ Value = (ReadData[5] << 8) + ReadData[6];\r
+ return Value;\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Draw a Pixel of grayscale at coordinate (x,y) to LCD\r
+ *\r
+ * @param x x-coordinate for grayscale value\r
+ *\r
+ * @param y y-coordinate for grayscale value\r
+ *\r
+ * @param GrayScale The intended grayscale value of the pixel - one of\r
+ * four possible settings.\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdPixel( int x, int y, unsigned char GrayScale)\r
+{\r
+ int Address, Value;\r
+ unsigned char offset;\r
+\r
+ //Each line increments by 0x20\r
+ if ( (x>=0 ) && (x<LCD_COL) && (y>=0) && (y<LCD_ROW))\r
+ {\r
+ Address = (y << 5) + (x >> 3) ; //Narrow down to 8 possible pixels\r
+\r
+ Value = LCD_MEM[(y << 4)+ y + (x>>3)]; //y * 17 --> row. x>>3 --> column\r
+\r
+ offset = (x & 0x07) << 1; //3 LSBs = pos. within the 8 columns\r
+ Value &= ~ (3 << offset); //clear out the corresponding bits\r
+ Value |= GrayScale << offset; //set pixel to GrayScale level\r
+\r
+ halLcdDrawBlock( Address, Value );\r
+ }\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Clears entire LCD CGRAM as well as LCD_MEM.\r
+ *\r
+ * @param none\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdClearScreen(void)\r
+{\r
+ int i, j, k, Current_Location = 0;\r
+ halLcdSetAddress(0);\r
+\r
+ for (i=0; i < 110; i++)\r
+ {\r
+ //prepare to send image\r
+ LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer\r
+ for ( k = 0; k < 3; k++ )\r
+ {\r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = Draw_Block_Value_Macro[k]; // Load data\r
+ }\r
+ while (UCB2STAT & UCBUSY); \r
+ LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer\r
+ LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer \r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = Draw_Block_Value_Macro[3]; // Load data\r
+\r
+ //send blank line\r
+ for (j=0; j < 17; j++)\r
+ {\r
+ LCD_MEM[ LcdTableAddress++ ] = 0x00;\r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = 0x00; // Load data\r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = 0x00; // Load data\r
+ }\r
+ //Clear the partially visible block at the edge of the screen\r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = 0x00; // Load data\r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = 0x00; // Load data\r
+ while (UCB2STAT & UCBUSY); \r
+ LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer\r
+\r
+ Current_Location += 0x20;\r
+ halLcdSetAddress(Current_Location );\r
+ }\r
+\r
+ halLcdSetAddress(0);\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Loads an image of size = rows * columns, starting at the\r
+ * coordinate (x,y).\r
+ *\r
+ * @param Image[] The image to be loaded\r
+ *\r
+ * @param Rows The number of rows in the image. Size = Rows * Columns.\r
+ *\r
+ * @param Columns The number of columns in the image. Size = Rows * Columns.\r
+ *\r
+ * @param x x-coordinate of the image's starting location\r
+ *\r
+ * @param y y-coordinate of the image's starting location\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdImage(const unsigned int Image[], int Columns, int Rows, int x, int y)\r
+{\r
+ int i, CurrentLocation;\r
+\r
+ CurrentLocation = (y << 5) + (x >> 3);\r
+ halLcdSetAddress(CurrentLocation);\r
+ for (i=0; i < Rows; i++)\r
+ {\r
+ halLcdDrawCurrentLine(Image, Columns);\r
+ Image += Columns;\r
+ CurrentLocation += 0x20;\r
+ halLcdSetAddress(CurrentLocation);\r
+ }\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Writes Value to LCD CGram and MSP430 internal LCD table.\r
+ *\r
+ * Also updates the LcdAddress and LcdTableAddress to the correct values.\r
+ *\r
+ * @param *value Pointer to the line to be written to the LCD.\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdDrawCurrentLine(const unsigned int *value, int Columns)\r
+{\r
+ unsigned char i;\r
+\r
+ //prepare to send image\r
+ LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer\r
+ for ( i = 0; i < 3; i++ )\r
+ {\r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = Draw_Block_Value_Macro[i]; // Load data\r
+ }\r
+ while (UCB2STAT & UCBUSY); \r
+ LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer\r
+ LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer \r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = Draw_Block_Value_Macro[3]; // Load data\r
+\r
+ //send the image\r
+ for ( i = 0; i < Columns; i++ )\r
+ { \r
+ // Make sure we are not writing outside LCD_MEM[]\r
+ if (LcdTableAddress >= sizeof(LCD_MEM)) {\r
+ break;\r
+ }\r
+ LCD_MEM[ LcdTableAddress++ ] = *value;\r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = (*value) >> 8; // Load data\r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = (*value++) & 0xFF; // Load data\r
+ }\r
+\r
+ while (UCB2STAT & UCBUSY); \r
+ LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Clears an image of size rows x columns starting at (x, y).\r
+ *\r
+ * @param Columns The size, in columns, of the image to be cleared.\r
+ *\r
+ * @param Rows The size, in rows, of the image to be cleared.\r
+ *\r
+ * @param x x-coordinate of the image to be cleared\r
+ *\r
+ * @param y y-coordinate of the image to be cleared\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdClearImage(int Columns, int Rows, int x, int y)\r
+{\r
+ int i,j,k, Current_Location;\r
+ Current_Location = (y << 5) + (x >> 3);\r
+ halLcdSetAddress( Current_Location );\r
+\r
+ for (i=0; i < Rows; i++)\r
+ {\r
+ //prepare to send image\r
+ LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer\r
+ for ( k = 0; k < 3; k++ )\r
+ {\r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = Draw_Block_Value_Macro[k]; // Load data\r
+ }\r
+ while (UCB2STAT & UCBUSY); \r
+ LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer\r
+ LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer \r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = Draw_Block_Value_Macro[3]; // Load data\r
+\r
+ //send blank line\r
+ for (j=0; j < Columns; j++)\r
+ {\r
+ LCD_MEM[ LcdTableAddress++ ] = 0x00;\r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = 0x00; // Load data\r
+ while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG\r
+ UCB2TXBUF = 0x00; // Load data\r
+ }\r
+ while (UCB2STAT & UCBUSY); \r
+ LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer\r
+\r
+ Current_Location += 0x20;\r
+ halLcdSetAddress(Current_Location );\r
+ }\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Writes Value to LCD CGRAM. Pointers internal to the LCD\r
+ * are also updated.\r
+ *\r
+ * @param Value The value to be written to the current LCD pointer\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdDrawTextBlock(unsigned int Value)\r
+{\r
+ int temp;\r
+\r
+ Draw_Block_Value_Macro[4] = Value >> 8;\r
+ Draw_Block_Value_Macro[5] = Value & 0xFF;\r
+ LCD_MEM[ LcdTableAddress ] = Value;\r
+\r
+ halLcdSendCommand(Draw_Block_Value_Macro);\r
+\r
+ LcdAddress++;\r
+ temp = LcdAddress >> 5; // Divided by 0x20\r
+ temp = temp + (temp << 4);\r
+ //Multiplied by (1+16) and added by the offset\r
+ LcdTableAddress = temp + (LcdAddress & 0x1F);\r
+\r
+ // If LcdAddress gets off the right edge, move to next line\r
+ if ((LcdAddress & 0x1F) > 0x10)\r
+ halLcdSetAddress( (LcdAddress & 0xFFE0) + 0x20 );\r
+\r
+ if (LcdAddress >= LCD_Size)\r
+ halLcdSetAddress( 0 );\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Displays the string to the LCD starting at current location.\r
+ *\r
+ * Writes all the data to LCD_MEM first, then updates all corresponding\r
+ * LCD CGRAM locations at once, in a continuous fashion.\r
+ *\r
+ * @param String[] The string to be displayed on LCD.\r
+ *\r
+ * @param TextStyle Value that specifies whether the string is to be\r
+ * inverted or overwritten.\r
+ * - Invert = 0x01\r
+ * - Overwrite = 0x04\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdPrint( char String[], unsigned char TextStyle)\r
+{\r
+ int i, j, Counter=0, BlockValue;\r
+ int Address, LCD_MEM_Add, ActualAddress;\r
+ int temp;\r
+ char LookUpChar;\r
+\r
+ ActualAddress = LcdAddress;\r
+ Counter = LcdAddress & 0x1F;\r
+ i=0;\r
+\r
+ while (String[i]!=0) // Stop on null character\r
+ {\r
+ LookUpChar = fonts_lookup[String[i]];\r
+\r
+ for (j=0;j < FONT_HEIGHT ;j++)\r
+ {\r
+ Address = ActualAddress + j*0x20;\r
+ temp = Address >> 5;\r
+ temp += (temp <<4);\r
+\r
+ LCD_MEM_Add = temp + (Address & 0x1F);\r
+\r
+ BlockValue = LCD_MEM[ LCD_MEM_Add ];\r
+\r
+ if(TextStyle & GRAYSCALE_TEXT)\r
+ {\r
+ if (TextStyle & INVERT_TEXT)\r
+ if (TextStyle & OVERWRITE_TEXT)\r
+ BlockValue = 0xAAAA - GrayScale_fonts[LookUpChar*(FONT_HEIGHT+1) +j];\r
+ else\r
+ BlockValue |= 0xAAAA - GrayScale_fonts[LookUpChar*(FONT_HEIGHT+1) +j];\r
+ else\r
+ if (TextStyle & OVERWRITE_TEXT)\r
+ BlockValue = GrayScale_fonts[LookUpChar*(FONT_HEIGHT+1) +j];\r
+ else\r
+ BlockValue |= GrayScale_fonts[LookUpChar*(FONT_HEIGHT+1) +j];\r
+ }\r
+ else\r
+ {\r
+ if (TextStyle & INVERT_TEXT)\r
+ if (TextStyle & OVERWRITE_TEXT)\r
+ BlockValue = 0xFFFF - fonts[LookUpChar*13+j];\r
+ else\r
+ BlockValue |= 0xFFFF - fonts[LookUpChar*13+j];\r
+\r
+ else\r
+ if (TextStyle & OVERWRITE_TEXT)\r
+ BlockValue = fonts[LookUpChar*(FONT_HEIGHT+1) +j];\r
+ else\r
+ BlockValue |= fonts[LookUpChar*(FONT_HEIGHT+1) +j];\r
+ }\r
+ halLcdDrawBlock( Address, BlockValue);\r
+ }\r
+\r
+ Counter++;\r
+ if (Counter == 17)\r
+ {\r
+ Counter = 0;\r
+ ActualAddress += 0x20*FONT_HEIGHT - 16;\r
+ if (ActualAddress > LCD_Last_Pixel-0x20*FONT_HEIGHT )\r
+ ActualAddress = 0;\r
+ }\r
+ else\r
+ ActualAddress++;\r
+ i++;\r
+ }\r
+ halLcdSetAddress(ActualAddress);\r
+\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Displays the string to the LCD starting at (x,y) location.\r
+ *\r
+ * Writes all the data to LCD_MEM first, then updates all corresponding\r
+ * LCD CGRAM locations at once, in a continuous fashion.\r
+ *\r
+ * @param String[] String to be displayed on LCD\r
+ *\r
+ * @param x x-coordinate of the write location on the LCD\r
+ *\r
+ * @param y y-coordinate of the write location on the LCD\r
+ *\r
+ * @param TextStyle Value that specifies whether the string is to be\r
+ * inverted or overwritten.\r
+ * - Invert = 0x01\r
+ * - Overwrite = 0x04\r
+ *************************************************************************/\r
+void halLcdPrintXY( char String[], int x, int y, unsigned char TextStyle)\r
+{\r
+ //Each line increments by 0x20\r
+ halLcdSetAddress( (y << 5) + (x >> 3)) ; //Narrow down to 8 possible pixels\r
+ halLcdPrint(String, TextStyle);\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Displays a string on the LCD on the specified line.\r
+ *\r
+ * @param String[] The string to be displayed on LCD.\r
+ *\r
+ * @param Line The line on the LCD on which to print the string.\r
+ *\r
+ * @param TextStyle Value that specifies whether the string is to be\r
+ * inverted or overwritten.\r
+ * - Invert = 0x01\r
+ * - Overwrite = 0x04\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdPrintLine(char String[], unsigned char Line, unsigned char TextStyle)\r
+{\r
+ int temp;\r
+ temp = Line * FONT_HEIGHT ;\r
+ halLcdSetAddress( temp << 5 ) ; // 0x20 = 2^5\r
+ halLcdPrint(String, TextStyle);\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Prints a string beginning on a given line and column.\r
+ *\r
+ * @param String[] The string to be displayed on LCD.\r
+ *\r
+ * @param Line The line on which to print the string of text\r
+ *\r
+ * @param Col The column on which to print the string of text\r
+ *\r
+ * @param TextStyle Value that specifies whether the string is to be\r
+ * inverted or overwritten.\r
+ * - Invert = 0x01\r
+ * - Overwrite = 0x04\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdPrintLineCol(char String[], unsigned char Line, unsigned char Col,\r
+ unsigned char TextStyle)\r
+{\r
+ int temp;\r
+\r
+ temp = Line * FONT_HEIGHT;\r
+ temp <<= 5;\r
+ temp += Col;\r
+\r
+ halLcdSetAddress( temp ) ; // 0x20 = 2^5\r
+ halLcdPrint(String, TextStyle);\r
+}\r
+\r
+\r
+/**********************************************************************//**\r
+ * @brief Draws a horizontral line from (x1,y) to (x2,y) of GrayScale level\r
+ *\r
+ * @param x1 x-coordinate of the first point\r
+ *\r
+ * @param x2 x-coordinate of the second point\r
+ *\r
+ * @param y y-coordinate of both points\r
+ *\r
+ * @param GrayScale Grayscale level of the horizontal line\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdHLine( int x1, int x2, int y, unsigned char GrayScale)\r
+{\r
+ int x_dir, x;\r
+ if ( x1 < x2 )\r
+ x_dir = 1;\r
+ else\r
+ x_dir = -1;\r
+ x = x1;\r
+ while (x != x2)\r
+ {\r
+ halLcdPixel( x,y, GrayScale);\r
+ x += x_dir;\r
+ }\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Draws a vertical line from (x,y1) to (x,y2) of GrayScale level\r
+ *\r
+ * @param x x-coordinate of both points\r
+ *\r
+ * @param y1 y-coordinate of the first point\r
+ *\r
+ * @param y2 y-coordinate of the second point\r
+ *\r
+ * @param GrayScale GrayScale level of the vertical line\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdVLine( int x, int y1, int y2, unsigned char GrayScale)\r
+{\r
+ int y_dir, y;\r
+ if ( y1 < y2 )\r
+ y_dir = 1;\r
+ else\r
+ y_dir = -1;\r
+ y = y1;\r
+ while (y != y2)\r
+ {\r
+ halLcdPixel( x,y, GrayScale);\r
+ y += y_dir;\r
+ }\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Draws a line from (x1,y1) to (x2,y2) of GrayScale level.\r
+ *\r
+ * Uses Bresenham's line algorithm.\r
+ *\r
+ * @param x1 x-coordinate of the first point\r
+ *\r
+ * @param y1 y-coordinate of the first point\r
+ *\r
+ * @param x2 x-coordinate of the second point\r
+ *\r
+ * @param y2 y-coordinate of the second point\r
+ *\r
+ * @param GrayScale Grayscale level of the line\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdLine( int x1, int y1, int x2, int y2, unsigned char GrayScale)\r
+{\r
+ int x, y, deltay, deltax, d;\r
+ int x_dir, y_dir;\r
+\r
+ if ( x1 == x2 )\r
+ halLcdVLine( x1, y1, y2, GrayScale );\r
+ else\r
+ {\r
+ if ( y1 == y2 )\r
+ halLcdHLine( x1, x2, y1, GrayScale );\r
+ else // a diagonal line\r
+ {\r
+ if (x1 > x2)\r
+ x_dir = -1;\r
+ else x_dir = 1;\r
+ if (y1 > y2)\r
+ y_dir = -1;\r
+ else y_dir = 1;\r
+\r
+ x = x1;\r
+ y = y1;\r
+ deltay = ABS(y2 - y1);\r
+ deltax = ABS(x2 - x1);\r
+\r
+ if (deltax >= deltay)\r
+ {\r
+ d = (deltay << 1) - deltax;\r
+ while (x != x2)\r
+ {\r
+ halLcdPixel(x, y, GrayScale);\r
+ if ( d < 0 )\r
+ d += (deltay << 1);\r
+ else\r
+ {\r
+ d += ((deltay - deltax) << 1);\r
+ y += y_dir;\r
+ }\r
+ x += x_dir;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ d = (deltax << 1) - deltay;\r
+ while (y != y2)\r
+ {\r
+ halLcdPixel(x, y, GrayScale);\r
+ if ( d < 0 )\r
+ d += (deltax << 1);\r
+ else\r
+ {\r
+ d += ((deltax - deltay) << 1);\r
+ x += x_dir;\r
+ }\r
+ y += y_dir;\r
+ }\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+\r
+/**********************************************************************//**\r
+ * @brief Draw a circle of Radius with center at (x,y) of GrayScale level.\r
+ *\r
+ * Uses Bresenham's circle algorithm\r
+ *\r
+ * @param x x-coordinate of the circle's center point\r
+ *\r
+ * @param y y-coordinate of the circle's center point\r
+ *\r
+ * @param Radius Radius of the circle\r
+ *\r
+ * @param GrayScale Grayscale level of the circle\r
+ *************************************************************************/\r
+void halLcdCircle(int x, int y, int Radius, int GrayScale)\r
+{\r
+ int xx, yy, ddF_x, ddF_y, f;\r
+\r
+ ddF_x = 0;\r
+ ddF_y = -(2 * Radius);\r
+ f = 1 - Radius;\r
+\r
+ xx = 0;\r
+ yy = Radius;\r
+ halLcdPixel(x + xx, y + yy, GrayScale);\r
+ halLcdPixel(x + xx, y - yy, GrayScale);\r
+ halLcdPixel(x - xx, y + yy, GrayScale);\r
+ halLcdPixel(x - xx, y - yy, GrayScale);\r
+ halLcdPixel(x + yy, y + xx, GrayScale);\r
+ halLcdPixel(x + yy, y - xx, GrayScale);\r
+ halLcdPixel(x - yy, y + xx, GrayScale);\r
+ halLcdPixel(x - yy, y - xx, GrayScale);\r
+ while (xx < yy)\r
+ {\r
+ if (f >= 0)\r
+ {\r
+ yy--;\r
+ ddF_y += 2;\r
+ f += ddF_y;\r
+ }\r
+ xx++;\r
+ ddF_x += 2;\r
+ f += ddF_x + 1;\r
+ halLcdPixel(x + xx, y + yy, GrayScale);\r
+ halLcdPixel(x + xx, y - yy, GrayScale);\r
+ halLcdPixel(x - xx, y + yy, GrayScale);\r
+ halLcdPixel(x - xx, y - yy, GrayScale);\r
+ halLcdPixel(x + yy, y + xx, GrayScale);\r
+ halLcdPixel(x + yy, y - xx, GrayScale);\r
+ halLcdPixel(x - yy, y + xx, GrayScale);\r
+ halLcdPixel(x - yy, y - xx, GrayScale);\r
+ }\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Scrolls a single row of pixels one column to the left.\r
+ *\r
+ * The column that is scrolled out of the left side of the LCD will be\r
+ * displayed the right side of the LCD.\r
+ *\r
+ * @param y The row of pixels to scroll. y = 0 is at the top-left\r
+ * corner of the LCD.\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdScrollRow(int y)\r
+{\r
+ int i, Address, LcdTableAddressTemp;\r
+ unsigned int temp;\r
+\r
+ Address = y << 5;\r
+\r
+ halLcdSetAddress( Address );\r
+\r
+ //Multiplied by (1+16) and added by the offset\r
+ LcdTableAddressTemp = y + (y << 4);\r
+ temp = ((LCD_MEM[LcdTableAddressTemp] & 0x0003) <<14);\r
+\r
+ for (i = 0; i < 0x10; i++)\r
+ halLcdDrawCurrentBlock( ( (LCD_MEM[LcdTableAddressTemp+i] & 0xFFFC ) >> 2 ) \\r
+ + ((LCD_MEM[LcdTableAddressTemp+i+1] & 0x0003) << 14 ));\r
+\r
+ halLcdDrawCurrentBlock( (( LCD_MEM[LcdTableAddressTemp + 0x10] & 0xFFFC ) >> 2) + temp);\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Scrolls multiple rows of pixels, yStart to yEnd,\r
+ * one column to the left.\r
+ *\r
+ * The column that is scrolled out of the left side of the LCD will be\r
+ * displayed the right side of the LCD. y = 0 is at the top-left of the\r
+ * LCD screen.\r
+ *\r
+ * @param yStart The beginning row to be scrolled\r
+ *\r
+ * @param yEnd The last row to be scrolled\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdHScroll(int yStart, int yEnd)\r
+{\r
+ int i ;\r
+\r
+ for (i = yStart; i < yEnd+1; i++)\r
+ halLcdScrollRow(i);\r
+}\r
+\r
+/**********************************************************************//**\r
+ * @brief Scrolls a line of text one column to the left.\r
+ *\r
+ * @param Line The line of text to be scrolled.\r
+ *\r
+ * @return none\r
+ *************************************************************************/\r
+void halLcdScrollLine(int Line)\r
+{\r
+ int i, Row ;\r
+\r
+ Row = Line * FONT_HEIGHT;\r
+\r
+ for (i = Row; i < Row + FONT_HEIGHT ; i++)\r
+ halLcdScrollRow(i);\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ Filename: hal_lcd.h\r
+\r
+ Copyright 2010 Texas Instruments, Inc.\r
+***************************************************************************/\r
+#ifndef HAL_LCD_H\r
+#define HAL_LCD_H\r
+\r
+#ifndef MIN\r
+#define MIN(n,m) (((n) < (m)) ? (n) : (m))\r
+#endif\r
+\r
+#ifndef MAX\r
+#define MAX(n,m) (((n) < (m)) ? (m) : (n))\r
+#endif\r
+\r
+#ifndef ABS\r
+#define ABS(n) (((n) < 0) ? -(n) : (n))\r
+#endif\r
+\r
+#define LCD_BACKLT_OUT P8OUT\r
+#define LCD_BACKLT_DIR P8DIR\r
+#define LCD_BACKLT_SEL P8SEL\r
+#define LCD_BACKLIGHT_PIN BIT3\r
+#define LCD_CS_RST_DIR P9DIR\r
+#define LCD_CS_RST_OUT P9OUT \r
+#define LCD_CS_PIN BIT6 \r
+#define LCD_RESET_PIN BIT7\r
+#define LCD_SPI_SEL P9SEL\r
+#define LCD_SPI_DIR P9DIR\r
+#define LCD_MOSI_PIN BIT1\r
+#define LCD_MISO_PIN BIT2\r
+#define LCD_CLK_PIN BIT3\r
+\r
+#define LCD_ROW 110\r
+#define LCD_COL 138\r
+#define LCD_Size 3505\r
+#define LCD_MEM_Size 110*17\r
+#define LCD_Max_Column_Offset 0x10 \r
+ \r
+#define LCD_Last_Pixel 3505\r
+\r
+#define LCD_MEM_Row 0x11\r
+#define LCD_Row 0x20\r
+\r
+// Grayscale level definitions\r
+#define PIXEL_OFF 0\r
+#define PIXEL_LIGHT 1\r
+#define PIXEL_DARK 2\r
+#define PIXEL_ON 3\r
+\r
+#define INVERT_TEXT BIT0\r
+#define OVERWRITE_TEXT BIT2\r
+#define GRAYSCALE_TEXT BIT1\r
+\r
+/*-------------------------------------------------------------\r
+ * Function Prototypes \r
+ * ------------------------------------------------------------*/ \r
+extern void halLcdInit(void); \r
+extern void halLcdShutDown(void);\r
+extern void halLcdBackLightInit(void);\r
+extern void halLcdSetBackLight(unsigned char BackLightLevel);\r
+extern unsigned int halLcdGetBackLight(void);\r
+extern void halLcdShutDownBackLight(void);\r
+extern void halLcdSendCommand(unsigned char Data[]) ;\r
+extern void halLcdSetContrast(unsigned char ContrastLevel);\r
+extern unsigned char halLcdGetContrast(void);\r
+extern void halLcdStandby(void);\r
+extern void halLcdActive(void);\r
+\r
+//Move to specified LCD address\r
+extern void halLcdSetAddress(int Address); \r
+\r
+//Draw at current segment location\r
+extern void halLcdDrawCurrentBlock(unsigned int Value); \r
+extern void halLcdDrawCurrentLine(const unsigned int *value, int length); \r
+\r
+//Draw at specified location by calling\r
+//LCD_Set_Address(Address) & LCD_Draw_Current_Block( value )\r
+extern void halLcdDrawBlock(unsigned int Address, unsigned int Value); \r
+\r
+//Read value from LCD CGRAM\r
+extern int halLcdReadBlock(unsigned int Address);\r
+\r
+//Clear LCD Screen \r
+extern void halLcdClearScreen(void); \r
+\r
+//Invert black to white and vice versa\r
+extern void halLcdReverse(void);\r
+\r
+// Draw a Pixel @ (x,y) with GrayScale level\r
+extern void halLcdPixel( int x, int y, unsigned char GrayScale);\r
+//Draw Line from (x1,y1) to (x2,y2) with GrayScale level\r
+extern void halLcdLine( int x1, int y1, int x2, int y2, unsigned char GrayScale); \r
+extern void halLcdHLine( int x1, int x2, int y, unsigned char GrayScale);\r
+extern void halLcdVLine( int x1, int x2, int y, unsigned char GrayScale);\r
+\r
+extern void halLcdCircle(int x, int y, int Radius, int GrayScale);\r
+\r
+extern void halLcdImage(const unsigned int Image[], int Columns, int Rows, int x, int y);\r
+extern void halLcdClearImage(int Columns, int Rows, int x, int y);\r
+\r
+//Print String of Length starting at current LCD location\r
+extern void halLcdPrint(char String[], unsigned char TextStyle) ;\r
+\r
+//Print String of Length starting at (x,y)\r
+extern void halLcdPrintXY(char String[], int x, int y, unsigned char TextStyle); \r
+\r
+//Print String of Length starting at (x,y)\r
+extern void halLcdPrintLine(char String[], unsigned char Line, unsigned char TextStyle); \r
+extern void halLcdPrintLineCol(char String[], unsigned char Line, unsigned char Col, unsigned char TextStyle); \r
+\r
+extern void halLcdCursor(void);\r
+extern void halLcdCursorOff(void);\r
+//Scroll a single row of pixels\r
+extern void halLcdScrollRow(int y);\r
+//Scroll a number of consecutive rows from yStart to yEnd\r
+extern void halLcdHScroll(int yStart, int yEnd);\r
+//Scroll a line of text\r
+extern void halLcdScrollLine(int Line);\r
+\r
+#endif /* HAL_LCD_H */\r
--- /dev/null
+/**********************************************************************//**\r
+ * @file UserExperienceGraphics.c\r
+ * \r
+ * Copyright 2010 Texas Instruments, Inc.\r
+***************************************************************************/\r
+\r
+const unsigned char fonts_lookup[]={\r
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \r
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \r
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \r
+ 0x00,0x00,63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \r
+ 64,65,0,69,0,68,67,0,0,1, //'0' = 48 = 0x30\r
+ 2,3,4,5,6,7,8,9,66,0, //'9' = 57 = 0x39\r
+ 0,70,0,62,0,10,11,12,13,14, //'A' --> 'Z'\r
+ 15,16,17,18,19,20,21,22,23,24,\r
+ 25,26,27,28,29,30,31,32,33,34, \r
+ 35,0,0,0,71,0,0,36,37,38, //'a' = 97 \r
+ 39,40,41,42,43,44,45,46,47,48,\r
+ 49,50,51,52,53,54,55,56,57,58,\r
+ 59,60,61,62,0 ,0, 0, 72,73,74,\r
+ 75,76,77,78,79,80,81 //'z' = 122\r
+ }; \r
+\r
+const unsigned int fonts[]= {\r
+ 0x0000, 0x0ffc, 0x3c0f, 0x3f0f, 0x3fcf, 0x3ccf, 0x3cff, 0x3c3f, \r
+ 0x3c0f, 0x0ffc, 0x0000, 0x0000, 0x0000, 0x0000, 0x00c0, 0x00f0, \r
+ 0x00ff, 0x00f0, 0x00f0, 0x00f0, 0x00f0, 0x00f0, 0x0fff, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f00, 0x03c0, \r
+ 0x00f0, 0x003c, 0x0f0f, 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x03fc, 0x0f0f, 0x0f00, 0x0f00, 0x03f0, 0x0f00, 0x0f00, 0x0f0f, \r
+ 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f00, 0x0fc0, 0x0ff0, \r
+ 0x0f3c, 0x0f0f, 0x3fff, 0x0f00, 0x0f00, 0x3fc0, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0fff, 0x000f, 0x000f, 0x000f, 0x03ff, 0x0f00, \r
+ 0x0f00, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, \r
+ 0x003c, 0x000f, 0x000f, 0x03ff, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, 0x3c0f, 0x3c0f, 0x3c00, \r
+ 0x0f00, 0x03c0, 0x00f0, 0x00f0, 0x00f0, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f3f, 0x03fc, 0x0fcf, 0x0f0f, \r
+ 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, \r
+ 0x0f0f, 0x0f0f, 0x0ffc, 0x03c0, 0x03c0, 0x00f0, 0x00fc, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x00f0, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, \r
+ 0x0fff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0fff, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ffc, 0x3c3c, 0x3c3c, 0x3c3c, \r
+ 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0ff0, 0x3c3c, 0x3c0f, \r
+ 0x000f, 0x000f, 0x000f, 0x3c0f, 0x3c3c, 0x0ff0, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x03ff, 0x0f3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, \r
+ 0x3c3c, 0x0f3c, 0x03ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, \r
+ 0x303c, 0x003c, 0x0c3c, 0x0ffc, 0x0c3c, 0x003c, 0x303c, 0x3fff, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, 0x3c3c, 0x303c, 0x0c3c, \r
+ 0x0ffc, 0x0c3c, 0x003c, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0ff0, 0x3c3c, 0x3c0f, 0x000f, 0x000f, 0x3f0f, 0x3c0f, \r
+ 0x3c3c, 0x3ff0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, \r
+ 0x0f0f, 0x0f0f, 0x0fff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x03fc, 0x00f0, 0x00f0, 0x00f0, 0x00f0, \r
+ 0x00f0, 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x3fc0, 0x0f00, 0x0f00, 0x0f00, 0x0f00, 0x0f0f, 0x0f0f, 0x0f0f, \r
+ 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c3f, 0x3c3c, 0x0f3c, \r
+ 0x0f3c, 0x03fc, 0x0f3c, 0x0f3c, 0x3c3c, 0x3c3f, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x00ff, 0x003c, 0x003c, 0x003c, 0x003c, 0x303c, \r
+ 0x3c3c, 0x3c3c, 0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, \r
+ 0x3f3f, 0x3fff, 0x3fff, 0x3ccf, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, 0x3c0f, 0x3c3f, 0x3cff, \r
+ 0x3fff, 0x3fcf, 0x3f0f, 0x3c0f, 0x3c0f, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x03f0, 0x0f3c, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, \r
+ 0x0f3c, 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x3c3c, \r
+ 0x3c3c, 0x3c3c, 0x0ffc, 0x003c, 0x003c, 0x003c, 0x00ff, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x03f0, 0x0f3c, 0x3c0f, 0x3c0f, 0x3c0f, \r
+ 0x3f0f, 0x3fcf, 0x0ffc, 0x0f00, 0x3fc0, 0x0000, 0x0000, 0x0000, \r
+ 0x0fff, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ffc, 0x0f3c, 0x3c3c, 0x3c3c, \r
+ 0x3c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, \r
+ 0x000f, 0x00fc, 0x03c0, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0fff, 0x0cf3, 0x00f0, 0x00f0, 0x00f0, 0x00f0, \r
+ 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, \r
+ 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, \r
+ 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x00f0, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, 0x3ccf, 0x3ccf, 0x0f3c, \r
+ 0x0f3c, 0x0f3c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, \r
+ 0x0f0f, 0x03fc, 0x00f0, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, \r
+ 0x00f0, 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x3fff, 0x3f0f, 0x03c3, 0x03c0, 0x00f0, 0x003c, 0x303c, 0x3c0f, \r
+ 0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x03fc, 0x0f00, 0x0ffc, 0x0f0f, 0x0f0f, 0x3cfc, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x003f, 0x003c, 0x003c, 0x0ffc, 0x3c3c, 0x3c3c, \r
+ 0x3c3c, 0x3c3c, 0x0fcf, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x000f, 0x000f, 0x0f0f, 0x03fc, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0fc0, 0x0f00, 0x0f00, 0x0ffc, \r
+ 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x3cfc, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0fff, 0x000f, \r
+ 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, 0x0f3c, \r
+ 0x003c, 0x003c, 0x03ff, 0x003c, 0x003c, 0x003c, 0x00ff, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3cfc, 0x0f0f, \r
+ 0x0f0f, 0x0f0f, 0x0ffc, 0x0f00, 0x0f0f, 0x03fc, 0x0000, 0x0000, \r
+ 0x003f, 0x003c, 0x003c, 0x0f3c, 0x3cfc, 0x3c3c, 0x3c3c, 0x3c3c, \r
+ 0x3c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x03c0, 0x03c0, 0x0000, \r
+ 0x03fc, 0x03c0, 0x03c0, 0x03c0, 0x03c0, 0x3ffc, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0f00, 0x0f00, 0x0000, 0x0ff0, 0x0f00, 0x0f00, \r
+ 0x0f00, 0x0f00, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x003f, \r
+ 0x003c, 0x003c, 0x3c3c, 0x0f3c, 0x03fc, 0x0f3c, 0x3c3c, 0x3c3f, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x03c0, 0x03c0, 0x03c0, \r
+ 0x03c0, 0x03c0, 0x03c0, 0x03c0, 0x3ffc, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x3ccf, 0x3ccf, 0x3ccf, \r
+ 0x3ccf, 0x3c0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x03ff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, \r
+ 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0fcf, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, \r
+ 0x0ffc, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x3cfc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0ffc, 0x0f00, 0x3fc0, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f3f, 0x3f3c, 0x3cfc, \r
+ 0x003c, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x003c, 0x03c0, 0x0f0f, 0x03fc, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030, 0x003c, 0x0fff, \r
+ 0x003c, 0x003c, 0x003c, 0x0f3c, 0x03f0, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, \r
+ 0x0f0f, 0x3cfc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x00f0, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, 0x3c0f, \r
+ 0x3ccf, 0x3ccf, 0x0f3c, 0x0f3c, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x3c0f, 0x0f3c, 0x03f0, 0x03f0, 0x0f3c, \r
+ 0x3c0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ff0, 0x0f00, 0x03c0, 0x00ff, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x0f03, 0x03c0, \r
+ 0x003c, 0x0c0f, 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, \r
+ 0x0f0f, 0x0f00, 0x03c0, 0x00f0, 0x00f0, 0x0000, 0x00f0, 0x00f0, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x003c, 0x003c, 0x00f0, \r
+ 0x03c0, 0x0f00, 0x0000, 0x0000, 0x0000, 0x0000, 0x003c, 0x00f0, \r
+ 0x03c0, 0x0f00, 0x0f00, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, 0x03f0, 0x0000, \r
+ 0x0000, 0x03f0, 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, \r
+ 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x3ffc, 0x3ffc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x03c0, 0x03c0, 0x3ffc, 0x3ffc, \r
+ 0x03c0, 0x03c0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x3ffc, 0x0000, 0x0000, 0x3ffc, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, \r
+ 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+//0---------------------------\r
+ 0x0000, 0x0ffc, 0x3c0f, 0x3f0f, 0x3fcf, 0x3ccf, 0x3cff, 0x3c3f, \r
+ 0x3c0f, 0x0ffc, 0x0000, 0x0000, 0x0000, \r
+//1--------------------------- \r
+ 0x0000, 0x00c0, 0x00f0, 0x00ff, 0x00f0, 0x00f0, 0x00f0, 0x00f0, \r
+ 0x00f0, 0x0fff, 0x0000, 0x0000, 0x0000, \r
+//2--------------------------- \r
+ 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f00, 0x03c0, 0x00f0, 0x003c, \r
+ 0x0f0f, 0x0fff, 0x0000, 0x0000, 0x0000, \r
+//3--------------------------- \r
+ 0x0000, 0x03fc, 0x0f0f, 0x0f00, 0x0f00, 0x03f0, 0x0f00, 0x0f00, \r
+ 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, \r
+//4---------------------------\r
+ 0x0000, 0x0f00, 0x0fc0, 0x0ff0, 0x0f3c, 0x0f0f, 0x3fff, 0x0f00, \r
+ 0x0f00, 0x3fc0, 0x0000, 0x0000, 0x0000, \r
+//5--------------------------- \r
+ 0x0000, 0x0fff, 0x000f, 0x000f, 0x000f, 0x03ff, 0x0f00, 0x0f00, \r
+ 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, \r
+//6--------------------------- \r
+ 0x0000, 0x03f0, 0x003c, 0x000f, 0x000f, 0x03ff, 0x0f0f, 0x0f0f, \r
+ 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, \r
+//7--------------------------- \r
+ 0x0000, 0x3fff, 0x3c0f, 0x3c0f, 0x3c00, 0x0f00, 0x03c0, 0x00f0, \r
+ 0x00f0, 0x00f0, 0x0000, 0x0000, 0x0000, \r
+//8--------------------------- \r
+ 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f3f, 0x03fc, 0x0fcf, 0x0f0f, \r
+ 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, \r
+//9--------------------------- \r
+ 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0ffc, 0x03c0, 0x03c0, \r
+ 0x00f0, 0x00fc, 0x0000, 0x0000, 0x0000, \r
+} ;\r
+\r
+ \r
+const unsigned int GrayScale_fonts[]= {\r
+ 0x0000, 0x0aa8, 0x280a, 0x2a0a, 0x2a8a, 0x288a, 0x28aa, 0x282a, \r
+ 0x280a, 0x0aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x00a0, \r
+ 0x00aa, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x0aaa, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a00, 0x0280, \r
+ 0x00a0, 0x0028, 0x0a0a, 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x02a8, 0x0a0a, 0x0a00, 0x0a00, 0x02a0, 0x0a00, 0x0a00, 0x0a0a, \r
+ 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a00, 0x0a80, 0x0aa0, \r
+ 0x0a28, 0x0a0a, 0x2aaa, 0x0a00, 0x0a00, 0x2a80, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0aaa, 0x000a, 0x000a, 0x000a, 0x02aa, 0x0a00, \r
+ 0x0a00, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, \r
+ 0x0028, 0x000a, 0x000a, 0x02aa, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, 0x280a, 0x280a, 0x2800, \r
+ 0x0a00, 0x0280, 0x00a0, 0x00a0, 0x00a0, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a2a, 0x02a8, 0x0a8a, 0x0a0a, \r
+ 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, \r
+ 0x0a0a, 0x0a0a, 0x0aa8, 0x0280, 0x0280, 0x00a0, 0x00a8, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x00a0, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, \r
+ 0x0aaa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0aaa, 0x2828, 0x2828, 0x2828, 0x0aa8, 0x2828, 0x2828, 0x2828, \r
+ 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aa0, 0x2828, 0x280a, \r
+ 0x000a, 0x000a, 0x000a, 0x280a, 0x2828, 0x0aa0, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x02aa, 0x0a28, 0x2828, 0x2828, 0x2828, 0x2828, \r
+ 0x2828, 0x0a28, 0x02aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, \r
+ 0x2028, 0x0028, 0x0828, 0x0aa8, 0x0828, 0x0028, 0x2028, 0x2aaa, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, 0x2828, 0x2028, 0x0828, \r
+ 0x0aa8, 0x0828, 0x0028, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0aa0, 0x2828, 0x280a, 0x000a, 0x000a, 0x2a0a, 0x280a, \r
+ 0x2828, 0x2aa0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, \r
+ 0x0a0a, 0x0a0a, 0x0aaa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x02a8, 0x00a0, 0x00a0, 0x00a0, 0x00a0, \r
+ 0x00a0, 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x2a80, 0x0a00, 0x0a00, 0x0a00, 0x0a00, 0x0a0a, 0x0a0a, 0x0a0a, \r
+ 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x282a, 0x2828, 0x0a28, \r
+ 0x0a28, 0x02a8, 0x0a28, 0x0a28, 0x2828, 0x282a, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x00aa, 0x0028, 0x0028, 0x0028, 0x0028, 0x2028, \r
+ 0x2828, 0x2828, 0x2aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x280a, \r
+ 0x2a2a, 0x2aaa, 0x2aaa, 0x288a, 0x280a, 0x280a, 0x280a, 0x280a, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x280a, 0x280a, 0x282a, 0x28aa, \r
+ 0x2aaa, 0x2a8a, 0x2a0a, 0x280a, 0x280a, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x02a0, 0x0a28, 0x280a, 0x280a, 0x280a, 0x280a, 0x280a, \r
+ 0x0a28, 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x2828, \r
+ 0x2828, 0x2828, 0x0aa8, 0x0028, 0x0028, 0x0028, 0x00aa, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x02a0, 0x0a28, 0x280a, 0x280a, 0x280a, \r
+ 0x2a0a, 0x2a8a, 0x0aa8, 0x0a00, 0x2a80, 0x0000, 0x0000, 0x0000, \r
+ 0x0aaa, 0x2828, 0x2828, 0x2828, 0x0aa8, 0x0a28, 0x2828, 0x2828, \r
+ 0x282a, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, \r
+ 0x000a, 0x00a8, 0x0280, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0aaa, 0x08a2, 0x00a0, 0x00a0, 0x00a0, 0x00a0, \r
+ 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, \r
+ 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, \r
+ 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x00a0, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x280a, 0x280a, 0x280a, 0x280a, 0x288a, 0x288a, 0x0a28, \r
+ 0x0a28, 0x0a28, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, \r
+ 0x0a0a, 0x02a8, 0x00a0, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, \r
+ 0x00a0, 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x2aaa, 0x2a0a, 0x0282, 0x0280, 0x00a0, 0x0028, 0x2028, 0x280a, \r
+ 0x2aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x02a8, 0x0a00, 0x0aa8, 0x0a0a, 0x0a0a, 0x28a8, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x002a, 0x0028, 0x0028, 0x0aa8, 0x2828, 0x2828, \r
+ 0x2828, 0x2828, 0x0a8a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x000a, 0x000a, 0x0a0a, 0x02a8, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0a80, 0x0a00, 0x0a00, 0x0aa8, \r
+ 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x28a8, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0aaa, 0x000a, \r
+ 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, 0x0a28, \r
+ 0x0028, 0x0028, 0x02aa, 0x0028, 0x0028, 0x0028, 0x00aa, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x28a8, 0x0a0a, \r
+ 0x0a0a, 0x0a0a, 0x0aa8, 0x0a00, 0x0a0a, 0x02a8, 0x0000, 0x0000, \r
+ 0x002a, 0x0028, 0x0028, 0x0a28, 0x28a8, 0x2828, 0x2828, 0x2828, \r
+ 0x282a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0280, 0x0280, 0x0000, \r
+ 0x02a8, 0x0280, 0x0280, 0x0280, 0x0280, 0x2aa8, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0a00, 0x0a00, 0x0000, 0x0aa0, 0x0a00, 0x0a00, \r
+ 0x0a00, 0x0a00, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x002a, \r
+ 0x0028, 0x0028, 0x2828, 0x0a28, 0x02a8, 0x0a28, 0x2828, 0x282a, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0280, 0x0280, 0x0280, \r
+ 0x0280, 0x0280, 0x0280, 0x0280, 0x2aa8, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x288a, 0x288a, 0x288a, \r
+ 0x288a, 0x280a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x02aa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, \r
+ 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0a8a, 0x2828, 0x2828, 0x2828, 0x2828, \r
+ 0x0aa8, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x28a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0aa8, 0x0a00, 0x2a80, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a2a, 0x2a28, 0x28a8, \r
+ 0x0028, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0028, 0x0280, 0x0a0a, 0x02a8, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0028, 0x0aaa, \r
+ 0x0028, 0x0028, 0x0028, 0x0a28, 0x02a0, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, \r
+ 0x0a0a, 0x28a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x00a0, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x280a, 0x280a, \r
+ 0x288a, 0x288a, 0x0a28, 0x0a28, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x280a, 0x0a28, 0x02a0, 0x02a0, 0x0a28, \r
+ 0x280a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x2828, 0x2828, 0x2828, 0x2828, 0x0aa0, 0x0a00, 0x0280, 0x00aa, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x0a02, 0x0280, \r
+ 0x0028, 0x080a, 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, \r
+ 0x0a0a, 0x0a00, 0x0280, 0x00a0, 0x00a0, 0x0000, 0x00a0, 0x00a0, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0a00, 0x0280, 0x00a0, 0x0028, 0x0028, 0x0028, 0x00a0, \r
+ 0x0280, 0x0a00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0028, 0x00a0, \r
+ 0x0280, 0x0a00, 0x0a00, 0x0a00, 0x0280, 0x00a0, 0x0028, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, 0x02a0, 0x0000, \r
+ 0x0000, 0x02a0, 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, \r
+ 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x2aa8, 0x2aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0280, 0x0280, 0x2aa8, 0x2aa8, \r
+ 0x0280, 0x0280, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x2aa8, 0x0000, 0x0000, 0x2aa8, 0x0000, 0x0000, \r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, \r
+ 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+//0---------------------------\r
+ 0x0000, 0x0aa8, 0x280a, 0x2a0a, 0x2a8a, 0x288a, 0x28aa, 0x282a, \r
+ 0x280a, 0x0aa8, 0x0000, 0x0000, 0x0000, \r
+//1--------------------------- \r
+ 0x0000, 0x0080, 0x00a0, 0x00aa, 0x00a0, 0x00a0, 0x00a0, 0x00a0, \r
+ 0x00a0, 0x0aaa, 0x0000, 0x0000, 0x0000, \r
+//2--------------------------- \r
+ 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a00, 0x0280, 0x00a0, 0x0028, \r
+ 0x0a0a, 0x0aaa, 0x0000, 0x0000, 0x0000, \r
+//2--------------------------- \r
+ 0x0000, 0x02a8, 0x0a0a, 0x0a00, 0x0a00, 0x02a0, 0x0a00, 0x0a00, \r
+ 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, \r
+//4---------------------------\r
+ 0x0000, 0x0a00, 0x0a80, 0x0aa0, 0x0a28, 0x0a0a, 0x2aaa, 0x0a00, \r
+ 0x0a00, 0x2a80, 0x0000, 0x0000, 0x0000, \r
+//5--------------------------- \r
+ 0x0000, 0x0aaa, 0x000a, 0x000a, 0x000a, 0x02aa, 0x0a00, 0x0a00, \r
+ 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, \r
+//6--------------------------- \r
+ 0x0000, 0x02a0, 0x0028, 0x000a, 0x000a, 0x02aa, 0x0a0a, 0x0a0a, \r
+ 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, \r
+//7--------------------------- \r
+ 0x0000, 0x2aaa, 0x280a, 0x280a, 0x2800, 0x0a00, 0x0280, 0x00a0, \r
+ 0x00a0, 0x00a0, 0x0000, 0x0000, 0x0000, \r
+//8--------------------------- \r
+ 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a2a, 0x02a8, 0x0a8a, 0x0a0a, \r
+ 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, \r
+//9--------------------------- \r
+ 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0aa8, 0x0280, 0x0280, \r
+ 0x00a0, 0x00a8, 0x0000, 0x0000, 0x0000, \r
+} ;\r
--- /dev/null
+/*******************************************************************************\r
+ Filename: hal_lcd_fonts.h\r
+\r
+ Copyright 2010 Texas Instruments, Inc.\r
+***************************************************************************/\r
+#ifndef FONTS_H\r
+#define FONTS_H\r
+\r
+#define FONT_HEIGHT 12 // Each character has 13 lines \r
+\r
+extern const unsigned char fonts_lookup[];\r
+extern const unsigned int fonts[];\r
+extern const unsigned int GrayScale_fonts[];\r
+\r
+#endif /* FONTS_H */\r
--- /dev/null
+/*\r
+ FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * If you are: *\r
+ * *\r
+ * + New to FreeRTOS, *\r
+ * + Wanting to learn FreeRTOS or multitasking in general quickly *\r
+ * + Looking for basic training, *\r
+ * + Wanting to improve your FreeRTOS skills and productivity *\r
+ * *\r
+ * then take a look at the FreeRTOS books - available as PDF or paperback *\r
+ * *\r
+ * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ * A pdf reference manual is also available. Both are usually delivered *\r
+ * to your inbox within 20 minutes to two hours when purchased between 8am *\r
+ * and 8pm GMT (although please allow up to 24 hours in case of *\r
+ * exceptional circumstances). Thank you for your support! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+ ***NOTE*** The exception to the GPL is included to allow you to distribute\r
+ a combined work that includes FreeRTOS without being obliged to provide the\r
+ source code for proprietary components outside of the FreeRTOS kernel.\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+ more details. You should have received a copy of the GNU General Public\r
+ License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+ can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+ by writing to Richard Barry, contact details for whom are available on the\r
+ FreeRTOS WEB site.\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
+ licensing and training services.\r
+*/\r
+\r
+/*-----------------------------------------------------------\r
+ * Simple parallel port IO routines to flash LEDs.\r
+ *-----------------------------------------------------------*/\r
+\r
+/* Kernel includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+/* Hardware includes. */\r
+#include "msp430.h"\r
+#include "hal_MSP-EXP430F5438.h"\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void vParTestInitialise( void )\r
+{\r
+ /* The port used by the two LEDs is configured from halBoardInit() so\r
+ nothing needs to be done here. */\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )\r
+{\r
+ /* Only two LEDs are provided on the hardware. */\r
+ taskENTER_CRITICAL();\r
+ {\r
+ if( xValue != pdFALSE )\r
+ {\r
+ switch( uxLED )\r
+ {\r
+ case 0: LED_PORT_OUT |= LED_1;\r
+ break;\r
+ \r
+ case 1: LED_PORT_OUT |= LED_2;\r
+ break;\r
+ \r
+ default: /* Nothing to do here, there are only two LEDs. */\r
+ break;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ switch( uxLED )\r
+ {\r
+ case 0: LED_PORT_OUT &= ~LED_1;\r
+ break;\r
+ \r
+ case 1: LED_PORT_OUT &= ~LED_2;\r
+ break;\r
+ default: /* Nothing to do here, there are only two LEDs. */\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ taskEXIT_CRITICAL();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vParTestToggleLED( unsigned portBASE_TYPE uxLED )\r
+{\r
+ taskENTER_CRITICAL();\r
+ {\r
+ switch( uxLED )\r
+ {\r
+ case 0: if( ( LED_PORT_OUT & LED_1 ) == 0 )\r
+ {\r
+ LED_PORT_OUT |= LED_1;\r
+ }\r
+ else\r
+ {\r
+ LED_PORT_OUT &= ~LED_1;\r
+ }\r
+ break;\r
+\r
+ case 1: if( ( LED_PORT_OUT & LED_2 ) == 0 )\r
+ {\r
+ LED_PORT_OUT |= LED_2;\r
+ }\r
+ else\r
+ {\r
+ LED_PORT_OUT &= ~LED_2;\r
+ }\r
+ break;\r
+ default: /* Nothing to do here, there are only two LEDs. */\r
+ break;\r
+ }\r
+ }\r
+ taskEXIT_CRITICAL();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
--- /dev/null
+;\r
+; FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.\r
+;\r
+; ***************************************************************************\r
+; * *\r
+; * If you are: *\r
+; * *\r
+; * + New to FreeRTOS, *\r
+; * + Wanting to learn FreeRTOS or multitasking in general quickly *\r
+; * + Looking for basic training, *\r
+; * + Wanting to improve your FreeRTOS skills and productivity *\r
+; * *\r
+; * then take a look at the FreeRTOS books - available as PDF or paperback *\r
+; * *\r
+; * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *\r
+; * http://www.FreeRTOS.org/Documentation *\r
+; * *\r
+; * A pdf reference manual is also available. Both are usually delivered *\r
+; * to your inbox within 20 minutes to two hours when purchased between 8am *\r
+; * and 8pm GMT (although please allow up to 24 hours in case of *\r
+; * exceptional circumstances). Thank you for your support! *\r
+; * *\r
+; ***************************************************************************\r
+;\r
+; This file is part of the FreeRTOS distribution.\r
+;\r
+; FreeRTOS is free software; you can redistribute it and/or modify it under\r
+; the terms of the GNU General Public License (version 2) as published by the\r
+; Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+; ***NOTE*** The exception to the GPL is included to allow you to distribute\r
+; a combined work that includes FreeRTOS without being obliged to provide the\r
+; source code for proprietary components outside of the FreeRTOS kernel.\r
+; FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
+; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+; more details. You should have received a copy of the GNU General Public\r
+; License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+; can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+; by writing to Richard Barry, contact details for whom are available on the\r
+; FreeRTOS WEB site.\r
+;\r
+; 1 tab == 4 spaces!\r
+;\r
+; http://www.FreeRTOS.org - Documentation, latest information, license and\r
+; contact details.\r
+;\r
+; http://www.SafeRTOS.com - A version that is certified for use in safety\r
+; critical systems.\r
+;\r
+; http://www.OpenRTOS.com - Commercial support, development, porting,\r
+; licensing and training services.\r
+\r
+; * The definition of the "register test" tasks, as described at the top of\r
+; * main.c\r
+\r
+\r
+\r
+\r
+ .global usRegTest1Counter\r
+ .global usRegTest2Counter\r
+ .global vPortYield\r
+ \r
+ .def vRegTest1Task\r
+ .def vRegTest2Task\r
+\r
+ .text\r
+\r
+vRegTest1Task:\r
+\r
+ ; Fill each general purpose register with a known value.\r
+ movx.a #0x44444, r4\r
+ movx.a #0x55555, r5\r
+ movx.a #0x66666, r6\r
+ movx.a #0x77777, r7\r
+ movx.a #0x88888, r8\r
+ movx.a #0x99999, r9\r
+ movx.a #0xaaaaa, r10\r
+ movx.a #0xbbbbb, r11\r
+ movx.a #0xccccc, r12\r
+ movx.a #0xddddd, r13\r
+ movx.a #0xeeeee, r14\r
+ movx.a #0xfffff, r15\r
+ \r
+prvRegTest1Loop:\r
+\r
+ ; Test each general purpose register to check that it still contains the\r
+ ; expected known value, jumping to vRegTest1Error if any register contains\r
+ ; an unexpected value.\r
+ cmpx.a #0x44444, r4\r
+ jne vRegTest1Error\r
+ cmpx.a #0x55555, r5\r
+ jne vRegTest1Error\r
+ cmpx.a #0x66666, r6\r
+ jne vRegTest1Error\r
+ cmpx.a #0x77777, r7\r
+ jne vRegTest1Error\r
+ cmpx.a #0x88888, r8\r
+ jne vRegTest1Error\r
+ cmpx.a #0x99999, r9\r
+ jne vRegTest1Error\r
+ cmpx.a #0xaaaaa, r10\r
+ jne vRegTest1Error\r
+ cmpx.a #0xbbbbb, r11\r
+ jne vRegTest1Error\r
+ cmpx.a #0xccccc, r12\r
+ jne vRegTest1Error\r
+ cmpx.a #0xddddd, r13\r
+ jne vRegTest1Error\r
+ cmpx.a #0xeeeee, r14\r
+ jne vRegTest1Error\r
+ cmpx.a #0xfffff, r15\r
+ jne vRegTest1Error\r
+ \r
+ ; This task is still running without jumping to vRegTest1Error, so increment\r
+ ; the loop counter so the check task knows the task is running error free.\r
+ incx.w &usRegTest1Counter\r
+ \r
+ ; Loop again, performing the same tests.\r
+ jmp prvRegTest1Loop\r
+ nop\r
+\r
+ \r
+vRegTest1Error:\r
+ jmp vRegTest1Error\r
+ nop\r
+ \r
+; -----------------------------------------------------------\r
+\r
+; See the comments in vRegTest1Task. This task is the same, it just uses\r
+; different values in its registers.\r
+vRegTest2Task:\r
+\r
+ movx.a #0x14441, r4\r
+ movx.a #0x15551, r5\r
+ movx.a #0x16661, r6\r
+ movx.a #0x17771, r7\r
+ movx.a #0x18881, r8\r
+ movx.a #0x19991, r9\r
+ movx.a #0x1aaa1, r10\r
+ movx.a #0x1bbb1, r11\r
+ movx.a #0x1ccc1, r12\r
+ movx.a #0x1ddd1, r13\r
+ movx.a #0x1eee1, r14\r
+ movx.a #0x1fff1, r15\r
+ \r
+prvRegTest2Loop:\r
+\r
+ cmpx.a #0x14441, r4\r
+ jne vRegTest2Error\r
+ cmpx.a #0x15551, r5\r
+ jne vRegTest2Error\r
+ cmpx.a #0x16661, r6\r
+ jne vRegTest2Error\r
+ cmpx.a #0x17771, r7\r
+ jne vRegTest2Error\r
+ cmpx.a #0x18881, r8\r
+ jne vRegTest2Error\r
+ cmpx.a #0x19991, r9\r
+ jne vRegTest2Error\r
+ cmpx.a #0x1aaa1, r10\r
+ jne vRegTest2Error\r
+ cmpx.a #0x1bbb1, r11\r
+ jne vRegTest2Error\r
+ cmpx.a #0x1ccc1, r12\r
+ jne vRegTest2Error\r
+ cmpx.a #0x1ddd1, r13\r
+ jne vRegTest2Error\r
+ cmpx.a #0x1eee1, r14\r
+ jne vRegTest2Error\r
+ cmpx.a #0x1fff1, r15\r
+ jne vRegTest2Error\r
+ \r
+ ; Also perform a manual yield, just to increase the scope of the test.\r
+ calla #vPortYield\r
+ \r
+ incx.w &usRegTest2Counter\r
+ jmp prvRegTest2Loop\r
+ nop\r
+\r
+ \r
+vRegTest2Error:\r
+ jmp vRegTest2Error\r
+ nop\r
+; /*-----------------------------------------------------------\r
+\r
+ \r
+ .end\r
+ \r
--- /dev/null
+/*\r
+ FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * If you are: *\r
+ * *\r
+ * + New to FreeRTOS, *\r
+ * + Wanting to learn FreeRTOS or multitasking in general quickly *\r
+ * + Looking for basic training, *\r
+ * + Wanting to improve your FreeRTOS skills and productivity *\r
+ * *\r
+ * then take a look at the FreeRTOS books - available as PDF or paperback *\r
+ * *\r
+ * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ * A pdf reference manual is also available. Both are usually delivered *\r
+ * to your inbox within 20 minutes to two hours when purchased between 8am *\r
+ * and 8pm GMT (although please allow up to 24 hours in case of *\r
+ * exceptional circumstances). Thank you for your support! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+ ***NOTE*** The exception to the GPL is included to allow you to distribute\r
+ a combined work that includes FreeRTOS without being obliged to provide the\r
+ source code for proprietary components outside of the FreeRTOS kernel.\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+ more details. You should have received a copy of the GNU General Public\r
+ License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+ can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+ by writing to Richard Barry, contact details for whom are available on the\r
+ FreeRTOS WEB site.\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
+ licensing and training services.\r
+*/\r
+\r
+/* FreeRTOS includes. */\r
+#include "FreeRTOS.h"\r
+\r
+/* Hardware includes. */\r
+#include "msp430.h"\r
+#include "hal_MSP-EXP430F5438.h"\r
+\r
+/* This demo uses Timer A1 to generate the time base for gathering run time\r
+statistics information. Run time statistics show much processing time has\r
+been allocated to each task since the application booted. */\r
+\r
+/* The time base for the run time stats is generated by a 16 bit timer. Each\r
+time the timer overflows ulStatsOverflowCount is incremented. Therefore,\r
+when converting the total run time to a 32 bit number, the most significant two\r
+bytes are given by ulStatsOverflowCount and the least significant two bytes are\r
+given by the current timer counter value. Care must be taken with data\r
+consistency when combining the two in case a timer overflow occurs as the\r
+value is being read. */\r
+volatile unsigned long ulStatsOverflowCount = 0;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void vConfigureTimerForRunTimeStats( void )\r
+{\r
+ /* Ensure the timer is stopped. */\r
+ TA1CTL = 0;\r
+\r
+ /* Run the timer from the ACLK/4. */\r
+ TA1CTL = TASSEL_1 | ID__4;\r
+\r
+ /* Clear everything to start with. */\r
+ TA1CTL |= TACLR;\r
+\r
+ /* Enable the interrupts. */\r
+ TA1CCTL0 = CCIE;\r
+\r
+ /* Start up clean. */\r
+ TA1CTL |= TACLR;\r
+\r
+ /* Continuous mode. */\r
+ TA1CTL |= MC__CONTINOUS;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#pragma vector=TIMER1_A0_VECTOR\r
+static __interrupt void prvRunTimeStatsOverflowISR( void )\r
+{\r
+ ulStatsOverflowCount++;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+inline unsigned long ulGetRunTimeStatsTime( void )\r
+{\r
+unsigned long ulReturn;\r
+\r
+ TA1CTL &= ~MC__CONTINOUS;\r
+ ulReturn = ( ( ulStatsOverflowCount << 16UL ) | ( unsigned long ) TA1R );\r
+ TA1CTL |= MC__CONTINOUS;\r
+ \r
+ return ulReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
--- /dev/null
+/*\r
+ FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * If you are: *\r
+ * *\r
+ * + New to FreeRTOS, *\r
+ * + Wanting to learn FreeRTOS or multitasking in general quickly *\r
+ * + Looking for basic training, *\r
+ * + Wanting to improve your FreeRTOS skills and productivity *\r
+ * *\r
+ * then take a look at the FreeRTOS books - available as PDF or paperback *\r
+ * *\r
+ * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ * A pdf reference manual is also available. Both are usually delivered *\r
+ * to your inbox within 20 minutes to two hours when purchased between 8am *\r
+ * and 8pm GMT (although please allow up to 24 hours in case of *\r
+ * exceptional circumstances). Thank you for your support! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+ ***NOTE*** The exception to the GPL is included to allow you to distribute\r
+ a combined work that includes FreeRTOS without being obliged to provide the\r
+ source code for proprietary components outside of the FreeRTOS kernel.\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+ more details. You should have received a copy of the GNU General Public\r
+ License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+ can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+ by writing to Richard Barry, contact details for whom are available on the\r
+ FreeRTOS WEB site.\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
+ licensing and training services.\r
+*/\r
+\r
+/*\r
+ * The documentation page for this demo available on http://www.FreeRTOS.org\r
+ * documents the hardware configuration required to run this demo. It also\r
+ * provides more information on the expected demo application behaviour.\r
+ *\r
+ * main() creates all the demo application tasks, then starts the scheduler.\r
+ * A lot of the created tasks are from the pool of "standard demo" tasks. The\r
+ * web documentation provides more details of the standard demo tasks, which\r
+ * provide no particular functionality but do provide good examples of how to\r
+ * use the FreeRTOS API.\r
+ *\r
+ * In addition to the standard demo tasks, the following tasks, interrupts and\r
+ * tests are defined and/or created within this file:\r
+ *\r
+ * "LCD" task - The LCD task is a 'gatekeeper' task. It is the only task that\r
+ * is permitted to access the LCD and therefore ensures access to the LCD is\r
+ * always serialised and there are no mutual exclusion issues. When a task or\r
+ * an interrupt wants to write to the LCD, it does not access the LCD directly\r
+ * but instead sends the message to the LCD task. The LCD task then performs\r
+ * the actual LCD output. This mechanism also allows interrupts to, in effect,\r
+ * write to the LCD by sending messages to the LCD task.\r
+ *\r
+ * The LCD task is also a demonstration of a 'controller' task design pattern.\r
+ * Some tasks do not actually send a string to the LCD task directly, but\r
+ * instead send a command that is interpreted by the LCD task. In a normal\r
+ * application these commands can be control values or set points, in this\r
+ * simple example the commands just result in messages being displayed on the\r
+ * LCD.\r
+ *\r
+ * "Button Poll" task - This task polls the state of the 'up' key on the\r
+ * joystick input device. It uses the vTaskDelay() API function to control\r
+ * the poll rate to ensure debouncing is not necessary and that the task does\r
+ * not use all the available CPU processing time.\r
+ *\r
+ * Button Interrupt and run time stats display - The select button on the\r
+ * joystick input device is configured to generate an external interrupt. The\r
+ * handler for this interrupt sends a message to LCD task, which interprets the\r
+ * message to mean, firstly write a message to the LCD, and secondly, generate\r
+ * a table of run time statistics. The run time statistics are displayed as a\r
+ * table that contains information on how much processing time each task has\r
+ * been allocated since the application started to execute. This information\r
+ * is provided both as an absolute time, and as a percentage of the total run\r
+ * time. The information is displayed in the terminal IO window of the IAR\r
+ * embedded workbench. The online documentation for this demo shows a screen\r
+ * shot demonstrating where the run time stats can be viewed.\r
+ *\r
+ * Idle Hook - The idle hook is a function that is called on each iteration of\r
+ * the idle task. In this case it is used to place the processor into a low\r
+ * power mode. Note however that this application is implemented using standard\r
+ * components, and is therefore not optimised for low power operation. Lower\r
+ * power consumption would be achieved by converting polling tasks into event\r
+ * driven tasks, and slowing the tick interrupt frequency.\r
+ *\r
+ * "Check" function called from the tick hook - The tick hook is called during\r
+ * each tick interrupt. It is called from an interrupt context so must execute\r
+ * quickly, not attempt to block, and not call any FreeRTOS API functions that\r
+ * do not end in "FromISR". In this case the tick hook executes a 'check'\r
+ * function. This only executes every five seconds. Its main function is to\r
+ * check that all the standard demo tasks are still operational. Each time it\r
+ * executes it sends a status code to the LCD task. The LCD task interprets the\r
+ * code and displays an appropriate message - which will be PASS if no tasks\r
+ * have reported any errors, or a message stating which task has reported an\r
+ * error.\r
+ *\r
+ * "Reg test" tasks - These fill the registers with known values, then check\r
+ * that each register still contains its expected value. Each task uses\r
+ * different values. The tasks run with very low priority so get preempted\r
+ * very frequently. A check variable is incremented on each iteration of the\r
+ * test loop. A register containing an unexpected value is indicative of an\r
+ * error in the context switching mechanism and will result in a branch to a\r
+ * null loop - which in turn will prevent the check variable from incrementing\r
+ * any further and allow the check task (described a above) to determine that an\r
+ * error has occurred. The nature of the reg test tasks necessitates that they\r
+ * are written in assembly code.\r
+ *\r
+ * *NOTE 2* vApplicationSetupTimerInterrupt() is called by the kernel to let\r
+ * the application set up a timer to generate the tick interrupt. In this\r
+ * example a timer A0 is used for this purpose.\r
+ *\r
+*/\r
+\r
+/* Standard includes. */\r
+#include <stdio.h>\r
+\r
+/* FreeRTOS includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "queue.h"\r
+\r
+/* Hardware includes. */\r
+#include "msp430.h"\r
+#include "hal_MSP-EXP430F5438.h"\r
+\r
+/* Standard demo includes. */\r
+#include "ParTest.h"\r
+#include "dynamic.h"\r
+#include "comtest2.h"\r
+#include "GenQTest.h"\r
+\r
+/* Codes sent within messages to the LCD task so the LCD task can interpret\r
+exactly what the message it just received was. These are sent in the\r
+cMessageID member of the message structure (defined below). */\r
+#define mainMESSAGE_BUTTON_UP ( 1 )\r
+#define mainMESSAGE_BUTTON_SEL ( 2 )\r
+#define mainMESSAGE_STATUS ( 3 )\r
+\r
+/* When the cMessageID member of the message sent to the LCD task is\r
+mainMESSAGE_STATUS then these definitions are sent in the ulMessageValue member\r
+of the same message and indicate what the status actually is. */\r
+#define mainERROR_DYNAMIC_TASKS ( pdPASS + 1 )\r
+#define mainERROR_COM_TEST ( pdPASS + 2 )\r
+#define mainERROR_GEN_QUEUE_TEST ( pdPASS + 3 )\r
+#define mainERROR_REG_TEST ( pdPASS + 4 )\r
+\r
+/* The length of the queue (the number of items the queue can hold) that is used\r
+to send messages from tasks and interrupts the the LCD task. */\r
+#define mainQUEUE_LENGTH ( 5 )\r
+\r
+/* Priorities used by the test and demo tasks. */\r
+#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
+#define mainGENERIC_QUEUE_TEST_PRIORITY ( tskIDLE_PRIORITY )\r
+\r
+/* The LED used by the comtest tasks. See the comtest.c file for more\r
+information. */\r
+#define mainCOM_TEST_LED ( 1 )\r
+\r
+/* The baud rate used by the comtest tasks described at the top of this file. */\r
+#define mainCOM_TEST_BAUD_RATE ( 38400 )\r
+\r
+/* The maximum number of lines of text that can be displayed on the LCD. */\r
+#define mainMAX_LCD_LINES ( 8 )\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * The reg test tasks as described at the top of this file.\r
+ */\r
+extern void vRegTest1Task( void *pvParameters );\r
+extern void vRegTest2Task( void *pvParameters );\r
+\r
+/*\r
+ * Configures clocks, LCD, port pints, etc. necessary to execute this demo.\r
+ */\r
+static void prvSetupHardware( void );\r
+\r
+/*\r
+ * Definition of the LCD/controller task described in the comments at the top\r
+ * of this file.\r
+ */\r
+static void prvLCDTask( void *pvParameters );\r
+\r
+/*\r
+ * Definition of the button poll task described in the comments at the top of\r
+ * this file.\r
+ */\r
+static void prvButtonPollTask( void *pvParameters );\r
+\r
+/*\r
+ * Converts a status message value into an appropriate string for display on\r
+ * the LCD. The string is written to pcBuffer.\r
+ */\r
+static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Variables that are incremented on each iteration of the reg test tasks -\r
+provided the tasks have not reported any errors. The check task inspects these\r
+variables to ensure they are still incrementing as expected. If a variable\r
+stops incrementing then it is likely that its associate task has stalled. */\r
+volatile unsigned short usRegTest1Counter = 0, usRegTest2Counter = 0;\r
+\r
+/* The handle of the queue used to send messages from tasks and interrupts to\r
+the LCD task. */\r
+static xQueueHandle xLCDQueue = NULL;\r
+\r
+/* The definition of each message sent from tasks and interrupts to the LCD\r
+task. */\r
+typedef struct\r
+{\r
+ char cMessageID; /* << States what the message is. */\r
+ unsigned long ulMessageValue; /* << States the message value (can be an integer, string pointer, etc. depending on the value of cMessageID). */\r
+} xQueueMessage;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void main( void )\r
+{\r
+ /* Configure the peripherals used by this demo application. This includes\r
+ configuring the joystick input select button to generate interrupts. */\r
+ prvSetupHardware();\r
+\r
+ /* Create the queue used by tasks and interrupts to send strings to the LCD\r
+ task. */\r
+ xLCDQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( xQueueMessage ) );\r
+\r
+ /* If the queue could not be created then don't create any tasks that might\r
+ attempt to use the queue. */\r
+ if( xLCDQueue != NULL )\r
+ {\r
+ /* Add the created queue to the queue registry so it can be viewed in\r
+ the IAR FreeRTOS state viewer plug-in. */\r
+ vQueueAddToRegistry( xLCDQueue, ( signed char * ) "LCDQueue" );\r
+\r
+ /* Create the standard demo tasks. */\r
+ vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
+ vStartDynamicPriorityTasks();\r
+ vStartGenericQueueTasks( mainGENERIC_QUEUE_TEST_PRIORITY );\r
+ \r
+ /* Create the LCD, button poll and register test tasks, as described at\r
+ the top of this file. */\r
+ xTaskCreate( prvLCDTask, ( signed char * ) "LCD", configMINIMAL_STACK_SIZE * 2, NULL, mainLCD_TASK_PRIORITY, NULL );\r
+ xTaskCreate( prvButtonPollTask, ( signed char * ) "BPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+ xTaskCreate( vRegTest1Task, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, NULL, 0, NULL );\r
+ xTaskCreate( vRegTest2Task, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL );\r
+\r
+ /* Start the scheduler. */\r
+ vTaskStartScheduler();\r
+ }\r
+\r
+ /* If all is well then this line will never be reached. If it is reached\r
+ then it is likely that there was insufficient (FreeRTOS) heap memory space\r
+ to create the idle task. This may have been trapped by the malloc() failed\r
+ hook function, if one is configured. */ \r
+ for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvLCDTask( void *pvParameters )\r
+{\r
+xQueueMessage xReceivedMessage;\r
+\r
+/* Buffer into which strings are formatted and placed ready for display on the\r
+LCD. Note this is a static variable to prevent it being allocated on the task\r
+stack, which is too small to hold such a variable. The stack size is configured\r
+when the task is created. */\r
+static char cBuffer[ 512 ];\r
+unsigned char ucLine = 1;\r
+\r
+\r
+ /* This function is the only function that uses printf(). If printf() is\r
+ used from any other function then some sort of mutual exclusion on stdout\r
+ will be necessary.\r
+ \r
+ This is also the only function that is permitted to access the LCD.\r
+ \r
+ First print out the number of bytes that remain in the FreeRTOS heap. This\r
+ can be viewed in the terminal IO window within the IAR Embedded Workbench. */\r
+ printf( "%d bytes of heap space remain unallocated\n", ( int ) xPortGetFreeHeapSize() );\r
+\r
+ for( ;; )\r
+ {\r
+ /* Wait for a message to be received. Using portMAX_DELAY as the block\r
+ time will result in an indefinite wait provided INCLUDE_vTaskSuspend is\r
+ set to 1 in FreeRTOSConfig.h, therefore there is no need to check the\r
+ function return value and the function will only return when a value\r
+ has been received. */\r
+ xQueueReceive( xLCDQueue, &xReceivedMessage, portMAX_DELAY );\r
+\r
+ /* Clear the LCD if no room remains for any more text output. */\r
+ if( ucLine > mainMAX_LCD_LINES )\r
+ {\r
+ halLcdClearScreen();\r
+ ucLine = 0;\r
+ }\r
+ \r
+ /* What is this message? What does it contain? */\r
+ switch( xReceivedMessage.cMessageID )\r
+ {\r
+ case mainMESSAGE_BUTTON_UP : /* The button poll task has just\r
+ informed this task that the up\r
+ button on the joystick input has\r
+ been pressed or released. */\r
+ sprintf( cBuffer, "Button up = %d", ( int ) xReceivedMessage.ulMessageValue );\r
+ break;\r
+\r
+ case mainMESSAGE_BUTTON_SEL : /* The select button interrupt\r
+ just informed this task that the\r
+ select button was pressed.\r
+ Generate a table of task run time\r
+ statistics and output this to\r
+ the terminal IO window in the IAR\r
+ embedded workbench. */\r
+ printf( "\nTask\t Abs Time\t %%Time\n*****************************************" );\r
+ fflush( stdout );\r
+ //vTaskGetRunTimeStats( ( signed char * ) cBuffer );\r
+ //printf( cBuffer );\r
+ //fflush( stdout );\r
+ \r
+ /* Also print out a message to\r
+ the LCD - in this case the\r
+ pointer to the string to print\r
+ is sent directly in the\r
+ ulMessageValue member of the\r
+ message. This just demonstrates\r
+ a different communication\r
+ technique. */\r
+ sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.ulMessageValue );\r
+ break;\r
+ \r
+ case mainMESSAGE_STATUS : /* The tick interrupt hook\r
+ function has just informed this\r
+ task of the system status.\r
+ Generate a string in accordance\r
+ with the status value. */\r
+ prvGenerateStatusMessage( cBuffer, xReceivedMessage.ulMessageValue );\r
+ break;\r
+ \r
+ default : sprintf( cBuffer, "Unknown message" );\r
+ break;\r
+ }\r
+ \r
+ /* Output the message that was placed into the cBuffer array within the\r
+ switch statement above, then move onto the next line ready for the next\r
+ message to arrive on the queue. */\r
+ halLcdPrintLine( cBuffer, ucLine, OVERWRITE_TEXT );\r
+ ucLine++;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue )\r
+{\r
+ /* Just a utility function to convert a status value into a meaningful\r
+ string for output onto the LCD. */\r
+ switch( lStatusValue )\r
+ {\r
+ case pdPASS : sprintf( pcBuffer, "Status = PASS" );\r
+ break;\r
+ case mainERROR_DYNAMIC_TASKS : sprintf( pcBuffer, "Err: Dynamic tsks" );\r
+ break;\r
+ case mainERROR_COM_TEST : sprintf( pcBuffer, "Err: COM test" );\r
+ break;\r
+ case mainERROR_GEN_QUEUE_TEST : sprintf( pcBuffer, "Error: Gen Q test" );\r
+ break;\r
+ case mainERROR_REG_TEST : sprintf( pcBuffer, "Error: Reg test" );\r
+ break;\r
+ default : sprintf( pcBuffer, "Unknown status" );\r
+ break;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvButtonPollTask( void *pvParameters )\r
+{\r
+unsigned char ucLastState = pdFALSE, ucState;\r
+xQueueMessage xMessage;\r
+\r
+ /* This tasks performs the button polling functionality as described at the\r
+ top of this file. */\r
+ for( ;; )\r
+ {\r
+ /* Check the button state. */\r
+ ucState = ( halButtonsPressed() & BUTTON_UP );\r
+ \r
+ if( ucState != 0 )\r
+ {\r
+ /* The button was pressed. */\r
+ ucState = pdTRUE;\r
+ }\r
+ \r
+ if( ucState != ucLastState )\r
+ {\r
+ /* The state has changed, send a message to the LCD task. */\r
+ xMessage.cMessageID = mainMESSAGE_BUTTON_UP;\r
+ xMessage.ulMessageValue = ( unsigned long ) ucState;\r
+ ucLastState = ucState;\r
+ xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY );\r
+ }\r
+ \r
+ /* Block for 10 milliseconds so this task does not utilise all the CPU\r
+ time and debouncing of the button is not necessary. */\r
+ vTaskDelay( 10 / portTICK_RATE_MS );\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvSetupHardware( void )\r
+{\r
+/* Convert a Hz value to a KHz value, as required by the Init_FLL_Settle()\r
+function. */\r
+unsigned long ulCPU_Clock_KHz = ( configCPU_CLOCK_HZ / 1000UL );\r
+\r
+ taskDISABLE_INTERRUPTS();\r
+ \r
+ /* Disable the watchdog. */\r
+ WDTCTL = WDTPW + WDTHOLD;\r
+ \r
+ halBoardInit();\r
+\r
+ LFXT_Start( XT1DRIVE_0 );\r
+ Init_FLL_Settle( ( unsigned short ) ulCPU_Clock_KHz, 488 );\r
+\r
+ halButtonsInit( BUTTON_ALL );\r
+ halButtonsInterruptEnable( BUTTON_SELECT );\r
+\r
+ /* Initialise the LCD, but note that the backlight is not used as the\r
+ library function uses timer A0 to modulate the backlight, and this file\r
+ defines vApplicationSetupTimerInterrupt() to also use timer A0 to generate\r
+ the tick interrupt. If the backlight is required, then change either the\r
+ halLCD library or vApplicationSetupTimerInterrupt() to use a different\r
+ timer. Timer A1 is used for the run time stats time base6. */\r
+ halLcdInit();\r
+ halLcdSetContrast( 100 );\r
+ halLcdClearScreen();\r
+ \r
+ halLcdPrintLine( " www.FreeRTOS.org", 0, OVERWRITE_TEXT );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationTickHook( void )\r
+{\r
+static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0;\r
+static unsigned long ulCounter = 0;\r
+static const unsigned long ulCheckFrequency = 5000UL / portTICK_RATE_MS;\r
+portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
+\r
+/* Define the status message that is sent to the LCD task. By default the\r
+status is PASS. */\r
+static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS };\r
+\r
+ /* This is called from within the tick interrupt and performs the 'check'\r
+ functionality as described in the comments at the top of this file.\r
+\r
+ Is it time to perform the 'check' functionality again? */\r
+ ulCounter++;\r
+ if( ulCounter >= ulCheckFrequency )\r
+ {\r
+ /* See if the standard demo tasks are executing as expected, changing\r
+ the message that is sent to the LCD task from PASS to an error code if\r
+ any tasks set reports an error. */\r
+ if( xAreComTestTasksStillRunning() != pdPASS )\r
+ {\r
+ xStatusMessage.ulMessageValue = mainERROR_COM_TEST;\r
+ }\r
+\r
+ if( xAreDynamicPriorityTasksStillRunning() != pdPASS )\r
+ {\r
+ xStatusMessage.ulMessageValue = mainERROR_DYNAMIC_TASKS;\r
+ }\r
+ \r
+ if( xAreGenericQueueTasksStillRunning() != pdPASS )\r
+ {\r
+ xStatusMessage.ulMessageValue = mainERROR_GEN_QUEUE_TEST;\r
+ } \r
+\r
+ /* Check the reg test tasks are still cycling. They will stop\r
+ incrementing their loop counters if they encounter an error. */\r
+ if( usRegTest1Counter == usLastRegTest1Counter )\r
+ {\r
+ xStatusMessage.ulMessageValue = mainERROR_REG_TEST;\r
+ }\r
+\r
+ if( usRegTest2Counter == usLastRegTest2Counter )\r
+ {\r
+ xStatusMessage.ulMessageValue = mainERROR_REG_TEST;\r
+ }\r
+\r
+ usLastRegTest1Counter = usRegTest1Counter;\r
+ usLastRegTest2Counter = usRegTest2Counter;\r
+ \r
+ /* As this is the tick hook the lHigherPriorityTaskWoken parameter is not\r
+ needed (a context switch is going to be performed anyway), but it must\r
+ still be provided. */\r
+ xQueueSendFromISR( xLCDQueue, &xStatusMessage, &xHigherPriorityTaskWoken );\r
+ ulCounter = 0;\r
+ }\r
+\r
+ /* Just periodically toggle an LED to show that the tick interrupt is\r
+ running. Note that this access LED_PORT_OUT in a non-atomic way, so tasks\r
+ that access the same port must do so from a critical section. */\r
+ if( ( ulCounter & 0xff ) == 0 )\r
+ {\r
+ if( ( LED_PORT_OUT & LED_1 ) == 0 )\r
+ {\r
+ LED_PORT_OUT |= LED_1;\r
+ }\r
+ else\r
+ {\r
+ LED_PORT_OUT &= ~LED_1;\r
+ }\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#pragma vector=PORT2_VECTOR\r
+interrupt void prvSelectButtonInterrupt( void )\r
+{\r
+/* Define the message sent to the LCD task from this interrupt. */\r
+static const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, ( unsigned long ) "Select Interrupt" };\r
+portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
+\r
+ /* This is the interrupt handler for the joystick select button input.\r
+ The button has been pushed, write a message to the LCD via the LCD task. */\r
+ xQueueSendFromISR( xLCDQueue, &xMessage, &xHigherPriorityTaskWoken );\r
+\r
+ P2IFG = 0;\r
+ \r
+ /* If writing to xLCDQueue caused a task to unblock, and the unblocked task\r
+ has a priority equal to or above the task that this interrupt interrupted,\r
+ then lHigherPriorityTaskWoken will have been set to pdTRUE internally within\r
+ xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this\r
+ interrupt returns directly to the higher priority unblocked task. */\r
+ portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* The MSP430X port uses this callback function to configure its tick interrupt.\r
+This allows the application to choose the tick interrupt source.\r
+configTICK_INTERRUPT_VECTOR must also be set in FreeRTOSConfig.h to the correct\r
+interrupt vector for the chosen tick interrupt source. This implementation of\r
+vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this\r
+case configTICK_INTERRUPT_VECTOR is set to TIMER0_A0_VECTOR. */\r
+void vApplicationSetupTimerInterrupt( void )\r
+{\r
+const unsigned short usACLK_Frequency_Hz = 32768;\r
+\r
+ /* Ensure the timer is stopped. */\r
+ TA0CTL = 0;\r
+\r
+ /* Run the timer from the ACLK. */\r
+ TA0CTL = TASSEL_1;\r
+\r
+ /* Clear everything to start with. */\r
+ TA0CTL |= TACLR;\r
+\r
+ /* Set the compare match value according to the tick rate we want. */\r
+ TA0CCR0 = usACLK_Frequency_Hz / configTICK_RATE_HZ;\r
+\r
+ /* Enable the interrupts. */\r
+ TA0CCTL0 = CCIE;\r
+\r
+ /* Start up clean. */\r
+ TA0CTL |= TACLR;\r
+\r
+ /* Up mode. */\r
+ TA0CTL |= MC_1;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationIdleHook( void )\r
+{\r
+ /* Called on each iteration of the idle task. In this case the idle task\r
+ just enters a low(ish) power mode. */\r
+ __bis_SR_register( LPM1_bits + GIE );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationMallocFailedHook( void )\r
+{\r
+ /* Called if a call to pvPortMalloc() fails because there is insufficient\r
+ free memory available in the FreeRTOS heap. pvPortMalloc() is called\r
+ internally by FreeRTOS API functions that create tasks, queues or\r
+ semaphores. */\r
+ taskDISABLE_INTERRUPTS();\r
+ for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )\r
+{\r
+ ( void ) pxTask;\r
+ ( void ) pcTaskName;\r
+ \r
+ /* Run time stack overflow checking is performed if\r
+ configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook\r
+ function is called if a stack overflow is detected. */\r
+ taskDISABLE_INTERRUPTS();\r
+ for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
--- /dev/null
+/*\r
+ FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * If you are: *\r
+ * *\r
+ * + New to FreeRTOS, *\r
+ * + Wanting to learn FreeRTOS or multitasking in general quickly *\r
+ * + Looking for basic training, *\r
+ * + Wanting to improve your FreeRTOS skills and productivity *\r
+ * *\r
+ * then take a look at the FreeRTOS books - available as PDF or paperback *\r
+ * *\r
+ * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ * A pdf reference manual is also available. Both are usually delivered *\r
+ * to your inbox within 20 minutes to two hours when purchased between 8am *\r
+ * and 8pm GMT (although please allow up to 24 hours in case of *\r
+ * exceptional circumstances). Thank you for your support! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+ ***NOTE*** The exception to the GPL is included to allow you to distribute\r
+ a combined work that includes FreeRTOS without being obliged to provide the\r
+ source code for proprietary components outside of the FreeRTOS kernel.\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+ more details. You should have received a copy of the GNU General Public\r
+ License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+ can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+ by writing to Richard Barry, contact details for whom are available on the\r
+ FreeRTOS WEB site.\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
+ licensing and training services.\r
+*/\r
+\r
+\r
+/* BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER.\r
+ *\r
+ * This is not a proper UART driver. It only supports one port, uses loopback\r
+ * mode, and is used to test interrupts that use the FreeRTOS API as part of \r
+ * a wider test suite. Nor is it intended to show an efficient implementation\r
+ * of a UART interrupt service routine as queues are used to pass individual\r
+ * characters one at a time!\r
+ */\r
+\r
+/* Standard includes. */\r
+#include <stdlib.h>\r
+\r
+/* Scheduler includes. */\r
+#include "FreeRTOS.h"\r
+#include "queue.h"\r
+#include "task.h"\r
+\r
+/* Demo application includes. */\r
+#include "serial.h"\r
+\r
+/* Misc. constants. */\r
+#define serNO_BLOCK ( ( portTickType ) 0 )\r
+\r
+/* The queue used to hold received characters. */\r
+static xQueueHandle xRxedChars;\r
+\r
+/* The queue used to hold characters waiting transmission. */\r
+static xQueueHandle xCharsForTx;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )\r
+{\r
+unsigned portLONG ulBaudRateCount;\r
+\r
+ /* Initialise the hardware. */\r
+\r
+ /* Generate the baud rate constants for the wanted baud rate. */\r
+ ulBaudRateCount = configCPU_CLOCK_HZ / ulWantedBaud;\r
+\r
+ portENTER_CRITICAL();\r
+ {\r
+ /* Create the queues used by the com test task. */\r
+ xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );\r
+ xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );\r
+\r
+ /* Reset UART. */\r
+ UCA1CTL1 |= UCSWRST;\r
+\r
+ /* Use SMCLK. */\r
+ UCA1CTL1 = UCSSEL0 | UCSSEL1;\r
+ \r
+ /* Setup baud rate low byte. */\r
+ UCA1BR0 = ( unsigned portCHAR ) ( ulBaudRateCount & ( unsigned portLONG ) 0xff );\r
+\r
+ /* Setup baud rate high byte. */\r
+ ulBaudRateCount >>= 8UL;\r
+ UCA1BR1 = ( unsigned portCHAR ) ( ulBaudRateCount & ( unsigned portLONG ) 0xff );\r
+\r
+ /* UCLISTEN sets loopback mode! */\r
+ UCA1STAT = UCLISTEN;\r
+\r
+ /* Enable interrupts. */\r
+ UCA1IE |= UCRXIE;\r
+ \r
+ /* Take out of reset. */\r
+ UCA1CTL1 &= ~UCSWRST;\r
+ }\r
+ portEXIT_CRITICAL();\r
+ \r
+ /* Note the comments at the top of this file about this not being a generic\r
+ UART driver. */\r
+ return NULL;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )\r
+{\r
+ /* Get the next character from the buffer. Return false if no characters\r
+ are available, or arrive before xBlockTime expires. */\r
+ if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) )\r
+ {\r
+ return pdTRUE;\r
+ }\r
+ else\r
+ {\r
+ return pdFALSE;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )\r
+{\r
+signed portBASE_TYPE xReturn;\r
+\r
+ /* Send the next character to the queue of characters waiting transmission,\r
+ then enable the UART Tx interrupt, just in case UART transmission has already\r
+ completed and switched itself off. */\r
+ xReturn = xQueueSend( xCharsForTx, &cOutChar, xBlockTime );\r
+ UCA1IE |= UCTXIE;\r
+\r
+ return xReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#pragma vector=USCI_A1_VECTOR\r
+interrupt void prvUSCI_A0_ISR( void )\r
+{\r
+signed portCHAR cChar;\r
+portBASE_TYPE xTaskWoken = pdFALSE;\r
+portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
+\r
+ while( ( UCA1IFG & UCRXIFG ) != 0 )\r
+ {\r
+ /* Get the character from the UART and post it on the queue of Rxed\r
+ characters. */\r
+ cChar = UCA1RXBUF;\r
+ xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken );\r
+ }\r
+ \r
+ /* If there is a Tx interrupt pending and the tx interrupts are enabled. */\r
+ if( ( UCA1IFG & UCTXIFG ) != 0 )\r
+ {\r
+ /* The previous character has been transmitted. See if there are any\r
+ further characters waiting transmission. */\r
+ if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xTaskWoken ) == pdTRUE )\r
+ {\r
+ /* There was another character queued - transmit it now. */\r
+ UCA1TXBUF = cChar;\r
+ }\r
+ else\r
+ {\r
+ /* There were no other characters to transmit - disable the Tx\r
+ interrupt. */\r
+ UCA1IE &= ~UCTXIE;\r
+ }\r
+ }\r
+\r
+ __bic_SR_register_on_exit( SCG1 + SCG0 + OSCOFF + CPUOFF );\r
+ \r
+ /* If writing to a queue caused a task to unblock, and the unblocked task\r
+ has a priority equal to or above the task that this interrupt interrupted,\r
+ then lHigherPriorityTaskWoken will have been set to pdTRUE internally within\r
+ xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this\r
+ interrupt returns directly to the higher priority unblocked task. \r
+ \r
+ THIS MUST BE THE LAST THING DONE IN THE ISR. */ \r
+ portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
+}\r
+\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
+<configurations XML_version="1.2" id="configurations_0">\r
+ <configuration XML_version="1.2" id="configuration_0">\r
+ <instance XML_version="1.2" desc="TI MSP430 USB1" href="connections\TIMSP430-USB.xml" id="TI MSP430 USB1" xml="TIMSP430-USB.xml" xmlpath="connections"/>\r
+ <connection XML_version="1.2" id="TI MSP430 USB1">\r
+ <instance XML_version="1.2" href="drivers\msp430_emu.xml" id="drivers" xml="msp430_emu.xml" xmlpath="drivers"/>\r
+ <platform XML_version="1.2" id="platform_0">\r
+ <instance XML_version="1.2" desc="MSP430F5438A" href="Devices\MSP430F5438A.xml" id="MSP430F5438A" xml="MSP430F5438A.xml" xmlpath="Devices"/>\r
+ </platform>\r
+ </connection>\r
+ </configuration>\r
+</configurations>\r
--- /dev/null
+/******************************************************************************/\r
+/* lnk_msp430f5438a.cmd - LINKER COMMAND FILE FOR LINKING MSP430F5438A PROGRAMS */\r
+/* */\r
+/* Usage: lnk430 <obj files...> -o <out file> -m <map file> lnk.cmd */\r
+/* cl430 <src files...> -z -o <out file> -m <map file> lnk.cmd */\r
+/* */\r
+/*----------------------------------------------------------------------------*/\r
+/* These linker options are for command line linking only. For IDE linking, */\r
+/* you should set your linker options in Project Properties */\r
+/* -c LINK USING C CONVENTIONS */\r
+/* -stack 0x0100 SOFTWARE STACK SIZE */\r
+/* -heap 0x0100 HEAP AREA SIZE */\r
+/* */\r
+/*----------------------------------------------------------------------------*/\r
+\r
+\r
+/****************************************************************************/\r
+/* SPECIFY THE SYSTEM MEMORY MAP */\r
+/****************************************************************************/\r
+\r
+MEMORY\r
+{\r
+ SFR : origin = 0x0000, length = 0x0010\r
+ PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0\r
+ PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100\r
+ RAM : origin = 0x1C00, length = 0x4000\r
+ INFOA : origin = 0x1980, length = 0x0080\r
+ INFOB : origin = 0x1900, length = 0x0080\r
+ INFOC : origin = 0x1880, length = 0x0080\r
+ INFOD : origin = 0x1800, length = 0x0080\r
+ FLASH : origin = 0x5C00, length = 0xA380\r
+ FLASH2 : origin = 0x10000,length = 0x35C00\r
+ INT00 : origin = 0xFF80, length = 0x0002\r
+ INT01 : origin = 0xFF82, length = 0x0002\r
+ INT02 : origin = 0xFF84, length = 0x0002\r
+ INT03 : origin = 0xFF86, length = 0x0002\r
+ INT04 : origin = 0xFF88, length = 0x0002\r
+ INT05 : origin = 0xFF8A, length = 0x0002\r
+ INT06 : origin = 0xFF8C, length = 0x0002\r
+ INT07 : origin = 0xFF8E, length = 0x0002\r
+ INT08 : origin = 0xFF90, length = 0x0002\r
+ INT09 : origin = 0xFF92, length = 0x0002\r
+ INT10 : origin = 0xFF94, length = 0x0002\r
+ INT11 : origin = 0xFF96, length = 0x0002\r
+ INT12 : origin = 0xFF98, length = 0x0002\r
+ INT13 : origin = 0xFF9A, length = 0x0002\r
+ INT14 : origin = 0xFF9C, length = 0x0002\r
+ INT15 : origin = 0xFF9E, length = 0x0002\r
+ INT16 : origin = 0xFFA0, length = 0x0002\r
+ INT17 : origin = 0xFFA2, length = 0x0002\r
+ INT18 : origin = 0xFFA4, length = 0x0002\r
+ INT19 : origin = 0xFFA6, length = 0x0002\r
+ INT20 : origin = 0xFFA8, length = 0x0002\r
+ INT21 : origin = 0xFFAA, length = 0x0002\r
+ INT22 : origin = 0xFFAC, length = 0x0002\r
+ INT23 : origin = 0xFFAE, length = 0x0002\r
+ INT24 : origin = 0xFFB0, length = 0x0002\r
+ INT25 : origin = 0xFFB2, length = 0x0002\r
+ INT26 : origin = 0xFFB4, length = 0x0002\r
+ INT27 : origin = 0xFFB6, length = 0x0002\r
+ INT28 : origin = 0xFFB8, length = 0x0002\r
+ INT29 : origin = 0xFFBA, length = 0x0002\r
+ INT30 : origin = 0xFFBC, length = 0x0002\r
+ INT31 : origin = 0xFFBE, length = 0x0002\r
+ INT32 : origin = 0xFFC0, length = 0x0002\r
+ INT33 : origin = 0xFFC2, length = 0x0002\r
+ INT34 : origin = 0xFFC4, length = 0x0002\r
+ INT35 : origin = 0xFFC6, length = 0x0002\r
+ INT36 : origin = 0xFFC8, length = 0x0002\r
+ INT37 : origin = 0xFFCA, length = 0x0002\r
+ INT38 : origin = 0xFFCC, length = 0x0002\r
+ INT39 : origin = 0xFFCE, length = 0x0002\r
+ INT40 : origin = 0xFFD0, length = 0x0002\r
+ INT41 : origin = 0xFFD2, length = 0x0002\r
+ INT42 : origin = 0xFFD4, length = 0x0002\r
+ INT43 : origin = 0xFFD6, length = 0x0002\r
+ INT44 : origin = 0xFFD8, length = 0x0002\r
+ INT45 : origin = 0xFFDA, length = 0x0002\r
+ INT46 : origin = 0xFFDC, length = 0x0002\r
+ INT47 : origin = 0xFFDE, length = 0x0002\r
+ INT48 : origin = 0xFFE0, length = 0x0002\r
+ INT49 : origin = 0xFFE2, length = 0x0002\r
+ INT50 : origin = 0xFFE4, length = 0x0002\r
+ INT51 : origin = 0xFFE6, length = 0x0002\r
+ INT52 : origin = 0xFFE8, length = 0x0002\r
+ INT53 : origin = 0xFFEA, length = 0x0002\r
+ INT54 : origin = 0xFFEC, length = 0x0002\r
+ INT55 : origin = 0xFFEE, length = 0x0002\r
+ INT56 : origin = 0xFFF0, length = 0x0002\r
+ INT57 : origin = 0xFFF2, length = 0x0002\r
+ INT58 : origin = 0xFFF4, length = 0x0002\r
+ INT59 : origin = 0xFFF6, length = 0x0002\r
+ INT60 : origin = 0xFFF8, length = 0x0002\r
+ INT61 : origin = 0xFFFA, length = 0x0002\r
+ INT62 : origin = 0xFFFC, length = 0x0002\r
+ RESET : origin = 0xFFFE, length = 0x0002\r
+}\r
+\r
+/****************************************************************************/\r
+/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */\r
+/****************************************************************************/\r
+\r
+SECTIONS\r
+{\r
+ .bss : {} > RAM /* GLOBAL & STATIC VARS */\r
+ .sysmem : {} > RAM /* DYNAMIC MEMORY ALLOCATION AREA */\r
+ .stack : {} > RAM (HIGH) /* SOFTWARE SYSTEM STACK */\r
+\r
+ .text : {}>> FLASH | FLASH2 /* CODE */\r
+ .text:_isr : {} > FLASH /* ISR CODE SPACE */\r
+ .cinit : {} > FLASH /* INITIALIZATION TABLES */\r
+//#ifdef (__LARGE_DATA_MODEL__)\r
+ .const : {} > FLASH | FLASH2 /* CONSTANT DATA */\r
+//#else\r
+// .const : {} > FLASH /* CONSTANT DATA */\r
+//#endif\r
+ .cio : {} > RAM /* C I/O BUFFER */\r
+\r
+ .pinit : {} > FLASH /* C++ CONSTRUCTOR TABLES */\r
+\r
+ .infoA : {} > INFOA /* MSP430 INFO FLASH MEMORY SEGMENTS */\r
+ .infoB : {} > INFOB\r
+ .infoC : {} > INFOC\r
+ .infoD : {} > INFOD\r
+\r
+ .int00 : {} > INT00 /* MSP430 INTERRUPT VECTORS */\r
+ .int01 : {} > INT01\r
+ .int02 : {} > INT02\r
+ .int03 : {} > INT03\r
+ .int04 : {} > INT04\r
+ .int05 : {} > INT05\r
+ .int06 : {} > INT06\r
+ .int07 : {} > INT07\r
+ .int08 : {} > INT08\r
+ .int09 : {} > INT09\r
+ .int10 : {} > INT10\r
+ .int11 : {} > INT11\r
+ .int12 : {} > INT12\r
+ .int13 : {} > INT13\r
+ .int14 : {} > INT14\r
+ .int15 : {} > INT15\r
+ .int16 : {} > INT16\r
+ .int17 : {} > INT17\r
+ .int18 : {} > INT18\r
+ .int19 : {} > INT19\r
+ .int20 : {} > INT20\r
+ .int21 : {} > INT21\r
+ .int22 : {} > INT22\r
+ .int23 : {} > INT23\r
+ .int24 : {} > INT24\r
+ .int25 : {} > INT25\r
+ .int26 : {} > INT26\r
+ .int27 : {} > INT27\r
+ .int28 : {} > INT28\r
+ .int29 : {} > INT29\r
+ .int30 : {} > INT30\r
+ .int31 : {} > INT31\r
+ .int32 : {} > INT32\r
+ .int33 : {} > INT33\r
+ .int34 : {} > INT34\r
+ .int35 : {} > INT35\r
+ .int36 : {} > INT36\r
+ .int37 : {} > INT37\r
+ .int38 : {} > INT38\r
+ .int39 : {} > INT39\r
+ .int40 : {} > INT40\r
+ .int41 : {} > INT41\r
+ .int42 : {} > INT42\r
+ .int43 : {} > INT43\r
+ .int44 : {} > INT44\r
+ .int45 : {} > INT45\r
+ .int46 : {} > INT46\r
+ .int47 : {} > INT47\r
+ .int48 : {} > INT48\r
+ .int49 : {} > INT49\r
+ .int50 : {} > INT50\r
+ .int51 : {} > INT51\r
+ .int52 : {} > INT52\r
+ .int53 : {} > INT53\r
+ .int54 : {} > INT54\r
+ .int55 : {} > INT55\r
+ .int56 : {} > INT56\r
+ .int57 : {} > INT57\r
+ .int58 : {} > INT58\r
+ .int59 : {} > INT59\r
+ .int60 : {} > INT60\r
+ .int61 : {} > INT61\r
+ .int62 : {} > INT62\r
+ .reset : {} > RESET /* MSP430 RESET VECTOR */ \r
+}\r
+\r
+/****************************************************************************/\r
+/* INCLUDE PERIPHERALS MEMORY MAP */\r
+/****************************************************************************/\r
+\r
+-l msp430f5438a.cmd\r
+\r