chore![CCS-Setup]: Initial Commit

This commit is contained in:
Frederik Beimgraben 2025-05-21 14:16:03 +02:00
commit 470cf77cac
38 changed files with 8935 additions and 0 deletions

14
.ccsproject Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?ccsproject version="1.0"?>
<projectOptions>
<ccsVariant value="50:Theia-based"/>
<ccsVersion value="70.1.0"/>
<deviceFamily value="MSP430"/>
<executableActions value=""/>
<createSlaveProjects value=""/>
<templateProperties value="id=msp430fr2355_gc_simple_json.projectspec.ESR-G11"/>
<connection value="common/targetdb/connections/TIMSP430-USB.xml"/>
<activeTargetConfiguration value="targetConfigs/MSP430FR2355.ccxml"/>
<origin value="/home/frederik/ti/msp430ware_3_80_14_01/gui_composer/examples/MSP-EXP430FR2355/streaming/gc_simple_json/ccs/msp430fr2355_gc_simple_json.projectspec"/>
<filesToOpen value=""/>
</projectOptions>

11
.clangd Normal file
View File

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

193
.cproject Normal file
View File

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1480263499">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1480263499" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="com.ti.ccs.project.ErrorParser"/>
<extension id="com.ti.ccs.errorparser.CompilerErrorParser_TI" point="com.ti.ccs.project.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1480263499" name="Debug" parent="com.ti.ccstudio.buildDefinitions.MSP430.Debug">
<folderInfo id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.1480263499." name="/" resourcePath="">
<toolChain id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.DebugToolchain.467192015" name="TI Build Tools" secondaryOutputs="" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.linkerDebug.1015511133">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1780803083" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
<listOptionValue value="DEVICE_CONFIGURATION_ID=MSP430FR2355"/>
<listOptionValue value="DEVICE_CORE_ID="/>
<listOptionValue value="DEVICE_ENDIANNESS=little"/>
<listOptionValue value="OUTPUT_FORMAT=ELF"/>
<listOptionValue value="CCS_MBS_VERSION=70.0.0"/>
<listOptionValue value="LINKER_COMMAND_FILE=lnk_msp430fr2355.cmd"/>
<listOptionValue value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
<listOptionValue value="OUTPUT_TYPE=executable"/>
<listOptionValue value="PRODUCTS="/>
<listOptionValue value="PRODUCT_MACRO_IMPORTS={}"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.1629037805" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="21.6.1.LTS" valueType="string"/>
<targetPlatform id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.targetPlatformDebug.1138407171" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.targetPlatformDebug"/>
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.builderDebug.1781188217" name="GNU Make.Debug" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.builderDebug"/>
<tool id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.compilerDebug.878730430" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.compilerDebug">
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DEFINE.1352210013" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DEFINE" valueType="definedSymbols">
<listOptionValue value="__MSP430FR2355__"/>
<listOptionValue value="_FRWP_ENABLE"/>
<listOptionValue value="_INFO_FRWP_ENABLE"/>
<listOptionValue value="__ENABLE_GUI_COMM=1"/>
<listOptionValue value="GLOBAL_Q=8"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.ADVICE__HW_CONFIG.232293091" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.ADVICE__HW_CONFIG" value="all" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.USE_HW_MPY.1457847178" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.USE_HW_MPY" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.USE_HW_MPY.F5" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_ERRATA.CPU21.798980990" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_ERRATA.CPU21" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_ERRATA.CPU22.614520606" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_ERRATA.CPU22" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_ERRATA.CPU40.629948855" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_ERRATA.CPU40" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_VERSION.1753808681" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_VERSION.mspx" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.PRINTF_SUPPORT.867515559" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.PRINTF_SUPPORT" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.PRINTF_SUPPORT.minimal" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DEBUGGING_MODEL.880222093" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DISPLAY_ERROR_NUMBER.1426235308" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DIAG_WARNING.1011711137" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DIAG_WARNING" valueType="stringList">
<listOptionValue value="225"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DIAG_WRAP.448527988" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.INCLUDE_PATH.1838477623" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.INCLUDE_PATH" valueType="includePath">
<listOptionValue value="${CCS_BASE_ROOT}/msp430/include"/>
<listOptionValue value="${PROJECT_ROOT}"/>
<listOptionValue value="${PROJECT_ROOT}/include"/>
<listOptionValue value="${CG_TOOL_ROOT}/include"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.ADVICE__POWER.1569099587" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.ADVICE__POWER" value="&quot;none&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.OPT_LEVEL.1586547975" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.OPT_LEVEL.3" valueType="enumerated"/>
</tool>
<tool id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.linkerDebug.1015511133" name="MSP430 Linker" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.linkerDebug">
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.DEFINE.979065961" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.DEFINE" valueType="definedSymbols">
<listOptionValue value="_FRWP_ENABLE"/>
<listOptionValue value="_INFO_FRWP_ENABLE"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.SEARCH_PATH.1136092355" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.SEARCH_PATH" valueType="libPaths">
<listOptionValue value="${CCS_BASE_ROOT}/msp430/include"/>
<listOptionValue value="${CCS_BASE_ROOT}/msp430/lib/FR2xx"/>
<listOptionValue value="${CG_TOOL_ROOT}/lib"/>
<listOptionValue value="${CG_TOOL_ROOT}/include"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.LIBRARY.1990402480" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.LIBRARY" valueType="libs">
<listOptionValue value="frwp_init.a"/>
<listOptionValue value="libc.a"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.PRIORITY.771275885" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.PRIORITY" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.USE_HW_MPY.1280113593" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.USE_HW_MPY" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.USE_HW_MPY.F5" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.CINIT_HOLD_WDT.289218043" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.CINIT_HOLD_WDT" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.CINIT_HOLD_WDT.on" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.HEAP_SIZE.1314825622" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.HEAP_SIZE" value="160" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.STACK_SIZE.1251545260" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.STACK_SIZE" value="160" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.OUTPUT_FILE.1592714132" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.OUTPUT_FILE" value="${ProjName}.out" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.MAP_FILE.88122810" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.MAP_FILE" value="${ProjName}.map" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.XML_LINK_INFO.1593346489" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.XML_LINK_INFO" value="${ProjName}_linkInfo.xml" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.DISPLAY_ERROR_NUMBER.1690650503" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.DIAG_WRAP.1978929899" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
</tool>
<tool id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.hex.1332494119" name="MSP430 Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.hex">
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.hex.ROMWIDTH.1403553952" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.hex.ROMWIDTH" value="8" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.hex.MEMWIDTH.330241156" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.hex.MEMWIDTH" value="8" valueType="string"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="com.ti.ccstudio.buildDefinitions.MSP430.Release.760058067">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.MSP430.Release.760058067" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="com.ti.ccs.project.ErrorParser"/>
<extension id="com.ti.ccs.errorparser.CompilerErrorParser_TI" point="com.ti.ccs.project.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.MSP430.Release.760058067" name="Release" parent="com.ti.ccstudio.buildDefinitions.MSP430.Release">
<folderInfo id="com.ti.ccstudio.buildDefinitions.MSP430.Release.760058067." name="/" resourcePath="">
<toolChain id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.ReleaseToolchain.405235695" name="TI Build Tools" secondaryOutputs="" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.ReleaseToolchain" targetTool="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.linkerRelease.310641534">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.330494645" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
<listOptionValue value="DEVICE_CONFIGURATION_ID=MSP430FR2355"/>
<listOptionValue value="DEVICE_CORE_ID="/>
<listOptionValue value="DEVICE_ENDIANNESS=little"/>
<listOptionValue value="OUTPUT_FORMAT=ELF"/>
<listOptionValue value="CCS_MBS_VERSION=70.0.0"/>
<listOptionValue value="LINKER_COMMAND_FILE=lnk_msp430fr2355.cmd"/>
<listOptionValue value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
<listOptionValue value="OUTPUT_TYPE=executable"/>
<listOptionValue value="PRODUCTS="/>
<listOptionValue value="PRODUCT_MACRO_IMPORTS={}"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.999182012" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="21.6.1.LTS" valueType="string"/>
<targetPlatform id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.targetPlatformRelease.1678616706" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.targetPlatformRelease"/>
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.builderRelease.287496526" name="GNU Make.Release" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.builderRelease"/>
<tool id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.compilerRelease.51846830" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.compilerRelease">
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DEFINE.1715313629" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DEFINE" valueType="definedSymbols">
<listOptionValue value="__MSP430FR2355__"/>
<listOptionValue value="_FRWP_ENABLE"/>
<listOptionValue value="_INFO_FRWP_ENABLE"/>
<listOptionValue value="__ENABLE_GUI_COMM=1"/>
<listOptionValue value="GLOBAL_Q=8"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.ADVICE__HW_CONFIG.64691209" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.ADVICE__HW_CONFIG" value="all" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.USE_HW_MPY.640057486" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.USE_HW_MPY" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.USE_HW_MPY.F5" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_ERRATA.CPU21.1573738411" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_ERRATA.CPU21" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_ERRATA.CPU22.1777112603" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_ERRATA.CPU22" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_ERRATA.CPU40.1407412877" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_ERRATA.CPU40" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_VERSION.174481978" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.SILICON_VERSION.mspx" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.PRINTF_SUPPORT.330557881" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.PRINTF_SUPPORT" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.PRINTF_SUPPORT.minimal" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DISPLAY_ERROR_NUMBER.1058480034" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DIAG_WARNING.251633234" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DIAG_WARNING" valueType="stringList">
<listOptionValue value="225"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DIAG_WRAP.942936066" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.INCLUDE_PATH.1164889098" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.INCLUDE_PATH" valueType="includePath">
<listOptionValue value="${CCS_BASE_ROOT}/msp430/include"/>
<listOptionValue value="${PROJECT_ROOT}"/>
<listOptionValue value="${PROJECT_ROOT}/include"/>
<listOptionValue value="${CG_TOOL_ROOT}/include"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.ADVICE__POWER.961778537" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.ADVICE__POWER" value="&quot;none&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.OPT_LEVEL.release.986686389" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.OPT_LEVEL.release" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.OPT_LEVEL.3" valueType="enumerated"/>
</tool>
<tool id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.linkerRelease.310641534" name="MSP430 Linker" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.exe.linkerRelease">
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.DEFINE.800571145" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.DEFINE" valueType="definedSymbols">
<listOptionValue value="_FRWP_ENABLE"/>
<listOptionValue value="_INFO_FRWP_ENABLE"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.SEARCH_PATH.903712628" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.SEARCH_PATH" valueType="libPaths">
<listOptionValue value="${CCS_BASE_ROOT}/msp430/include"/>
<listOptionValue value="${CCS_BASE_ROOT}/msp430/lib/FR2xx"/>
<listOptionValue value="${CG_TOOL_ROOT}/lib"/>
<listOptionValue value="${CG_TOOL_ROOT}/include"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.LIBRARY.680243105" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.LIBRARY" valueType="libs">
<listOptionValue value="frwp_init.a"/>
<listOptionValue value="libc.a"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.PRIORITY.119201875" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.PRIORITY" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.USE_HW_MPY.1981263533" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.USE_HW_MPY" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.USE_HW_MPY.F5" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.CINIT_HOLD_WDT.1873920785" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.CINIT_HOLD_WDT" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.CINIT_HOLD_WDT.on" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.HEAP_SIZE.1072034688" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.HEAP_SIZE" value="160" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.STACK_SIZE.863631348" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.STACK_SIZE" value="160" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.OUTPUT_FILE.1557747214" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.OUTPUT_FILE" value="${ProjName}.out" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.MAP_FILE.1681793265" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.MAP_FILE" value="${ProjName}.map" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.XML_LINK_INFO.1347102027" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.XML_LINK_INFO" value="${ProjName}_linkInfo.xml" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.DISPLAY_ERROR_NUMBER.547394723" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.DIAG_WRAP.2002953940" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
</tool>
<tool id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.hex.810927938" name="MSP430 Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.hex">
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.hex.ROMWIDTH.288105213" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.hex.ROMWIDTH" value="8" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.hex.MEMWIDTH.767444476" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.hex.MEMWIDTH" value="8" valueType="string"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="ESR-G11.com.ti.ccstudio.buildDefinitions.MSP430.ProjectType.1034979954" name="MSP430" projectType="com.ti.ccstudio.buildDefinitions.MSP430.ProjectType"/>
</storageModule>
</cproject>

20
.project Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ESR-G11</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.ti.ccstudio.core.ccsNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
</natures>
</projectDescription>

View File

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

View File

@ -0,0 +1,47 @@
[
{
"directory" : "/home/frederik/workspace_ccstheia/ESR-G11/Debug",
"command" : "clang++ -I\"/home/frederik/.ti/ccs2010/ccs/ccs_base/msp430/include\" -I\"/home/frederik/workspace_ccstheia/ESR-G11\" -I\"/home/frederik/workspace_ccstheia/ESR-G11/include\" -I\"/home/frederik/.ti/ccs2010/ccs/tools/compiler/ti-cgt-msp430_21.6.1.LTS/include\" -D__MSP430FR2355__ -D_FRWP_ENABLE -D_INFO_FRWP_ENABLE -D__ENABLE_GUI_COMM=1 -DGLOBAL_Q=8",
"file" : "/home/frederik/workspace_ccstheia/ESR-G11/GUIComm_JSON.c"
},
{
"directory" : "/home/frederik/workspace_ccstheia/ESR-G11/Debug",
"command" : "clang++ -I\"/home/frederik/.ti/ccs2010/ccs/ccs_base/msp430/include\" -I\"/home/frederik/workspace_ccstheia/ESR-G11\" -I\"/home/frederik/workspace_ccstheia/ESR-G11/include\" -I\"/home/frederik/.ti/ccs2010/ccs/tools/compiler/ti-cgt-msp430_21.6.1.LTS/include\" -D__MSP430FR2355__ -D_FRWP_ENABLE -D_INFO_FRWP_ENABLE -D__ENABLE_GUI_COMM=1 -DGLOBAL_Q=8",
"file" : "/home/frederik/workspace_ccstheia/ESR-G11/callbacks_JSON.c"
},
{
"directory" : "/home/frederik/workspace_ccstheia/ESR-G11/Debug",
"command" : "clang++ -I\"/home/frederik/.ti/ccs2010/ccs/ccs_base/msp430/include\" -I\"/home/frederik/workspace_ccstheia/ESR-G11\" -I\"/home/frederik/workspace_ccstheia/ESR-G11/include\" -I\"/home/frederik/.ti/ccs2010/ccs/tools/compiler/ti-cgt-msp430_21.6.1.LTS/include\" -D__MSP430FR2355__ -D_FRWP_ENABLE -D_INFO_FRWP_ENABLE -D__ENABLE_GUI_COMM=1 -DGLOBAL_Q=8",
"file" : "/home/frederik/workspace_ccstheia/ESR-G11/main.c"
},
{
"directory" : "/home/frederik/workspace_ccstheia/ESR-G11/Debug",
"command" : "clang++ -I\"/home/frederik/.ti/ccs2010/ccs/ccs_base/msp430/include\" -I\"/home/frederik/workspace_ccstheia/ESR-G11\" -I\"/home/frederik/workspace_ccstheia/ESR-G11/include\" -I\"/home/frederik/.ti/ccs2010/ccs/tools/compiler/ti-cgt-msp430_21.6.1.LTS/include\" -D__MSP430FR2355__ -D_FRWP_ENABLE -D_INFO_FRWP_ENABLE -D__ENABLE_GUI_COMM=1 -DGLOBAL_Q=8",
"file" : "/home/frederik/workspace_ccstheia/ESR-G11/src/MSP430_GUI/GUI_JSON.c"
},
{
"directory" : "/home/frederik/workspace_ccstheia/ESR-G11/Debug",
"command" : "clang++ -I\"/home/frederik/.ti/ccs2010/ccs/ccs_base/msp430/include\" -I\"/home/frederik/workspace_ccstheia/ESR-G11\" -I\"/home/frederik/workspace_ccstheia/ESR-G11/include\" -I\"/home/frederik/.ti/ccs2010/ccs/tools/compiler/ti-cgt-msp430_21.6.1.LTS/include\" -D__MSP430FR2355__ -D_FRWP_ENABLE -D_INFO_FRWP_ENABLE -D__ENABLE_GUI_COMM=1 -DGLOBAL_Q=8",
"file" : "/home/frederik/workspace_ccstheia/ESR-G11/src/MSP430_GUI/jsmn/jsmn.c"
},
{
"directory" : "/home/frederik/workspace_ccstheia/ESR-G11/Debug",
"command" : "clang++ -I\"/home/frederik/.ti/ccs2010/ccs/ccs_base/msp430/include\" -I\"/home/frederik/workspace_ccstheia/ESR-G11\" -I\"/home/frederik/workspace_ccstheia/ESR-G11/include\" -I\"/home/frederik/.ti/ccs2010/ccs/tools/compiler/ti-cgt-msp430_21.6.1.LTS/include\" -D__MSP430FR2355__ -D_FRWP_ENABLE -D_INFO_FRWP_ENABLE -D__ENABLE_GUI_COMM=1 -DGLOBAL_Q=8",
"file" : "/home/frederik/workspace_ccstheia/ESR-G11/src/MSP430_HAL/HAL_GUIComm_UART_FR235x.c"
},
{
"directory" : "/home/frederik/workspace_ccstheia/ESR-G11/Debug",
"command" : "clang++ -I\"/home/frederik/.ti/ccs2010/ccs/ccs_base/msp430/include\" -I\"/home/frederik/workspace_ccstheia/ESR-G11\" -I\"/home/frederik/workspace_ccstheia/ESR-G11/include\" -I\"/home/frederik/.ti/ccs2010/ccs/tools/compiler/ti-cgt-msp430_21.6.1.LTS/include\" -D__MSP430FR2355__ -D_FRWP_ENABLE -D_INFO_FRWP_ENABLE -D__ENABLE_GUI_COMM=1 -DGLOBAL_Q=8",
"file" : "/home/frederik/workspace_ccstheia/ESR-G11/src/MSP430_HAL/HAL_IO_FR235x.c"
},
{
"directory" : "/home/frederik/workspace_ccstheia/ESR-G11/Debug",
"command" : "clang++ -I\"/home/frederik/.ti/ccs2010/ccs/ccs_base/msp430/include\" -I\"/home/frederik/workspace_ccstheia/ESR-G11\" -I\"/home/frederik/workspace_ccstheia/ESR-G11/include\" -I\"/home/frederik/.ti/ccs2010/ccs/tools/compiler/ti-cgt-msp430_21.6.1.LTS/include\" -D__MSP430FR2355__ -D_FRWP_ENABLE -D_INFO_FRWP_ENABLE -D__ENABLE_GUI_COMM=1 -DGLOBAL_Q=8",
"file" : "/home/frederik/workspace_ccstheia/ESR-G11/src/MSP430_HAL/HAL_System_FR235x.c"
},
{
"directory" : "/home/frederik/workspace_ccstheia/ESR-G11/Debug",
"command" : "clang++ -I\"/home/frederik/.ti/ccs2010/ccs/ccs_base/msp430/include\" -I\"/home/frederik/workspace_ccstheia/ESR-G11\" -I\"/home/frederik/workspace_ccstheia/ESR-G11/include\" -I\"/home/frederik/.ti/ccs2010/ccs/tools/compiler/ti-cgt-msp430_21.6.1.LTS/include\" -D__MSP430FR2355__ -D_FRWP_ENABLE -D_INFO_FRWP_ENABLE -D__ENABLE_GUI_COMM=1 -DGLOBAL_Q=8",
"file" : "/home/frederik/workspace_ccstheia/ESR-G11/src/MSP430_HAL/HAL_Timer_FR235x.c"
}
]

277
GUIComm_JSON.c Executable file
View File

@ -0,0 +1,277 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2020, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
// GUI Communication Layer
//
// API to communicate with GUI using JSON protocol
// Texas Instruments, Inc.**
#include <msp430.h>
#include <stdbool.h>
#include <stdint.h>
#include <HAL.h>
#include <GUI_JSON.h>
#include <include/GUIComm.h>
static void itoa(int32_t value, char* result);
static const char cmdTemplate[] = "{\"\":}\n";
static char cATXString[20];
//These values are used to concatenate the command and data to the command template
// when using the GUIComm_send functions
#define CMD_INDEX 1
#define DATA_INDEX 3
#define CMD_TEMPLATE_LENGTH 6
#define BASE 10
//! \brief Converts a number into a string
//!
//! \return none
void itoa(int32_t value, char* result)
{
char* ptr = result, *ptr1 = result, tmp_char;
uint32_t tmp_value;
tmp_value = labs(value);
do {
*ptr++ = "0123456789" [tmp_value%BASE];
tmp_value /= BASE;
} while (tmp_value);
// Apply negative sign
if (value < 0) *ptr++ = '-';
*ptr-- = '\0';
while(ptr1 < ptr) {
tmp_char = *ptr;
*ptr--= *ptr1;
*ptr1++ = tmp_char;
}
}
int GUIComm_sendUInt(char *cmd, uint8_t cmdLength, uint32_t val)
{
uint8_t i;
for (i = 0; i < CMD_TEMPLATE_LENGTH; i++)
{
HAL_GUI_TransmitCharBlocking(cmdTemplate[i]);
if (i == CMD_INDEX)
{
GUI_TransmitStringBlocking(cmd);
}
else if (i == DATA_INDEX)
{
itoa(val, cATXString);
GUI_TransmitStringBlocking(cATXString);
}
}
return 0;
}
int GUIComm_sendInt(char *cmd, uint8_t cmdLength, uint32_t val)
{
uint8_t i;
for (i = 0; i < CMD_TEMPLATE_LENGTH; i++)
{
HAL_GUI_TransmitCharBlocking(cmdTemplate[i]);
if (i == CMD_INDEX)
{
GUI_TransmitStringBlocking(cmd);
}
else if (i == DATA_INDEX)
{
itoa(val, cATXString);
GUI_TransmitStringBlocking(cATXString);
}
}
return 0;
}
int GUIComm_sendUInt8(char *cmd, uint8_t cmdLength, uint8_t val)
{
uint8_t i;
for (i = 0; i < CMD_TEMPLATE_LENGTH; i++)
{
HAL_GUI_TransmitCharBlocking(cmdTemplate[i]);
if (i == CMD_INDEX)
{
GUI_TransmitStringBlocking(cmd);
}
else if (i == DATA_INDEX)
{
itoa(val, cATXString);
GUI_TransmitStringBlocking(cATXString);
}
}
return 0;
}
int GUIComm_sendInt8(char *cmd, uint8_t cmdLength, int8_t val)
{
uint8_t i;
for (i = 0; i < CMD_TEMPLATE_LENGTH; i++)
{
HAL_GUI_TransmitCharBlocking(cmdTemplate[i]);
if (i == CMD_INDEX)
{
GUI_TransmitStringBlocking(cmd);
}
else if (i == DATA_INDEX)
{
itoa(val, cATXString);
GUI_TransmitStringBlocking(cATXString);
}
}
return 0;
}
int GUIComm_sendInt16(char *cmd, uint8_t cmdLength, int16_t val)
{
uint8_t i;
for (i = 0; i < CMD_TEMPLATE_LENGTH; i++)
{
HAL_GUI_TransmitCharBlocking(cmdTemplate[i]);
if (i == CMD_INDEX)
{
GUI_TransmitStringBlocking(cmd);
}
else if (i == DATA_INDEX)
{
itoa(val, cATXString);
GUI_TransmitStringBlocking(cATXString);
}
}
return 0;
}
int GUIComm_sendUInt16(char *cmd, uint8_t cmdLength, uint16_t val)
{
uint8_t i;
for (i = 0; i < CMD_TEMPLATE_LENGTH; i++)
{
HAL_GUI_TransmitCharBlocking(cmdTemplate[i]);
if (i == CMD_INDEX)
{
GUI_TransmitStringBlocking(cmd);
}
else if (i == DATA_INDEX)
{
itoa(val, cATXString);
GUI_TransmitStringBlocking(cATXString);
}
}
return 0;
}
int GUIComm_sendUInt32(char *cmd, uint8_t cmdLength, uint32_t val)
{
uint8_t i;
for (i = 0; i < CMD_TEMPLATE_LENGTH; i++)
{
HAL_GUI_TransmitCharBlocking(cmdTemplate[i]);
if (i == CMD_INDEX)
{
GUI_TransmitStringBlocking(cmd);
}
else if (i == DATA_INDEX)
{
itoa(val, cATXString);
GUI_TransmitStringBlocking(cATXString);
}
}
return 0;
}
int GUIComm_sendInt32(char *cmd, uint8_t cmdLength, int32_t val)
{
uint8_t i;
for (i = 0; i < CMD_TEMPLATE_LENGTH; i++)
{
HAL_GUI_TransmitCharBlocking(cmdTemplate[i]);
if (i == CMD_INDEX)
{
GUI_TransmitStringBlocking(cmd);
}
else if (i == DATA_INDEX)
{
itoa(val, cATXString);
GUI_TransmitStringBlocking(cATXString);
}
}
return 0;
}
int GUIComm_sendBool(char *cmd, uint8_t cmdLength, bool val)
{
uint16_t i;
for (i = 0; i < CMD_TEMPLATE_LENGTH; i++)
{
HAL_GUI_TransmitCharBlocking(cmdTemplate[i]);
if (i == CMD_INDEX)
{
GUI_TransmitStringBlocking(cmd);
}
else if (i == DATA_INDEX)
{
if (val == true)
{
GUI_TransmitStringBlocking("true");
}
else
{
GUI_TransmitStringBlocking("false");
}
}
}
return 0;
}

101
Include/GUIComm.h Executable file
View File

@ -0,0 +1,101 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2020, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
// Generic GUI Demo using MSP430
//
// API to communicate with GUI and abstract transport layer protocol
// Texas Instruments, Inc.
// ******************************************************************************
#ifndef INCLUDE_GUICOMM_H_
#define INCLUDE_GUICOMM_H_
//! ***** Functions to send data to GUI *****
//! \brief Sends a 32-bit integer.
//!
//! \return 0 if success, -1 if failure
extern int GUIComm_sendInt(char *cmd, uint8_t cmdLength, uint32_t val);
//! \brief Sends a 32-bit unsigned integer.
//!
//! \return 0 if success, -1 if failure
extern int GUIComm_sendUInt(char *cmd, uint8_t cmdLength, uint32_t val);
//! \brief Sends an uint8_t value to the GUI.
//!
//! \return 0 if success, -1 if failure
extern int GUIComm_sendUInt8(char *cmd, uint8_t cmdLength, uint8_t val);
//! \brief Sends an int8_t value to the GUI.
//!
//! \return 0 if success, -1 if failure
extern int GUIComm_sendInt8(char *cmd, uint8_t cmdLength, int8_t val);
//! \brief Sends an uint16_t value to the GUI.
//!
//! \return 0 if success, -1 if failure
extern int GUIComm_sendUInt16(char *cmd, uint8_t cmdLength, uint16_t val);
//! \brief Sends an int16_t value to the GUI.
//!
//! \return 0 if success, -1 if failure
extern int GUIComm_sendInt16(char *cmd, uint8_t cmdLength, int16_t val);
//! \brief Sends an uint32_t value to the GUI.
//!
//! \return 0 if success, -1 if failure
extern int GUIComm_sendUInt32(char *cmd, uint8_t cmdLength, uint32_t val);
//! \brief Sends an int32_t value to the GUI.
//!
//! \return 0 if success, -1 if failure
extern int GUIComm_sendInt32(char *cmd, uint8_t cmdLength, int32_t val);
//! \brief Sends an uint32_t value to the GUI.
//!
//! \return 0 if success, -1 if failure
extern int GUIComm_sendUInt64(char *cmd, uint8_t cmdLength, uint64_t val);
//! \brief Sends an int32_t value to the GUI.
//!
//! \return 0 if success, -1 if failure
extern int GUIComm_sendInt64(char *cmd, uint8_t cmdLength, int64_t val);
//! \brief Sends a bool value to the GUI.
//!
//! \return 0 if success, -1 if failure
extern int GUIComm_sendBool(char *cmd, uint8_t cmdLength, bool val);
#endif /* INCLUDE_GUICOMM_H_ */

101
Include/HAL.h Executable file
View File

@ -0,0 +1,101 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2019, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
// MSP430 HAL
//
// Hardware Abstraction Layer for MSP430
//
// Texas Instruments, Inc.
#ifndef __HAL_H__
#define __HAL_H__
#include <msp430.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <Config_Common.h>
//! \brief GUI Comm RX Callback function pointer
//!
//! \param[in] char with Received byte
//!
//! \return true if device wakes-up after ISR, false if not.
typedef bool (*tGUICommRXCharCallback)(char );
// ********************* System ************************************************
//! \brief Initializes I/Os used by the system.
//! Initialization is done to achieve lowest power consumption.
//!
//!
//! \return 0 if OK, -1 if error
extern int8_t HAL_System_Init(void);
// ********************* I/O ***************************************************
//! \brief Initializes I/Os used by the system.
//! Initialization is done to achieve lowest power consumption.
//!
//!
//! \return none
extern void HAL_IO_Init(void);
//! \brief Initializes inputs used for push-buttons
//! Pins are initialized with pull-ups and interrupts are enabled.
//!
//!
//! \return none
extern void HAL_IO_InitButtons(void);
// ********************* Timer ***************************************************
//! \brief Initializes a simple periodic interrupt timer.
//! Timer is initialized using Low-frequency clock and interrupts
//! are enabled.
//!
//! \return none
extern void HAL_Timer_Init(void);
// ********************* GUI Communication *************************************
//! \brief Initializes the communication interface for GUI.
//!
//! \param[in] RxByteCallback is the function called when a byte is received.
//!
//! \return none
extern void HAL_GUI_Init(tGUICommRXCharCallback RxByteCallback);
//! \brief Transmits a character to the GUI in blocking mode.
//!
//! \param[in] character is the character being transmitted to GUI.
//!
//! \return none
extern void HAL_GUI_TransmitCharBlocking(char character);
#endif //__HAL_H__

3967
Include/IQmathLib.h Executable file

File diff suppressed because it is too large Load Diff

2100
Include/QmathLib.h Executable file

File diff suppressed because it is too large Load Diff

107
README.html Executable file

File diff suppressed because one or more lines are too long

64
callbacks_JSON.c Executable file
View File

@ -0,0 +1,64 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2020, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
// callbacks_JSON.c
//
// Application level callbacks using JSON
// Texas Instruments, Inc.
#include <callbacks_JSON.h>
static bool getBoolFromString(char * string);
// ***** Application Callback Functions to Process data *****
void GUICallback_boolEnable(char * string)
{
// Example to receive a boolean
bEnableSwitch = getBoolFromString(string);
}
void GUICallback_QMathData(char * string)
{
qIncrement = strtol(string, NULL, 10);
}
static bool getBoolFromString(char * string)
{
if (strncmp(string, "true", 4) == 0)
{
return true;
}
else
{
return false;
}
}

71
include/Config_Common.h Executable file
View File

@ -0,0 +1,71 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2019, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
// Config_Common.h
//
// Configuration definitions
// Texas Instruments, Inc.
#ifndef __CONFIG_COMMON_H__
#define __CONFIG_COMMON_H__
#include <msp430.h>
#include <stdint.h>
#include <stdbool.h>
#if defined(__TI_COMPILER_VERSION__)
#define __persistent
#define __no_init
#elif defined (__IAR_SYSTEMS_ICC__)
#else
#error Compiler not supported!
#endif
//! \brief CPU Active Frequency in Hz.
//!
#define CPU_FREQ_HZ (8000000)
//! \brief CPU Active Frequency in MHz.
//!
#define CPU_FREQ_MHZ (CPU_FREQ_HZ/1000000)
//! \brief High Speed Bus Frequency in Hz.
//! Used by High Speed peripherals such as UART.
//!
#define HSBUS_FREQ_HZ (8000000)
//! \brief High Speed Bus Frequency in MHz.
//! Used by High Speed peripherals such as UART.
//!
#define HSBUS_FREQ_MHZ (HSBUS_FREQ_HZ/1000000)
//! \brief Low Speed Bus Frequency in Hz.
//! Used by Low Speed peripherals such as LPM timers.
//!
#define LSBUS_FREQ_HZ (32768)
#endif //__CONFIG_COMMON_H__

112
include/GUI_JSON.h Executable file
View File

@ -0,0 +1,112 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2019, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
// GUI Interface
//
// API to send and receive data from GUI using GUI Composer
// Texas Instruments, Inc.
// ******************************************************************************
#ifndef __GUI_H__
#define __GUI_H__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
//! \brief Maximum string for RX
#ifndef MAX_STR_LEN
#define MAX_STR_LEN 64
#endif
//! \brief Enable GUI Reception of commands
#define GUI_RXCMD_ENABLE (1)
#if (GUI_RXCMD_ENABLE)
//! \brief Callback for RX Commands (called when command is received from GUI)
typedef void (*tGUI_RxCmdCallback)(char *);
//! \brief Structure for RX commands.
typedef struct
{
//!< RX Command (received from GUI)
char *stringCMD;
//!< Function executed if command is detected.
tGUI_RxCmdCallback callback;
} tGUI_RxCmd;
#endif
//! \brief Structure for TX commands.
typedef struct
{
//!< TX Command including sprintf formatting.
char *formattingStringCMD;
//!< Parameter sent with TX command.
void **param;
} tGUI_TxCmd;
//! \brief Initializes the GUI communication and protocol.
//!
//! \return none
extern void GUI_Init(void);
#if (GUI_RXCMD_ENABLE)
//! \brief Initializes structure to receive and process commands
//!
//! \param[in] RxCmdArray is a pointer to the array of RX Commands.
//! These commands will execute a callback function when received.
//! \param[in] size is the size of RxCmdArray.
//!
//! \return none
extern void GUI_InitRxCmd(const tGUI_RxCmd *RxCmdArray,
uint16_t size);
#endif
//! \brief Transmits an array of TX commands.
//!
//! \param[in] TXACmdrray is a pointer to the array of TX commands.
//! These commands will be sent with corresponding formatted data.
//! \param[in] size is the size of TxCmdArray.
//!
//! \return none
extern void GUI_TransmitData(const tGUI_TxCmd *TXCmdrray,
uint16_t size);
//! \brief Transmits a string to GUI.
//!
//! \param[in] str is the string to be sent.
//!
//! \return none
extern void GUI_TransmitStringBlocking(char *str);
#endif // __GUI_H__

58
include/callbacks_JSON.h Executable file
View File

@ -0,0 +1,58 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2020, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
// callbacks_JSON.h
//
// Application level callbacks using JSON
// Texas Instruments, Inc.
#include <msp430.h>
#include <stdbool.h>
#include <stdint.h>
#include <HAL.h>
#include <GUI_JSON.h>
#include <include/GUIComm.h>
#include <include/QmathLib.h>
#ifndef INCLUDE_CALLBACKS_H_
#define INCLUDE_CALLBACKS_H_
// Global variables for the callbacks
volatile bool bEnableSwitch;
volatile _q qIncrement;
// Functions to receive data from GUI
extern void GUICallback_QMathData(char * string);
extern void GUICallback_boolEnable(char * string);
#endif /* INCLUDE_CALLBACKS_H_ */

250
lnk_msp430fr2355.cmd Normal file
View File

@ -0,0 +1,250 @@
/******************************************************************************
*
* Copyright (C) 2012 - 2021 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Default linker command file for Texas Instruments MSP430FR2355
*
*****************************************************************************/
/******************************************************************************/
/* */
/* Usage: lnk430 <obj files...> -o <out file> -m <map file> lnk.cmd */
/* cl430 <src files...> -z -o <out file> -m <map file> lnk.cmd */
/* */
/*----------------------------------------------------------------------------*/
/* These linker options are for command line linking only. For IDE linking, */
/* you should set your linker options in Project Properties */
/* -c LINK USING C CONVENTIONS */
/* -stack 0x0100 SOFTWARE STACK SIZE */
/* -heap 0x0100 HEAP AREA SIZE */
/* */
/*----------------------------------------------------------------------------*/
/* 1.213 */
/*----------------------------------------------------------------------------*/
/****************************************************************************/
/* SPECIFY THE SYSTEM MEMORY MAP */
/****************************************************************************/
MEMORY
{
TINYRAM : origin = 0x6, length = 0x1A
BSL0 : origin = 0x1000, length = 0x800
INFO : origin = 0x1800, length = 0x200
TLVMEM : origin = 0x1A00, length = 0x200
BOOTCODE : origin = 0x1C00, length = 0x400
RAM : origin = 0x2000, length = 0x1000
FRAM : origin = 0x8000, length = 0x7F80
ROMLIB : origin = 0xFAC00, length = 0x5000
BSL1 : origin = 0xFFC00, length = 0x400
JTAGSIGNATURE : origin = 0xFF80, length = 0x0004, fill = 0xFFFF
BSLSIGNATURE : origin = 0xFF84, length = 0x0004, fill = 0xFFFF
BSLCONFIGURATIONSIGNATURE: origin = 0xFF88, length = 0x0002, fill = 0xFFFF
BSLCONFIGURATION : origin = 0xFF8A, length = 0x0002, fill = 0xFFFF
BSLI2CADDRESS : origin = 0xFFA0, length = 0x0002, fill = 0xFFFF
INT00 : origin = 0xFFA2, length = 0x0002
INT01 : origin = 0xFFA4, length = 0x0002
INT02 : origin = 0xFFA6, length = 0x0002
INT03 : origin = 0xFFA8, length = 0x0002
INT04 : origin = 0xFFAA, length = 0x0002
INT05 : origin = 0xFFAC, length = 0x0002
INT06 : origin = 0xFFAE, length = 0x0002
INT07 : origin = 0xFFB0, length = 0x0002
INT08 : origin = 0xFFB2, length = 0x0002
INT09 : origin = 0xFFB4, length = 0x0002
INT10 : origin = 0xFFB6, length = 0x0002
INT11 : origin = 0xFFB8, length = 0x0002
INT12 : origin = 0xFFBA, length = 0x0002
INT13 : origin = 0xFFBC, length = 0x0002
INT14 : origin = 0xFFBE, length = 0x0002
INT15 : origin = 0xFFC0, length = 0x0002
INT16 : origin = 0xFFC2, length = 0x0002
INT17 : origin = 0xFFC4, length = 0x0002
INT18 : origin = 0xFFC6, length = 0x0002
INT19 : origin = 0xFFC8, length = 0x0002
INT20 : origin = 0xFFCA, length = 0x0002
INT21 : origin = 0xFFCC, length = 0x0002
INT22 : origin = 0xFFCE, length = 0x0002
INT23 : origin = 0xFFD0, length = 0x0002
INT24 : origin = 0xFFD2, length = 0x0002
INT25 : origin = 0xFFD4, length = 0x0002
INT26 : origin = 0xFFD6, length = 0x0002
INT27 : origin = 0xFFD8, length = 0x0002
INT28 : origin = 0xFFDA, length = 0x0002
INT29 : origin = 0xFFDC, length = 0x0002
INT30 : origin = 0xFFDE, length = 0x0002
INT31 : origin = 0xFFE0, length = 0x0002
INT32 : origin = 0xFFE2, length = 0x0002
INT33 : origin = 0xFFE4, length = 0x0002
INT34 : origin = 0xFFE6, length = 0x0002
INT35 : origin = 0xFFE8, length = 0x0002
INT36 : origin = 0xFFEA, length = 0x0002
INT37 : origin = 0xFFEC, length = 0x0002
INT38 : origin = 0xFFEE, length = 0x0002
INT39 : origin = 0xFFF0, length = 0x0002
INT40 : origin = 0xFFF2, length = 0x0002
INT41 : origin = 0xFFF4, length = 0x0002
INT42 : origin = 0xFFF6, length = 0x0002
INT43 : origin = 0xFFF8, length = 0x0002
INT44 : origin = 0xFFFA, length = 0x0002
INT45 : origin = 0xFFFC, length = 0x0002
RESET : origin = 0xFFFE, length = 0x0002
}
/****************************************************************************/
/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */
/****************************************************************************/
SECTIONS
{
GROUP(ALL_FRAM)
{
GROUP(READ_WRITE_MEMORY)
{
.TI.persistent : {} /* For #pragma persistent */
.cio : {} /* C I/O Buffer */
.sysmem : {} /* Dynamic memory allocation area */
} PALIGN(0x0400), RUN_START(fram_rw_start) RUN_END(fram_rx_start)
GROUP(READ_ONLY_MEMORY)
{
.cinit : {} /* Initialization tables */
.pinit : {} /* C++ constructor tables */
.binit : {} /* Boot-time Initialization tables */
.init_array : {} /* C++ constructor tables */
.mspabi.exidx : {} /* C++ constructor tables */
.mspabi.extab : {} /* C++ constructor tables */
.const : {} /* Constant data */
}
GROUP(EXECUTABLE_MEMORY)
{
.text : {} /* Code */
.text:_isr : {} /* Code ISRs */
}
} > FRAM
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 15009000
.TI.ramfunc : {} load=FRAM, run=RAM, table(BINIT)
#endif
#endif
.jtagsignature : {} > JTAGSIGNATURE
.bslsignature : {} > BSLSIGNATURE
.bslconfigsignature : {} > BSLCONFIGURATIONSIGNATURE
.bslconfig : {} > BSLCONFIGURATION
.bsli2caddress : {} > BSLI2CADDRESS
.bss : {} > RAM /* Global & static vars */
.data : {} > RAM /* Global & static vars */
.TI.noinit : {} > RAM /* For #pragma noinit */
.stack : {} > RAM (HIGH) /* Software system stack */
.tinyram : {} > TINYRAM /* Tiny RAM */
/* MSP430 INFO memory segments */
.info : type = NOINIT{} > INFO
/* MSP430 interrupt vectors */
.int00 : {} > INT00
.int01 : {} > INT01
.int02 : {} > INT02
.int03 : {} > INT03
.int04 : {} > INT04
.int05 : {} > INT05
.int06 : {} > INT06
.int07 : {} > INT07
.int08 : {} > INT08
.int09 : {} > INT09
.int10 : {} > INT10
.int11 : {} > INT11
.int12 : {} > INT12
.int13 : {} > INT13
.int14 : {} > INT14
.int15 : {} > INT15
.int16 : {} > INT16
.int17 : {} > INT17
.int18 : {} > INT18
.int19 : {} > INT19
.int20 : {} > INT20
.int21 : {} > INT21
PORT4 : { * ( .int22 ) } > INT22 type = VECT_INIT
PORT3 : { * ( .int23 ) } > INT23 type = VECT_INIT
PORT2 : { * ( .int24 ) } > INT24 type = VECT_INIT
PORT1 : { * ( .int25 ) } > INT25 type = VECT_INIT
SAC1_SAC3 : { * ( .int26 ) } > INT26 type = VECT_INIT
SAC0_SAC2 : { * ( .int27 ) } > INT27 type = VECT_INIT
ECOMP0_ECOMP1: { * ( .int28 ) } > INT28 type = VECT_INIT
ADC : { * ( .int29 ) } > INT29 type = VECT_INIT
EUSCI_B1 : { * ( .int30 ) } > INT30 type = VECT_INIT
EUSCI_B0 : { * ( .int31 ) } > INT31 type = VECT_INIT
EUSCI_A1 : { * ( .int32 ) } > INT32 type = VECT_INIT
EUSCI_A0 : { * ( .int33 ) } > INT33 type = VECT_INIT
WDT : { * ( .int34 ) } > INT34 type = VECT_INIT
RTC : { * ( .int35 ) } > INT35 type = VECT_INIT
TIMER3_B1 : { * ( .int36 ) } > INT36 type = VECT_INIT
TIMER3_B0 : { * ( .int37 ) } > INT37 type = VECT_INIT
TIMER2_B1 : { * ( .int38 ) } > INT38 type = VECT_INIT
TIMER2_B0 : { * ( .int39 ) } > INT39 type = VECT_INIT
TIMER1_B1 : { * ( .int40 ) } > INT40 type = VECT_INIT
TIMER1_B0 : { * ( .int41 ) } > INT41 type = VECT_INIT
TIMER0_B1 : { * ( .int42 ) } > INT42 type = VECT_INIT
TIMER0_B0 : { * ( .int43 ) } > INT43 type = VECT_INIT
UNMI : { * ( .int44 ) } > INT44 type = VECT_INIT
SYSNMI : { * ( .int45 ) } > INT45 type = VECT_INIT
.reset : {} > RESET /* MSP430 reset vector */
}
/****************************************************************************/
/* FRAM WRITE PROTECTION SEGMENT DEFINITONS */
/****************************************************************************/
#ifdef _FRWP_ENABLE
__mpu_enable=1;
start_protection_offset_address = (fram_rx_start - fram_rw_start) >> 10;
program_fram_protection = 0x1;
#ifdef _INFO_FRWP_ENABLE
info_fram_protection = 0x1;
#else
info_fram_protection = 0x0;
#endif
#endif
/****************************************************************************/
/* INCLUDE PERIPHERALS MEMORY MAP */
/****************************************************************************/
-l msp430fr2355.cmd

168
main.c Executable file
View File

@ -0,0 +1,168 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2020, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
// GUI Composer Simple JSON Demo using MSP430
//
// Texas Instruments, Inc.
// ******************************************************************************
#include <msp430.h>
#include <stdbool.h>
#include <stdint.h>
#include <HAL.h>
#include <GUI_JSON.h>
#include <GUIComm.h>
#include <QmathLib.h>
#include <callbacks_JSON.h>
// Q8 is used in this demo because the variable qCounter ranges 0.0-100.0
#define STR_LEN_TWO 2
#define STR_LEN_SEVEN 7
// Global variable use to track the of state of GUI and counter values
volatile uint8_t u8Counter;
volatile uint16_t u16Counter;
volatile uint32_t u32Counter;
volatile _q qCounter;
volatile bool bUpdateGUI;
//! \brief RX Command structure.
//! The corresponding callback will be called when the command is
//! received from GUI.
//! Note: shorter command names take less time to process
const tGUI_RxCmd GUI_RXCommands[] =
{
{"bEnable", GUICallback_boolEnable},
{"u16Data", GUICallback_QMathData},
};
//! \brief Increments counters using MSP430 and sends data to GUI.
//!
//! \return none
void main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
// Initialize clock, GPIOs
HAL_System_Init();
// Initialize GUI layer
GUI_Init();
GUI_InitRxCmd( &GUI_RXCommands[0],
(sizeof(GUI_RXCommands)/sizeof(GUI_RXCommands[0])) );
// Initialize variables
bUpdateGUI = false; // Update GUI first time
u8Counter = 50; // Counter8 will be updated on SW1 press in increments of 50
u16Counter = 5000; // Counter16 will be updated on button press in increments of 5000
u32Counter = 10000; // Counter32 will be updated on timer in increments of 10000
bEnableSwitch = true; // Switch enables updating QMath
qCounter = _Q(0.5); // QMath counter updated on timer based on boolean in increments of qIncrement
qIncrement = _Q(0.5);
// Configure SW1 and SW2 for interrupts (pins set as input with pull-up during GPIO initialization)
HAL_IO_InitButtons();
// Initialize a timer to update the counter
HAL_Timer_Init();
// Send default value of variables
GUIComm_sendUInt8("c1", STR_LEN_TWO, u8Counter);
GUIComm_sendUInt16("c2", STR_LEN_TWO, u16Counter);
GUIComm_sendUInt32("c3", STR_LEN_TWO, u32Counter);
GUIComm_sendInt16("c4", STR_LEN_TWO, (int16_t) qCounter);
GUIComm_sendInt16("u16Data", STR_LEN_SEVEN, (int16_t) qIncrement);
GUIComm_sendBool("bEnable", STR_LEN_SEVEN, bEnableSwitch);
__bis_SR_register(LPM3_bits | GIE); // Enter LPM3 w/interrupt
__enable_interrupt();
while (1)
{
while (bUpdateGUI == true)
{
GUIComm_sendUInt8("c1", STR_LEN_TWO, u8Counter);
GUIComm_sendUInt16("c2", STR_LEN_TWO, u16Counter);
GUIComm_sendUInt32("c3", STR_LEN_TWO, u32Counter);
if (bEnableSwitch == true)
{
GUIComm_sendInt16("c4", STR_LEN_TWO, (int16_t) qCounter);
}
bUpdateGUI = false;
}
__disable_interrupt();
if (bUpdateGUI == false)
{
__bis_SR_register(LPM3_bits | GIE); // Enter LPM3 w/interrupt
__no_operation(); // For debug
}
}
}
//! \brief Function called by HAL when there is a periodic timer interrupt
//!
//! \return none
void TimerCallback(void)
{
// Update 32-bit counter
u32Counter += 10000;
bUpdateGUI = true;
if (bEnableSwitch == true)
{
qCounter += qIncrement;
if (qCounter > _Q(100.0))
{
qCounter = 0;
}
}
}
//! \brief Function called by HAL when SW1 is pressed
//!
//! \return none
void ButtonCallback_SW1(void)
{
u8Counter += 50;
}
//! \brief Function called by HAL when SW2 is pressed
//!
//! \return none
void ButtonCallback_SW2(void)
{
u16Counter += 5000;
}

Binary file not shown.

Binary file not shown.

201
src/MSP430_GUI/GUI_JSON.c Executable file
View File

@ -0,0 +1,201 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2019, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
// GUI Interface
//
// API to send and receive data from GUI using JSON protocol
//
// Texas Instruments, Inc.
#include <GUI_JSON.h>
#include <HAL.h>
#include "./jsmn/jsmn.h"
/**** Local Variables *********************************************************/
static char txString[MAX_STR_LEN]; // String to transmit data
#if (GUI_RXCMD_ENABLE)
static char rxString[MAX_STR_LEN]; // String to receive data
static jsmn_parser p; // parses JSON data
static jsmntok_t t[64]; // We expect no more than 64 tokens
static const tGUI_RxCmd *RxCmdsArray; // Pointer to array of
// RX commands
static uint16_t RxCmdsArraySize; // Size of RX commands
#endif
/**** Local Function Prototypes************************************************/
#if (GUI_RXCMD_ENABLE)
static bool GUI_ParseString(void);
static int jsoneq(const char *json, jsmntok_t *tok, const char *s);
#endif
static bool GUI_RxCharHALCallback(char data);
/**** Functions ***************************************************************/
void GUI_Init(void)
{
HAL_GUI_Init(GUI_RxCharHALCallback);
RxCmdsArraySize= 0;
RxCmdsArray = NULL;
}
#if (GUI_RXCMD_ENABLE)
void GUI_InitRxCmd(const tGUI_RxCmd *CommandArray,
uint16_t size)
{
RxCmdsArray = CommandArray;
RxCmdsArraySize = size;
}
#endif
void GUI_TransmitStringBlocking(char *str)
{
uint16_t i;
for(i = 0; i < strlen(str); i++)
{
if (str[i] != 0)
{
HAL_GUI_TransmitCharBlocking(str[i]);
}
}
}
void GUI_TransmitData(const tGUI_TxCmd *TXCmdrray,
uint16_t size)
{
uint16_t i;
for (i=0; i < size; i++)
{
sprintf(txString, TXCmdrray[i].formattingStringCMD,
*TXCmdrray[i].param);
GUI_TransmitStringBlocking(txString);
}
}
/**** Local Functions**********************************************************/
//! \brief Callback function for GUI HAL. Called when byte is received.
//!
//! \param[in] data is the byte received from GUI Comm interface.
//!
//! \return true to wake-up MCU, false to stay in LPM
static bool GUI_RxCharHALCallback(char data)
{
#if (GUI_RXCMD_ENABLE)
static bool rxInProgress = false;
static uint16_t charCnt = 0;
bool ret = false;
if(!rxInProgress){
if ((data != '\n') ){
rxInProgress = true;
charCnt = 0;
rxString[charCnt] = data;
}
}else{ // in progress
charCnt++;
if((data != '\n')){
if (charCnt >= MAX_STR_LEN){
rxInProgress = false;
}else{
rxString[charCnt] = data;
}
}else{
rxInProgress = false;
rxString[charCnt] = '\0';
// String receive complete
if (GUI_ParseString() == true)
{
ret = true; // wake-up MCU
}
}
}
return ret;
#else
return true;
#endif
}
#if (GUI_RXCMD_ENABLE)
//! \brief Parses a string looking for JSON objects
//!
//! \return true to wake-up MCU when a command is received, false to stay in LPM
static bool GUI_ParseString(void)
{
int i;
int r;
int j;
bool ret = false;
jsmn_init(&p);
r = jsmn_parse(&p, rxString, strlen(rxString), t, sizeof(t)/sizeof(t[0]));
// Loop over keys of JSON object
if (RxCmdsArray != NULL)
{
for (i = 1; i < r; i++) {
for (j=0; j < RxCmdsArraySize; j++)
{
if (jsoneq(rxString, &t[i], RxCmdsArray[j].stringCMD) == 0)
{
if (RxCmdsArray[j].callback != NULL)
{
RxCmdsArray[j].callback(rxString+t[i+1].start);
}
i++;
ret = true;
}
}
}
}
return ret;
}
//! \brief Compare JSON keys
//!
//! \param[in] json is the JSON string.
//! \param[in] tok is the JSON token.
//! \param[in] s is the string to check for equality.
//!
//! \return 0 if string found. -1 if not.
static int jsoneq(const char *json, jsmntok_t *tok, const char *s) {
if (tok->type == JSMN_STRING && (int) strlen(s) == tok->end - tok->start &&
strncmp(json + tok->start, s, tok->end - tok->start) == 0) {
return 0;
}
return -1;
}
#endif

335
src/MSP430_GUI/jsmn/jsmn.c Executable file
View File

@ -0,0 +1,335 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2010 Serge A. Zaitsev
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* --/COPYRIGHT--*/
#include "jsmn.h"
/**
* Allocates a fresh unused token from the token pull.
*/
static jsmntok_t *jsmn_alloc_token(jsmn_parser *parser,
jsmntok_t *tokens, size_t num_tokens) {
jsmntok_t *tok;
if (parser->toknext >= num_tokens) {
return NULL;
}
tok = &tokens[parser->toknext++];
tok->start = tok->end = -1;
tok->size = 0;
#ifdef JSMN_PARENT_LINKS
tok->parent = -1;
#endif
return tok;
}
/**
* Fills token type and boundaries.
*/
static void jsmn_fill_token(jsmntok_t *token, jsmntype_t type,
int start, int end) {
token->type = type;
token->start = start;
token->end = end;
token->size = 0;
}
/**
* Fills next available token with JSON primitive.
*/
static int jsmn_parse_primitive(jsmn_parser *parser, const char *js,
size_t len, jsmntok_t *tokens, size_t num_tokens) {
jsmntok_t *token;
int start;
start = parser->pos;
for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) {
switch (js[parser->pos]) {
#ifndef JSMN_STRICT
/* In strict mode primitive must be followed by "," or "}" or "]" */
case ':':
#endif
case '\t' : case '\r' : case '\n' : case ' ' :
case ',' : case ']' : case '}' :
goto found;
}
if (js[parser->pos] < 32 || js[parser->pos] >= 127) {
parser->pos = start;
return JSMN_ERROR_INVAL;
}
}
#ifdef JSMN_STRICT
/* In strict mode primitive must be followed by a comma/object/array */
parser->pos = start;
return JSMN_ERROR_PART;
#endif
found:
if (tokens == NULL) {
parser->pos--;
return 0;
}
token = jsmn_alloc_token(parser, tokens, num_tokens);
if (token == NULL) {
parser->pos = start;
return JSMN_ERROR_NOMEM;
}
jsmn_fill_token(token, JSMN_PRIMITIVE, start, parser->pos);
#ifdef JSMN_PARENT_LINKS
token->parent = parser->toksuper;
#endif
parser->pos--;
return 0;
}
/**
* Fills next token with JSON string.
*/
static int jsmn_parse_string(jsmn_parser *parser, const char *js,
size_t len, jsmntok_t *tokens, size_t num_tokens) {
jsmntok_t *token;
int start = parser->pos;
parser->pos++;
/* Skip starting quote */
for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) {
char c = js[parser->pos];
/* Quote: end of string */
if (c == '\"') {
if (tokens == NULL) {
return 0;
}
token = jsmn_alloc_token(parser, tokens, num_tokens);
if (token == NULL) {
parser->pos = start;
return JSMN_ERROR_NOMEM;
}
jsmn_fill_token(token, JSMN_STRING, start+1, parser->pos);
#ifdef JSMN_PARENT_LINKS
token->parent = parser->toksuper;
#endif
return 0;
}
/* Backslash: Quoted symbol expected */
if (c == '\\' && parser->pos + 1 < len) {
int i;
parser->pos++;
switch (js[parser->pos]) {
/* Allowed escaped symbols */
case '\"': case '/' : case '\\' : case 'b' :
case 'f' : case 'r' : case 'n' : case 't' :
break;
/* Allows escaped symbol \uXXXX */
case 'u':
parser->pos++;
for(i = 0; i < 4 && parser->pos < len && js[parser->pos] != '\0'; i++) {
/* If it isn't a hex character we have an error */
if(!((js[parser->pos] >= 48 && js[parser->pos] <= 57) || /* 0-9 */
(js[parser->pos] >= 65 && js[parser->pos] <= 70) || /* A-F */
(js[parser->pos] >= 97 && js[parser->pos] <= 102))) { /* a-f */
parser->pos = start;
return JSMN_ERROR_INVAL;
}
parser->pos++;
}
parser->pos--;
break;
/* Unexpected symbol */
default:
parser->pos = start;
return JSMN_ERROR_INVAL;
}
}
}
parser->pos = start;
return JSMN_ERROR_PART;
}
/**
* Parse JSON string and fill tokens.
*/
int jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
jsmntok_t *tokens, unsigned int num_tokens) {
int r;
int i;
jsmntok_t *token;
int count = parser->toknext;
for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) {
char c;
jsmntype_t type;
c = js[parser->pos];
switch (c) {
case '{': case '[':
count++;
if (tokens == NULL) {
break;
}
token = jsmn_alloc_token(parser, tokens, num_tokens);
if (token == NULL)
return JSMN_ERROR_NOMEM;
if (parser->toksuper != -1) {
tokens[parser->toksuper].size++;
#ifdef JSMN_PARENT_LINKS
token->parent = parser->toksuper;
#endif
}
token->type = (c == '{' ? JSMN_OBJECT : JSMN_ARRAY);
token->start = parser->pos;
parser->toksuper = parser->toknext - 1;
break;
case '}': case ']':
if (tokens == NULL)
break;
type = (c == '}' ? JSMN_OBJECT : JSMN_ARRAY);
#ifdef JSMN_PARENT_LINKS
if (parser->toknext < 1) {
return JSMN_ERROR_INVAL;
}
token = &tokens[parser->toknext - 1];
for (;;) {
if (token->start != -1 && token->end == -1) {
if (token->type != type) {
return JSMN_ERROR_INVAL;
}
token->end = parser->pos + 1;
parser->toksuper = token->parent;
break;
}
if (token->parent == -1) {
if(token->type != type || parser->toksuper == -1) {
return JSMN_ERROR_INVAL;
}
break;
}
token = &tokens[token->parent];
}
#else
for (i = parser->toknext - 1; i >= 0; i--) {
token = &tokens[i];
if (token->start != -1 && token->end == -1) {
if (token->type != type) {
return JSMN_ERROR_INVAL;
}
parser->toksuper = -1;
token->end = parser->pos + 1;
break;
}
}
/* Error if unmatched closing bracket */
if (i == -1) return JSMN_ERROR_INVAL;
for (; i >= 0; i--) {
token = &tokens[i];
if (token->start != -1 && token->end == -1) {
parser->toksuper = i;
break;
}
}
#endif
break;
case '\"':
r = jsmn_parse_string(parser, js, len, tokens, num_tokens);
if (r < 0) return r;
count++;
if (parser->toksuper != -1 && tokens != NULL)
tokens[parser->toksuper].size++;
break;
case '\t' : case '\r' : case '\n' : case ' ':
break;
case ':':
parser->toksuper = parser->toknext - 1;
break;
case ',':
if (tokens != NULL && parser->toksuper != -1 &&
tokens[parser->toksuper].type != JSMN_ARRAY &&
tokens[parser->toksuper].type != JSMN_OBJECT) {
#ifdef JSMN_PARENT_LINKS
parser->toksuper = tokens[parser->toksuper].parent;
#else
for (i = parser->toknext - 1; i >= 0; i--) {
if (tokens[i].type == JSMN_ARRAY || tokens[i].type == JSMN_OBJECT) {
if (tokens[i].start != -1 && tokens[i].end == -1) {
parser->toksuper = i;
break;
}
}
}
#endif
}
break;
#ifdef JSMN_STRICT
/* In strict mode primitives are: numbers and booleans */
case '-': case '0': case '1' : case '2': case '3' : case '4':
case '5': case '6': case '7' : case '8': case '9':
case 't': case 'f': case 'n' :
/* And they must not be keys of the object */
if (tokens != NULL && parser->toksuper != -1) {
jsmntok_t *t = &tokens[parser->toksuper];
if (t->type == JSMN_OBJECT ||
(t->type == JSMN_STRING && t->size != 0)) {
return JSMN_ERROR_INVAL;
}
}
#else
/* In non-strict mode every unquoted value is a primitive */
default:
#endif
r = jsmn_parse_primitive(parser, js, len, tokens, num_tokens);
if (r < 0) return r;
count++;
if (parser->toksuper != -1 && tokens != NULL)
tokens[parser->toksuper].size++;
break;
#ifdef JSMN_STRICT
/* Unexpected char in strict mode */
default:
return JSMN_ERROR_INVAL;
#endif
}
}
if (tokens != NULL) {
for (i = parser->toknext - 1; i >= 0; i--) {
/* Unmatched opened object or array */
if (tokens[i].start != -1 && tokens[i].end == -1) {
return JSMN_ERROR_PART;
}
}
}
return count;
}
/**
* Creates a new parser based over a given buffer with an array of tokens
* available.
*/
void jsmn_init(jsmn_parser *parser) {
parser->pos = 0;
parser->toknext = 0;
parser->toksuper = -1;
}

98
src/MSP430_GUI/jsmn/jsmn.h Executable file
View File

@ -0,0 +1,98 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2010 Serge A. Zaitsev
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* --/COPYRIGHT--*/
#ifndef __JSMN_H_
#define __JSMN_H_
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* JSON type identifier. Basic types are:
* o Object
* o Array
* o String
* o Other primitive: number, boolean (true/false) or null
*/
typedef enum {
JSMN_UNDEFINED = 0,
JSMN_OBJECT = 1,
JSMN_ARRAY = 2,
JSMN_STRING = 3,
JSMN_PRIMITIVE = 4
} jsmntype_t;
enum jsmnerr {
/* Not enough tokens were provided */
JSMN_ERROR_NOMEM = -1,
/* Invalid character inside JSON string */
JSMN_ERROR_INVAL = -2,
/* The string is not a full JSON packet, more bytes expected */
JSMN_ERROR_PART = -3
};
/**
* JSON token description.
* type type (object, array, string etc.)
* start start position in JSON data string
* end end position in JSON data string
*/
typedef struct {
jsmntype_t type;
int start;
int end;
int size;
#ifdef JSMN_PARENT_LINKS
int parent;
#endif
} jsmntok_t;
/**
* JSON parser. Contains an array of token blocks available. Also stores
* the string being parsed now and current position in that string
*/
typedef struct {
unsigned int pos; /* offset in the JSON string */
unsigned int toknext; /* next token to allocate */
int toksuper; /* superior token node, e.g parent object or array */
} jsmn_parser;
/**
* Create JSON parser over an array of tokens
*/
void jsmn_init(jsmn_parser *parser);
/**
* Run JSON parser. It parses a JSON data string into and array of tokens, each describing
* a single JSON object.
*/
int jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
jsmntok_t *tokens, unsigned int num_tokens);
#ifdef __cplusplus
}
#endif
#endif /* __JSMN_H_ */

View File

@ -0,0 +1,84 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2019, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
// MSP430 HAL Configuration
//
// Static and default configuration of Library
// Texas Instruments, Inc.
#ifndef __CONFIG_PRIVATE_H__
#define __CONFIG_PRIVATE_H__
#include "Config_Common.h"
//*********** GUI Communication ************************************************
//! \brief baudrate of GUI Communication port
//! i.e. 19200 = 19,200bps
//!
#define HAL_GUICOMM_BAUDRATE (9600)
//! \brief Select which eUSCI to use with UART
#define GUI_COMM_UART_EUSCI (1)
#if (GUI_COMM_UART_EUSCI == 0)
#define UCAnBR0 (UCA0BR0)
#define UCAnBR1 (UCA0BR1)
#define UCAnCTLW0 (UCA0CTLW0)
#define UCAnIE (UCA0IE)
#define UCAnIFG (UCA0IFG)
#define UCAnIV (UCA0IV)
#define UCAnMCTLW (UCA0MCTLW)
#define UCAnSTATW (UCA0STATW)
#define UCAnTXBUF (UCA0TXBUF)
#define UCAnRXBUF (UCA0RXBUF)
#define USCI_An_VECTOR (USCI_A0_VECTOR)
#define USCI_An_ISR (USCI_A0_ISR)
#elif (GUI_COMM_UART_EUSCI == 1)
#define UCAnBR0 (UCA1BR0)
#define UCAnBR1 (UCA1BR1)
#define UCAnCTLW0 (UCA1CTLW0)
#define UCAnIE (UCA1IE)
#define UCAnIFG (UCA1IFG)
#define UCAnIV (UCA1IV)
#define UCAnMCTLW (UCA1MCTLW)
#define UCAnSTATW (UCA1STATW)
#define UCAnTXBUF (UCA1TXBUF)
#define UCAnRXBUF (UCA1RXBUF)
#define USCI_An_VECTOR (USCI_A1_VECTOR)
#define USCI_An_ISR (USCI_A1_ISR)
#else
#error "eUSCI is not defined. Modify HAL layer"
#endif
#endif //__CONFIG_PRIVATE_H__

View File

@ -0,0 +1,145 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2020, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
// GUI HAL for MSP430FR2xxx using UART
//
// Driver to send and receive data from GUI using FR2xxx UART
// Texas Instruments, Inc.
// *****************************************************************************
#include "HAL_Config_Private.h"
#include "HAL.h"
tGUICommRXCharCallback RxByteISRCallback;
void HAL_GUI_Init(tGUICommRXCharCallback RxByteCallback)
{
// Store callback for ISR RX Byte
RxByteISRCallback = RxByteCallback;
// Configure UART for FR2xxx
UCAnCTLW0 |= UCSWRST;
UCAnCTLW0 |= UCSSEL__SMCLK;
#if ((HAL_GUICOMM_BAUDRATE == 9600) && (HSBUS_FREQ_MHZ == 1))
// Baud Rate calculation
// 1000000/(16*9600) = 6.51
// Fractional portion = 0.51
// User's Guide Table 17-4: UCBRSx = 0x20
// UCBRFx = 8
UCAnBR0 = 6;
UCAnBR1 = 0x00;
UCAnMCTLW = 0x2000 | UCOS16 | UCBRF_8;
#elif ((HAL_GUICOMM_BAUDRATE == 28800) && (HSBUS_FREQ_MHZ == 8))
// Baud Rate calculation
// 8E6/(16*28800) = 17.36
// Fractional portion = 0.36
// From eUSCI Calculator: UCBRSx = 221 (0xDD)
// UCBRFx = 5
UCAnBR0 = 17;
UCAnBR1 = 0x00;
UCAnMCTLW = (0xDD<<8) | UCOS16 | UCBRF_5;
#elif ((HAL_GUICOMM_BAUDRATE == 19200) && (HSBUS_FREQ_MHZ == 8))
// Baud Rate calculation
// 8E6/(16*19200) = 26.04
// Fractional portion = 0.04
// User's Guide Table 17-4: UCBRSx = 0xB6
// UCBRFx = 0
UCAnBR0 = 26;
UCAnBR1 = 0x00;
UCAnMCTLW = (0xB6<<8) | UCOS16 | UCBRF_0;
#elif ((HAL_GUICOMM_BAUDRATE == 115200) && (HSBUS_FREQ_MHZ == 8))
// Baud Rate calculation
// 8E6/(16*115200) = 4.34
// Fractional portion = 0.34
// User's Guide Table 22-5: UCBRSx = 0x55
// UCBRFx = 5
UCAnBR0 = 4;
UCAnBR1 = 0x00;
UCAnMCTLW = (0x55<<8) | UCOS16 | UCBRF_5;
#elif ((HAL_GUICOMM_BAUDRATE == 9600) && (HSBUS_FREQ_MHZ == 8))
// Baud Rate calculation
// 8E6/(16*9600) = 52.0833
// Fractional portion = 0.33
// User's Guide Table 17-4: UCBRSx = 0x49
// UCBRFx = 1
UCAnBR0 = 52;
UCAnBR1 = 0x00;
UCAnMCTLW = (0x49<<8) | UCOS16 | UCBRF_1;
#else
#error "Define UART baudrate registers based on desired frequency"
#endif
UCAnCTLW0 &= ~UCSWRST; // Initialize eUSCI
UCAnIE |= UCRXIE;
}
void HAL_GUI_TransmitCharBlocking(char character)
{
// Transmit Character
while (UCAnSTATW & UCBUSY)
;
while (!(UCAnIFG & UCTXIFG))
;
UCAnTXBUF = character;
while (UCAnSTATW & UCBUSY)
;
}
// EUSCI interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_An_VECTOR
__interrupt void USCI_An_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCI_An_VECTOR))) USCI_An_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch(__even_in_range(UCAnIV,USCI_UART_UCTXCPTIFG))
{
case USCI_NONE: break;
case USCI_UART_UCRXIFG:
if (RxByteISRCallback != NULL)
{
if (RxByteISRCallback(UCAnRXBUF) == true)
{
__bic_SR_register_on_exit(LPM4_bits); // Exit LPM
}
}
break;
case USCI_UART_UCTXIFG: break;
case USCI_UART_UCSTTIFG: break;
case USCI_UART_UCTXCPTIFG: break;
default: break;
}
}

169
src/MSP430_HAL/HAL_IO_FR235x.c Executable file
View File

@ -0,0 +1,169 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2019, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
// HAL IO functions
//
// Texas Instruments, Inc.
// *****************************************************************************
#include <msp430.h>
#include <stdint.h>
#include <stdlib.h>
#include <HAL.h>
#include "HAL_Config_Private.h"
// Simple callbacks to functions in main
extern void ButtonCallback_SW1(void);
extern void ButtonCallback_SW2(void);
/**** Functions **************************************************************/
void HAL_IO_Init(void)
{
// Port output low to save power consumption
// P1.0 = RED LED, Output Low
// P1.1 = Unused, Output Low
// P1.2 = Unused, Output Low
// P1.3 = Unused, Output Low
// P1.4 = Unused, Output Low
// P1.5 = Unused, Output Low
// P1.6 = Unused, Output Low
// P1.7 = Unused, Output Low
P1OUT = (0x00);
P1DIR = (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | BIT6 | BIT7);
// P2.0 = Unused, Output Low
// P2.1 = Unused, Output Low
// P2.2 = Unused, Output Low
// P2.3 = SW2, Input Pull-up
// P2.4 = Unused, Output Low
// P2.5 = Unused, Output Low
// P2.6 = Unused, Output Low
// P2.7 = Unused, Output Low
P2OUT = (BIT3);
P2DIR = (BIT0 | BIT1 | BIT2 | BIT4 | BIT5 | BIT6 | BIT7);
P2REN |= (BIT3);
// P3.0 = Unused, Output Low
// P3.1 = Unused, Output Low
// P3.2 = Unused, Output Low
// P3.3 = Unused, Output Low
// P3.4 = Unused, Output Low
// P3.5 = Unused, Output Low
// P3.6 = Unused, Output Low
// P3.7 = Unused, Output Low
P3OUT = (0x00);
P3DIR = (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | BIT6 | BIT7);
// P4.0 = Unused, Output Low
// P4.1 = SW1, Input pull-up
// P4.2 = LP UART RXD, Input pull-up or UART
// P4.3 = LP UART TXD, Input pull-up or UART
// P4.4 = NC, Output Low
// P4.5 = NC, Output Low
// P4.6 = NC, Output Low
// P4.7 = NC, Output Low
P4OUT = (BIT1);
P4DIR = (BIT0 | BIT4 | BIT5 | BIT6 | BIT7);
P4REN |= (BIT1);
P4SEL0 |= (BIT2 | BIT3);
P4SEL1 &= ~(BIT2 | BIT3);
// P5.0 = Unused, Output Low
// P5.1 = Unused, Output Low
// P5.2 = Unused, Output Low
// P5.3 = Unused, Output Low
// P5.4 = Unused, Output Low
// P5.5 = N/A, Output Low
// P5.6 = N/A, Output Low
// P5.7 = N/A, Output Low
P5OUT = (0x00);
P5DIR = (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | BIT6 | BIT7);
// P6.0 = Unused, Output Low
// P6.1 = Unused, Output Low
// P6.2 = Unused, Output Low
// P6.3 = Unused, Output Low
// P6.4 = Unused, Output Low
// P6.5 = Unused, Output Low
// P6.6 = Unused, Output Low
// P6.7 = N/A, Output Low
P6OUT = (0x00);
P6DIR = (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | BIT6 | BIT7);
PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode
// to activate previously configured port settings
}
void HAL_IO_InitButtons(void)
{
// Configure SW1 and SW2 for interrupts (pins set as input-pullup during GPIO initialization)
P4IES = BIT1; // Hi/Low edge
P4IFG = 0; // Clear flags
P4IE = BIT1; // interrupt enabled
P2IES = BIT3; // Hi/Low edge
P2IFG = 0; // Clear flags
P2IE = BIT3; // interrupt enabled
}
// Port 4 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=PORT4_VECTOR
__interrupt void Port_4(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(PORT1_VECTOR))) Port_3 (void)
#else
#error Compiler not supported!
#endif
{
ButtonCallback_SW1();
P4IFG &= ~BIT1; // Clear IFG
__bic_SR_register_on_exit(LPM3_bits); // Exit LPM3
}
// Port 2 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=PORT2_VECTOR
__interrupt void Port_2(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(PORT1_VECTOR))) Port_2 (void)
#else
#error Compiler not supported!
#endif
{
ButtonCallback_SW2();
P2IFG &= ~BIT3; // Clear IFG
__bic_SR_register_on_exit(LPM3_bits); // Exit LPM3
}

View File

@ -0,0 +1,147 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2019, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
// HAL functions to initialize the system
//
// Texas Instruments, Inc.
// ******************************************************************************
#include <Config_Common.h>
#include "HAL.h"
/**** Local Function Prototypes ***********************************************/
static void HAL_System_Clock_Init(void);
static void Clock_Software_Trim(void);
/**** Functions ***************************************************************/
int8_t HAL_System_Init(void)
{
HAL_IO_Init();
HAL_System_Clock_Init();
return 0; // OK
}
/**** Local Functions *********************************************************/
//! \brief Initializes the system clock
//!
//! \return none
static void HAL_System_Clock_Init(void)
{
#if ( (CPU_FREQ_HZ == 8000000) && (LSBUS_FREQ_HZ == 32768) )
__bis_SR_register(SCG0); // disable FLL
CSCTL3 |= SELREF__REFOCLK; // Set REFO as FLL reference source
CSCTL1 = DCOFTRIMEN_1 | DCOFTRIM0 | DCOFTRIM1 | DCORSEL_3;// DCOFTRIM=3, DCO Range = 8MHz
CSCTL2 = FLLD_0 + 243; // DCODIV = 8MHz
__delay_cycles(3);
__bic_SR_register(SCG0); // enable FLL
Clock_Software_Trim(); // Software Trim to get the best DCOFTRIM value
CSCTL4 = SELMS__DCOCLKDIV | SELA__REFOCLK; // set default REFO(~32768Hz) as ACLK source, ACLK = 32768Hz
// default DCODIV as MCLK and SMCLK source
#else
#error "Clock configuration is not supported. Modify DualRaySmoke_HAL_System.c"
#endif
}
//! \brief Software trim for DCO+FLL to lock target frequency
//!
//! \return none
static void Clock_Software_Trim(void)
{
unsigned int oldDcoTap = 0xffff;
unsigned int newDcoTap = 0xffff;
unsigned int newDcoDelta = 0xffff;
unsigned int bestDcoDelta = 0xffff;
unsigned int csCtl0Copy = 0;
unsigned int csCtl1Copy = 0;
unsigned int csCtl0Read = 0;
unsigned int csCtl1Read = 0;
unsigned int dcoFreqTrim = 3;
unsigned char endLoop = 0;
do
{
CSCTL0 = 0x100; // DCO Tap = 256
do
{
CSCTL7 &= ~DCOFFG; // Clear DCO fault flag
}while (CSCTL7 & DCOFFG); // Test DCO fault flag
__delay_cycles((unsigned long)3000 * CPU_FREQ_MHZ);// Wait FLL lock status (FLLUNLOCK) to be stable
// Suggest to wait 24 cycles of divided FLL reference clock
while((CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1)) && ((CSCTL7 & DCOFFG) == 0));
csCtl0Read = CSCTL0; // Read CSCTL0
csCtl1Read = CSCTL1; // Read CSCTL1
oldDcoTap = newDcoTap; // Record DCOTAP value of last time
newDcoTap = csCtl0Read & 0x01ff; // Get DCOTAP value of this time
dcoFreqTrim = (csCtl1Read & 0x0070)>>4;// Get DCOFTRIM value
if(newDcoTap < 256) // DCOTAP < 256
{
newDcoDelta = 256 - newDcoTap; // Delta value between DCPTAP and 256
if((oldDcoTap != 0xffff) && (oldDcoTap >= 256)) // DCOTAP cross 256
endLoop = 1; // Stop while loop
else
{
dcoFreqTrim--;
CSCTL1 = (csCtl1Read & (~DCOFTRIM)) | (dcoFreqTrim<<4);
}
}
else // DCOTAP >= 256
{
newDcoDelta = newDcoTap - 256; // Delta value between DCPTAP and 256
if(oldDcoTap < 256) // DCOTAP cross 256
endLoop = 1; // Stop while loop
else
{
dcoFreqTrim++;
CSCTL1 = (csCtl1Read & (~DCOFTRIM)) | (dcoFreqTrim<<4);
}
}
if(newDcoDelta < bestDcoDelta) // Record DCOTAP closest to 256
{
csCtl0Copy = csCtl0Read;
csCtl1Copy = csCtl1Read;
bestDcoDelta = newDcoDelta;
}
}while(endLoop == 0); // Poll until endLoop == 1
CSCTL0 = csCtl0Copy; // Reload locked DCOTAP
CSCTL1 = csCtl1Copy; // Reload locked DCOFTRIM
while(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1)); // Poll until FLL is locked
}

View File

@ -0,0 +1,71 @@
/* --COPYRIGHT--,BSD
* Copyright (c) 2019, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
// HAL Timer functions
//
// Texas Instruments, Inc.
// *****************************************************************************
#include <msp430.h>
#include <stdint.h>
#include <stdlib.h>
#include <HAL.h>
#include "HAL_Config_Private.h"
// Simple callbacks to main function
extern void TimerCallback(void);
/**** Functions **************************************************************/
void HAL_Timer_Init(void)
{
// Initialize a timer to update the counter
// Configure Timer
TB0CCR0 = LSBUS_FREQ_HZ / 2; // 0.5sec
TB0CCTL0 = CCIE; // TBCCR0 interrupt enabled
TB0CTL = TBSSEL__ACLK | // Use ACLK
MC__UP | // Up Mode
TBCLR; // Clear counter
}
// Timer B0 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector = TIMER0_B0_VECTOR
__interrupt void Timer(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMER0_B0_VECTOR))) Timer_B0 (void)
#else
#error Compiler not supported!
#endif
{
TimerCallback();
__bic_SR_register_on_exit(LPM3_bits); // Exit LPM3
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configurations XML_version="1.2" id="configurations_0">
<configuration XML_version="1.2" id="configuration_0">
<instance XML_version="1.2" desc="TI MSP430 USB1" href="connections/TIMSP430-USB.xml" id="TI MSP430 USB1" xml="TIMSP430-USB.xml" xmlpath="connections"/>
<connection XML_version="1.2" id="TI MSP430 USB1">
<instance XML_version="1.2" href="drivers/msp430_emu.xml" id="drivers" xml="msp430_emu.xml" xmlpath="drivers"/>
<platform XML_version="1.2" id="platform_0">
<instance XML_version="1.2" desc="MSP430FR2355" href="devices/MSP430FR2355.xml" id="MSP430FR2355" xml="MSP430FR2355.xml" xmlpath="devices"/>
</platform>
</connection>
</configuration>
</configurations>

9
targetConfigs/readme.txt Normal file
View File

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