updated printer profile
This commit is contained in:
parent
1eeb17bfa5
commit
0fdd5dcf9e
@ -1,122 +1,122 @@
|
||||
<?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="cdt.managedbuild.toolchain.gnu.cross.base.1504376676">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.cross.base.1504376676" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
||||
<externalSettings>
|
||||
<externalSetting>
|
||||
<entry flags="RESOLVED" kind="includePath" name="C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\variants\nano_zero"/>
|
||||
<entry flags="RESOLVED" kind="includePath" name="C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\cores\arduino"/>
|
||||
</externalSetting>
|
||||
</externalSettings>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.cross.base.1504376676" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<folderInfo id="cdt.managedbuild.toolchain.gnu.cross.base.1504376676.350447049" name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.base.515513271" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.base">
|
||||
<option id="cdt.managedbuild.option.gnu.cross.prefix.582370251" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
|
||||
<option id="cdt.managedbuild.option.gnu.cross.path.231717393" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1339435354" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder id="cdt.managedbuild.builder.gnu.cross.241627781" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross">
|
||||
<outputEntries/>
|
||||
</builder>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1805317535" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||
<option id="gnu.c.compiler.option.include.paths.1641555759" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\variants\nano_zero""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\Documents\Arduino\libraries\Adafruit_SSD1306-master""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\Documents\Arduino\libraries\Adafruit-GFX-Library-master""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\pio""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\instance""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\component""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\cores\arduino""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\TSTERN\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\CMSIS\include""/>
|
||||
</option>
|
||||
<option id="gnu.c.compiler.option.preprocessor.def.symbols.77778103" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="ARDUINO_SAMD_ZERO"/>
|
||||
<listOptionValue builtIn="false" value="__SAMD21G18A__"/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1328245026" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1543385682" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||
<option id="gnu.cpp.compiler.option.include.paths.784350866" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\cores\arduino""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\variants\nano_zero""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\Documents\Arduino\libraries\Adafruit_SSD1306-master""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\Documents\Arduino\libraries\Adafruit-GFX-Library-master""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\pio""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\instance""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\component""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\TSTERN\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\CMSIS\include""/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.preprocessor.def.215333140" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__SAMD21G18A__"/>
|
||||
<listOptionValue builtIn="false" value="ARDUINO_SAMD_ZERO"/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1198492994" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1644022969" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1373326859" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
|
||||
<option id="gnu.cpp.link.option.paths.1624146493" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1257879712" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.722380566" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.7579640" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||
<option id="gnu.both.asm.option.include.paths.2128933212" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\variants\nano_zero""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\Documents\Arduino\libraries\Adafruit_SSD1306-master""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\Documents\Arduino\libraries\Adafruit-GFX-Library-master""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\pio""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\instance""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\component""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\cores\arduino""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\TSTERN\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\CMSIS\Include""/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.474088881" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="Adafruit-GFX-Library-master|Adafruit_SSD1306-master" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="ilg.gnuarmeclipse.managedbuild.packs"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="NZS.null.440051529" name="NZS"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.1504376676;cdt.managedbuild.toolchain.gnu.cross.base.1504376676.350447049;cdt.managedbuild.tool.gnu.cross.c.compiler.1805317535;cdt.managedbuild.tool.gnu.c.compiler.input.1328245026">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.1504376676;cdt.managedbuild.toolchain.gnu.cross.base.1504376676.350447049;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1543385682;cdt.managedbuild.tool.gnu.cpp.compiler.input.1198492994">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="refreshScope"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
</cproject>
|
||||
<?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="cdt.managedbuild.toolchain.gnu.cross.base.1504376676">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.cross.base.1504376676" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
||||
<externalSettings>
|
||||
<externalSetting>
|
||||
<entry flags="RESOLVED" kind="includePath" name="C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\variants\nano_zero"/>
|
||||
<entry flags="RESOLVED" kind="includePath" name="C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\cores\arduino"/>
|
||||
</externalSetting>
|
||||
</externalSettings>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.cross.base.1504376676" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<folderInfo id="cdt.managedbuild.toolchain.gnu.cross.base.1504376676.350447049" name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.base.515513271" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.base">
|
||||
<option id="cdt.managedbuild.option.gnu.cross.prefix.582370251" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
|
||||
<option id="cdt.managedbuild.option.gnu.cross.path.231717393" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1339435354" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder id="cdt.managedbuild.builder.gnu.cross.241627781" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross">
|
||||
<outputEntries/>
|
||||
</builder>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1805317535" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||
<option id="gnu.c.compiler.option.include.paths.1641555759" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\variants\nano_zero""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\Documents\Arduino\libraries\Adafruit_SSD1306-master""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\Documents\Arduino\libraries\Adafruit-GFX-Library-master""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\pio""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\instance""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\component""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\cores\arduino""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\TSTERN\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\CMSIS\include""/>
|
||||
</option>
|
||||
<option id="gnu.c.compiler.option.preprocessor.def.symbols.77778103" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="ARDUINO_SAMD_ZERO"/>
|
||||
<listOptionValue builtIn="false" value="__SAMD21G18A__"/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1328245026" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1543385682" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||
<option id="gnu.cpp.compiler.option.include.paths.784350866" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\cores\arduino""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\variants\nano_zero""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\Documents\Arduino\libraries\Adafruit_SSD1306-master""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\Documents\Arduino\libraries\Adafruit-GFX-Library-master""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\pio""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\instance""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\component""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\TSTERN\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\CMSIS\include""/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.preprocessor.def.215333140" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__SAMD21G18A__"/>
|
||||
<listOptionValue builtIn="false" value="ARDUINO_SAMD_ZERO"/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1198492994" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1644022969" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1373326859" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
|
||||
<option id="gnu.cpp.link.option.paths.1624146493" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1257879712" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.722380566" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.7579640" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||
<option id="gnu.both.asm.option.include.paths.2128933212" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\variants\nano_zero""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\Documents\Arduino\libraries\Adafruit_SSD1306-master""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\Documents\Arduino\libraries\Adafruit-GFX-Library-master""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\pio""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\instance""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL\samd21\include\component""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\misfittech\hardware\samd\1.0.0\cores\arduino""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\Device\ATMEL""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\TSTERN\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\libraries\SPI""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Users\tstern\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel\CMSIS\Include""/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.474088881" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="Adafruit-GFX-Library-master|Adafruit_SSD1306-master" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="ilg.gnuarmeclipse.managedbuild.packs"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="NZS.null.440051529" name="NZS"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.1504376676;cdt.managedbuild.toolchain.gnu.cross.base.1504376676.350447049;cdt.managedbuild.tool.gnu.cross.c.compiler.1805317535;cdt.managedbuild.tool.gnu.c.compiler.input.1328245026">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.1504376676;cdt.managedbuild.toolchain.gnu.cross.base.1504376676.350447049;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1543385682;cdt.managedbuild.tool.gnu.cpp.compiler.input.1198492994">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="refreshScope"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
</cproject>
|
||||
|
@ -1,34 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>NZS</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>arduino</name>
|
||||
<type>2</type>
|
||||
<location>C:/Users/tramp_000/AppData/Local/Arduino15/packages/arduino/hardware/samd/1.6.8/cores/arduino</location>
|
||||
</link>
|
||||
</linkedResources>
|
||||
</projectDescription>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>NZS</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>arduino</name>
|
||||
<type>2</type>
|
||||
<location>C:/Users/tramp_000/AppData/Local/Arduino15/packages/arduino/hardware/samd/1.6.8/cores/arduino</location>
|
||||
</link>
|
||||
</linkedResources>
|
||||
</projectDescription>
|
||||
|
@ -1,152 +1,152 @@
|
||||
/**********************************************************************
|
||||
Copyright (C) 2019 MisfitTech LLC, All rights reserved.
|
||||
|
||||
MisfitTech uses a dual license model that allows the software to be used under
|
||||
a standard GPL open source license, or a commercial license. The standard GPL
|
||||
license requires that all software statically linked with MisfitTec Code is
|
||||
also distributed under the same GPL V2 license terms. Details of both license
|
||||
options follow:
|
||||
|
||||
- Open source licensing -
|
||||
MisfitTech is a free download and may be used, modified, evaluated and
|
||||
distributed without charge provided the user adheres to version two of the GNU
|
||||
General Public License (GPL) and does not remove the copyright notice or this
|
||||
text. The GPL V2 text is available on the gnu.org web site
|
||||
|
||||
- Commercial licensing -
|
||||
Businesses and individuals that for commercial or other reasons cannot comply
|
||||
with the terms of the GPL V2 license must obtain a low cost commercial license
|
||||
before incorporating MisfitTech code into proprietary software for distribution in
|
||||
any form. Commercial licenses can be purchased from www.misfittech.net
|
||||
and do not require any source files to be changed.
|
||||
|
||||
|
||||
This code is distributed in the hope that it will be useful. You cannot
|
||||
use MisfitTech's code unless you agree that you use the software 'as is'.
|
||||
MisfitTech's code is provided WITHOUT ANY WARRANTY; without even the implied
|
||||
warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. MisfitTech LLC disclaims all conditions and terms, be they
|
||||
implied, expressed, or statutory.
|
||||
|
||||
|
||||
Written by Trampas Stern for MisfitTech.
|
||||
|
||||
Misfit Tech invests time and resources providing this open source code,
|
||||
please support MisfitTech and open-source hardware by purchasing
|
||||
products from MisfitTech, www.misifittech.net!
|
||||
*********************************************************************/
|
||||
#include <Arduino.h>
|
||||
#include "syslog.h"
|
||||
#include "A1333.h"
|
||||
#include "SPI.h"
|
||||
#include <stdio.h>
|
||||
#include "board.h"
|
||||
|
||||
|
||||
#define A1333_CMD_NOP (0x0000)
|
||||
#define A1333_ANG15 (0x3200)
|
||||
|
||||
SPISettings settingsA(500000, MSBFIRST, SPI_MODE3); ///400000, MSBFIRST, SPI_MODE1);
|
||||
|
||||
boolean A1333::begin(int csPin)
|
||||
{
|
||||
|
||||
digitalWrite(PIN_AS5047D_CS,LOW); //pull CS LOW by default (chip powered off)
|
||||
digitalWrite(PIN_MOSI,LOW);
|
||||
digitalWrite(PIN_SCK,LOW);
|
||||
digitalWrite(PIN_MISO,LOW);
|
||||
pinMode(PIN_MISO,OUTPUT);
|
||||
delay(1000);
|
||||
|
||||
|
||||
digitalWrite(PIN_AS5047D_CS,HIGH); //pull CS high
|
||||
|
||||
pinMode(PIN_MISO,INPUT);
|
||||
|
||||
|
||||
chipSelectPin=csPin;
|
||||
|
||||
LOG("csPin is %d",csPin);
|
||||
pinMode(chipSelectPin,OUTPUT);
|
||||
digitalWrite(chipSelectPin,HIGH); //pull CS high by default
|
||||
delay(1);
|
||||
|
||||
SPI.begin(); //AS5047D SPI uses mode=1 (CPOL=0, CPHA=1)
|
||||
|
||||
LOG("Begin A1333...");
|
||||
|
||||
LOG("Address is 0x%04X",readAddress(A1333_ANG15));
|
||||
}
|
||||
|
||||
|
||||
//read the encoders
|
||||
int16_t A1333::readAddress(uint16_t addr)
|
||||
{
|
||||
uint16_t data;
|
||||
//make sure it is a write by setting bit 14
|
||||
//addr=addr | 0x4000;
|
||||
|
||||
SPI.beginTransaction(settingsA);
|
||||
digitalWrite(chipSelectPin, LOW);
|
||||
delayMicroseconds(1);
|
||||
//clock out the address to read
|
||||
//LOG("address 0x%04X",addr);
|
||||
SPI.transfer16(addr);
|
||||
digitalWrite(chipSelectPin, HIGH);
|
||||
delayMicroseconds(1);
|
||||
digitalWrite(chipSelectPin, LOW);
|
||||
//clock out zeros to read in the data from address
|
||||
data=SPI.transfer16(0x00);
|
||||
|
||||
digitalWrite(chipSelectPin, HIGH);
|
||||
SPI.endTransaction();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//read the encoders
|
||||
int16_t A1333::readEncoderAngle(void)
|
||||
{
|
||||
|
||||
return readAddress(A1333_ANG15)>>1;
|
||||
}
|
||||
|
||||
int16_t A1333::readEncoderAnglePipeLineRead(void)
|
||||
{
|
||||
static bool first=true;
|
||||
uint16_t addr = A1333_ANG15;
|
||||
uint16_t addr2;
|
||||
uint16_t data;
|
||||
|
||||
if (first)
|
||||
{
|
||||
//make sure it is a write by setting bit 14
|
||||
//addr2=addr | 0x4000;
|
||||
SPI.beginTransaction(settingsA);
|
||||
digitalWrite(chipSelectPin, LOW);
|
||||
delayMicroseconds(1);
|
||||
//clock out the address to read
|
||||
SPI.transfer16(addr);
|
||||
digitalWrite(chipSelectPin, HIGH);
|
||||
delayMicroseconds(1);
|
||||
digitalWrite(chipSelectPin, LOW);
|
||||
delayMicroseconds(1);
|
||||
//clock out zeros to read in the data from address
|
||||
data=SPI.transfer16(addr);
|
||||
|
||||
digitalWrite(chipSelectPin, HIGH);
|
||||
SPI.endTransaction();
|
||||
first=false;
|
||||
return data>>1;
|
||||
}
|
||||
|
||||
SPI.beginTransaction(settingsA);
|
||||
digitalWrite(chipSelectPin, LOW);
|
||||
delayMicroseconds(1);
|
||||
//clock out zeros to read in the data from address
|
||||
data=SPI.transfer16(addr);
|
||||
|
||||
digitalWrite(chipSelectPin, HIGH);
|
||||
SPI.endTransaction();
|
||||
return data>>1;
|
||||
}
|
||||
/**********************************************************************
|
||||
Copyright (C) 2019 MisfitTech LLC, All rights reserved.
|
||||
|
||||
MisfitTech uses a dual license model that allows the software to be used under
|
||||
a standard GPL open source license, or a commercial license. The standard GPL
|
||||
license requires that all software statically linked with MisfitTec Code is
|
||||
also distributed under the same GPL V2 license terms. Details of both license
|
||||
options follow:
|
||||
|
||||
- Open source licensing -
|
||||
MisfitTech is a free download and may be used, modified, evaluated and
|
||||
distributed without charge provided the user adheres to version two of the GNU
|
||||
General Public License (GPL) and does not remove the copyright notice or this
|
||||
text. The GPL V2 text is available on the gnu.org web site
|
||||
|
||||
- Commercial licensing -
|
||||
Businesses and individuals that for commercial or other reasons cannot comply
|
||||
with the terms of the GPL V2 license must obtain a low cost commercial license
|
||||
before incorporating MisfitTech code into proprietary software for distribution in
|
||||
any form. Commercial licenses can be purchased from www.misfittech.net
|
||||
and do not require any source files to be changed.
|
||||
|
||||
|
||||
This code is distributed in the hope that it will be useful. You cannot
|
||||
use MisfitTech's code unless you agree that you use the software 'as is'.
|
||||
MisfitTech's code is provided WITHOUT ANY WARRANTY; without even the implied
|
||||
warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. MisfitTech LLC disclaims all conditions and terms, be they
|
||||
implied, expressed, or statutory.
|
||||
|
||||
|
||||
Written by Trampas Stern for MisfitTech.
|
||||
|
||||
Misfit Tech invests time and resources providing this open source code,
|
||||
please support MisfitTech and open-source hardware by purchasing
|
||||
products from MisfitTech, www.misifittech.net!
|
||||
*********************************************************************/
|
||||
#include <Arduino.h>
|
||||
#include "syslog.h"
|
||||
#include "A1333.h"
|
||||
#include "SPI.h"
|
||||
#include <stdio.h>
|
||||
#include "board.h"
|
||||
|
||||
|
||||
#define A1333_CMD_NOP (0x0000)
|
||||
#define A1333_ANG15 (0x3200)
|
||||
|
||||
SPISettings settingsA(500000, MSBFIRST, SPI_MODE3); ///400000, MSBFIRST, SPI_MODE1);
|
||||
|
||||
boolean A1333::begin(int csPin)
|
||||
{
|
||||
|
||||
digitalWrite(PIN_AS5047D_CS,LOW); //pull CS LOW by default (chip powered off)
|
||||
digitalWrite(PIN_MOSI,LOW);
|
||||
digitalWrite(PIN_SCK,LOW);
|
||||
digitalWrite(PIN_MISO,LOW);
|
||||
pinMode(PIN_MISO,OUTPUT);
|
||||
delay(1000);
|
||||
|
||||
|
||||
digitalWrite(PIN_AS5047D_CS,HIGH); //pull CS high
|
||||
|
||||
pinMode(PIN_MISO,INPUT);
|
||||
|
||||
|
||||
chipSelectPin=csPin;
|
||||
|
||||
LOG("csPin is %d",csPin);
|
||||
pinMode(chipSelectPin,OUTPUT);
|
||||
digitalWrite(chipSelectPin,HIGH); //pull CS high by default
|
||||
delay(1);
|
||||
|
||||
SPI.begin(); //AS5047D SPI uses mode=1 (CPOL=0, CPHA=1)
|
||||
|
||||
LOG("Begin A1333...");
|
||||
|
||||
LOG("Address is 0x%04X",readAddress(A1333_ANG15));
|
||||
}
|
||||
|
||||
|
||||
//read the encoders
|
||||
int16_t A1333::readAddress(uint16_t addr)
|
||||
{
|
||||
uint16_t data;
|
||||
//make sure it is a write by setting bit 14
|
||||
//addr=addr | 0x4000;
|
||||
|
||||
SPI.beginTransaction(settingsA);
|
||||
digitalWrite(chipSelectPin, LOW);
|
||||
delayMicroseconds(1);
|
||||
//clock out the address to read
|
||||
//LOG("address 0x%04X",addr);
|
||||
SPI.transfer16(addr);
|
||||
digitalWrite(chipSelectPin, HIGH);
|
||||
delayMicroseconds(1);
|
||||
digitalWrite(chipSelectPin, LOW);
|
||||
//clock out zeros to read in the data from address
|
||||
data=SPI.transfer16(0x00);
|
||||
|
||||
digitalWrite(chipSelectPin, HIGH);
|
||||
SPI.endTransaction();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//read the encoders
|
||||
int16_t A1333::readEncoderAngle(void)
|
||||
{
|
||||
|
||||
return readAddress(A1333_ANG15)>>1;
|
||||
}
|
||||
|
||||
int16_t A1333::readEncoderAnglePipeLineRead(void)
|
||||
{
|
||||
static bool first=true;
|
||||
uint16_t addr = A1333_ANG15;
|
||||
uint16_t addr2;
|
||||
uint16_t data;
|
||||
|
||||
if (first)
|
||||
{
|
||||
//make sure it is a write by setting bit 14
|
||||
//addr2=addr | 0x4000;
|
||||
SPI.beginTransaction(settingsA);
|
||||
digitalWrite(chipSelectPin, LOW);
|
||||
delayMicroseconds(1);
|
||||
//clock out the address to read
|
||||
SPI.transfer16(addr);
|
||||
digitalWrite(chipSelectPin, HIGH);
|
||||
delayMicroseconds(1);
|
||||
digitalWrite(chipSelectPin, LOW);
|
||||
delayMicroseconds(1);
|
||||
//clock out zeros to read in the data from address
|
||||
data=SPI.transfer16(addr);
|
||||
|
||||
digitalWrite(chipSelectPin, HIGH);
|
||||
SPI.endTransaction();
|
||||
first=false;
|
||||
return data>>1;
|
||||
}
|
||||
|
||||
SPI.beginTransaction(settingsA);
|
||||
digitalWrite(chipSelectPin, LOW);
|
||||
delayMicroseconds(1);
|
||||
//clock out zeros to read in the data from address
|
||||
data=SPI.transfer16(addr);
|
||||
|
||||
digitalWrite(chipSelectPin, HIGH);
|
||||
SPI.endTransaction();
|
||||
return data>>1;
|
||||
}
|
||||
|
@ -1,59 +1,59 @@
|
||||
/**********************************************************************
|
||||
Copyright (C) 2019 MisfitTech LLC, All rights reserved.
|
||||
|
||||
MisfitTech uses a dual license model that allows the software to be used under
|
||||
a standard GPL open source license, or a commercial license. The standard GPL
|
||||
license requires that all software statically linked with MisfitTec Code is
|
||||
also distributed under the same GPL V2 license terms. Details of both license
|
||||
options follow:
|
||||
|
||||
- Open source licensing -
|
||||
MisfitTech is a free download and may be used, modified, evaluated and
|
||||
distributed without charge provided the user adheres to version two of the GNU
|
||||
General Public License (GPL) and does not remove the copyright notice or this
|
||||
text. The GPL V2 text is available on the gnu.org web site
|
||||
|
||||
- Commercial licensing -
|
||||
Businesses and individuals that for commercial or other reasons cannot comply
|
||||
with the terms of the GPL V2 license must obtain a low cost commercial license
|
||||
before incorporating MisfitTech code into proprietary software for distribution in
|
||||
any form. Commercial licenses can be purchased from www.misfittech.net
|
||||
and do not require any source files to be changed.
|
||||
|
||||
|
||||
This code is distributed in the hope that it will be useful. You cannot
|
||||
use MisfitTech's code unless you agree that you use the software 'as is'.
|
||||
MisfitTech's code is provided WITHOUT ANY WARRANTY; without even the implied
|
||||
warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. MisfitTech LLC disclaims all conditions and terms, be they
|
||||
implied, expressed, or statutory.
|
||||
|
||||
|
||||
Written by Trampas Stern for MisfitTech.
|
||||
|
||||
Misfit Tech invests time and resources providing this open source code,
|
||||
please support MisfitTech and open-source hardware by purchasing
|
||||
products from MisfitTech, www.misifittech.net!
|
||||
*********************************************************************/
|
||||
#ifndef A1333_H_
|
||||
#define A1333_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#define A1333_DEGREES_PER_BIT (360.0/(float)(0x7FFF))
|
||||
|
||||
class A1333 {
|
||||
private:
|
||||
int chipSelectPin;
|
||||
public:
|
||||
boolean begin(int csPin);
|
||||
int16_t readEncoderAngle(void);
|
||||
int16_t readAddress(uint16_t addr);
|
||||
int16_t readEncoderAnglePipeLineRead(void);
|
||||
void diagnostics(char *ptrStr) {return;};
|
||||
bool getError(void) {return false;};
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* A1333_H_ */
|
||||
/**********************************************************************
|
||||
Copyright (C) 2019 MisfitTech LLC, All rights reserved.
|
||||
|
||||
MisfitTech uses a dual license model that allows the software to be used under
|
||||
a standard GPL open source license, or a commercial license. The standard GPL
|
||||
license requires that all software statically linked with MisfitTec Code is
|
||||
also distributed under the same GPL V2 license terms. Details of both license
|
||||
options follow:
|
||||
|
||||
- Open source licensing -
|
||||
MisfitTech is a free download and may be used, modified, evaluated and
|
||||
distributed without charge provided the user adheres to version two of the GNU
|
||||
General Public License (GPL) and does not remove the copyright notice or this
|
||||
text. The GPL V2 text is available on the gnu.org web site
|
||||
|
||||
- Commercial licensing -
|
||||
Businesses and individuals that for commercial or other reasons cannot comply
|
||||
with the terms of the GPL V2 license must obtain a low cost commercial license
|
||||
before incorporating MisfitTech code into proprietary software for distribution in
|
||||
any form. Commercial licenses can be purchased from www.misfittech.net
|
||||
and do not require any source files to be changed.
|
||||
|
||||
|
||||
This code is distributed in the hope that it will be useful. You cannot
|
||||
use MisfitTech's code unless you agree that you use the software 'as is'.
|
||||
MisfitTech's code is provided WITHOUT ANY WARRANTY; without even the implied
|
||||
warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. MisfitTech LLC disclaims all conditions and terms, be they
|
||||
implied, expressed, or statutory.
|
||||
|
||||
|
||||
Written by Trampas Stern for MisfitTech.
|
||||
|
||||
Misfit Tech invests time and resources providing this open source code,
|
||||
please support MisfitTech and open-source hardware by purchasing
|
||||
products from MisfitTech, www.misifittech.net!
|
||||
*********************************************************************/
|
||||
#ifndef A1333_H_
|
||||
#define A1333_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#define A1333_DEGREES_PER_BIT (360.0/(float)(0x7FFF))
|
||||
|
||||
class A1333 {
|
||||
private:
|
||||
int chipSelectPin;
|
||||
public:
|
||||
boolean begin(int csPin);
|
||||
int16_t readEncoderAngle(void);
|
||||
int16_t readAddress(uint16_t addr);
|
||||
int16_t readEncoderAnglePipeLineRead(void);
|
||||
void diagnostics(char *ptrStr) {return;};
|
||||
bool getError(void) {return false;};
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* A1333_H_ */
|
||||
|
@ -1,412 +1,412 @@
|
||||
/**********************************************************************
|
||||
Copyright (C) 2018 MisfitTech LLC, All rights reserved.
|
||||
|
||||
MisfitTech uses a dual license model that allows the software to be used under
|
||||
a standard GPL open source license, or a commercial license. The standard GPL
|
||||
license requires that all software statically linked with MisfitTec Code is
|
||||
also distributed under the same GPL V2 license terms. Details of both license
|
||||
options follow:
|
||||
|
||||
- Open source licensing -
|
||||
MisfitTech is a free download and may be used, modified, evaluated and
|
||||
distributed without charge provided the user adheres to version two of the GNU
|
||||
General Public License (GPL) and does not remove the copyright notice or this
|
||||
text. The GPL V2 text is available on the gnu.org web site
|
||||
|
||||
- Commercial licensing -
|
||||
Businesses and individuals that for commercial or other reasons cannot comply
|
||||
with the terms of the GPL V2 license must obtain a low cost commercial license
|
||||
before incorporating MisfitTech code into proprietary software for distribution in
|
||||
any form. Commercial licenses can be purchased from www.misfittech.net
|
||||
and do not require any source files to be changed.
|
||||
|
||||
|
||||
This code is distributed in the hope that it will be useful. You cannot
|
||||
use MisfitTech's code unless you agree that you use the software 'as is'.
|
||||
MisfitTech's code is provided WITHOUT ANY WARRANTY; without even the implied
|
||||
warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. MisfitTech LLC disclaims all conditions and terms, be they
|
||||
implied, expressed, or statutory.
|
||||
|
||||
|
||||
Written by Trampas Stern for MisfitTech.
|
||||
|
||||
Misfit Tech invests time and resources providing this open source code,
|
||||
please support MisfitTech and open-source hardware by purchasing
|
||||
products from MisfitTech, www.misifittech.net!
|
||||
*********************************************************************/
|
||||
#include "A4954.h"
|
||||
#include "wiring_private.h"
|
||||
#include "syslog.h"
|
||||
#include "angle.h"
|
||||
#include "Arduino.h"
|
||||
#include "sine.h"
|
||||
|
||||
static uint8_t pinState=0;
|
||||
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize ("-Ofast")
|
||||
|
||||
|
||||
|
||||
|
||||
#define DAC_MAX (0x01FFL)
|
||||
// Wait for synchronization of registers between the clock domains
|
||||
static __inline__ void syncTCC(Tcc* TCCx) __attribute__((always_inline, unused));
|
||||
static void syncTCC(Tcc* TCCx) {
|
||||
//int32_t t0=1000;
|
||||
while (TCCx->SYNCBUSY.reg & TCC_SYNCBUSY_MASK)
|
||||
{
|
||||
// t0--;
|
||||
// if (t0==0)
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static inline void bridge1(int state)
|
||||
{
|
||||
if (state==0)
|
||||
{
|
||||
PORT->Group[g_APinDescription[PIN_A4954_IN1].ulPort].PINCFG[g_APinDescription[PIN_A4954_IN1].ulPin].bit.PMUXEN = 0;
|
||||
GPIO_OUTPUT(PIN_A4954_IN1);//pinMode(PIN_A4954_IN1,OUTPUT);
|
||||
GPIO_OUTPUT(PIN_A4954_IN2);//pinMode(PIN_A4954_IN2,OUTPUT);
|
||||
GPIO_HIGH(PIN_A4954_IN1);// digitalWrite(PIN_A4954_IN1, HIGH);
|
||||
GPIO_LOW(PIN_A4954_IN2);//digitalWrite(PIN_A4954_IN2, LOW);
|
||||
//pinPeripheral(PIN_A4954_IN2, PIO_TIMER_ALT);
|
||||
pinState=(pinState & 0x0C) | 0x1;
|
||||
}
|
||||
if (state==1)
|
||||
{
|
||||
PORT->Group[g_APinDescription[PIN_A4954_IN2].ulPort].PINCFG[g_APinDescription[PIN_A4954_IN2].ulPin].bit.PMUXEN = 0;
|
||||
GPIO_OUTPUT(PIN_A4954_IN2);//pinMode(PIN_A4954_IN2,OUTPUT);
|
||||
GPIO_OUTPUT(PIN_A4954_IN1);pinMode(PIN_A4954_IN1,OUTPUT);
|
||||
GPIO_LOW(PIN_A4954_IN1);//digitalWrite(PIN_A4954_IN1, LOW);
|
||||
GPIO_HIGH(PIN_A4954_IN2);//digitalWrite(PIN_A4954_IN2, HIGH);
|
||||
//pinPeripheral(PIN_A4954_IN1, PIO_TIMER);
|
||||
pinState=(pinState & 0x0C) | 0x2;
|
||||
}
|
||||
if (state==3)
|
||||
{
|
||||
GPIO_LOW(PIN_A4954_IN1);
|
||||
GPIO_LOW(PIN_A4954_IN2);
|
||||
//digitalWrite(PIN_A4954_IN1, LOW);
|
||||
//digitalWrite(PIN_A4954_IN2, LOW);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void bridge2(int state)
|
||||
{
|
||||
if (state==0)
|
||||
{
|
||||
PORT->Group[g_APinDescription[PIN_A4954_IN3].ulPort].PINCFG[g_APinDescription[PIN_A4954_IN3].ulPin].bit.PMUXEN = 0;
|
||||
GPIO_OUTPUT(PIN_A4954_IN3); //pinMode(PIN_A4954_IN3,OUTPUT);
|
||||
GPIO_OUTPUT(PIN_A4954_IN4);//pinMode(PIN_A4954_IN4,OUTPUT);
|
||||
GPIO_HIGH(PIN_A4954_IN3);//digitalWrite(PIN_A4954_IN3, HIGH);
|
||||
GPIO_LOW(PIN_A4954_IN4);//digitalWrite(PIN_A4954_IN4, LOW);
|
||||
//pinPeripheral(PIN_A4954_IN4, PIO_TIMER_ALT);
|
||||
pinState=(pinState & 0x03) | 0x4;
|
||||
}
|
||||
if (state==1)
|
||||
{
|
||||
PORT->Group[g_APinDescription[PIN_A4954_IN4].ulPort].PINCFG[g_APinDescription[PIN_A4954_IN4].ulPin].bit.PMUXEN = 0;
|
||||
GPIO_OUTPUT(PIN_A4954_IN4);//pinMode(PIN_A4954_IN4,OUTPUT);
|
||||
GPIO_OUTPUT(PIN_A4954_IN3);//pinMode(PIN_A4954_IN3,OUTPUT);
|
||||
GPIO_LOW(PIN_A4954_IN3);//digitalWrite(PIN_A4954_IN3, LOW);
|
||||
GPIO_HIGH(PIN_A4954_IN4);//digitalWrite(PIN_A4954_IN4, HIGH);
|
||||
//pinPeripheral(PIN_A4954_IN3, PIO_TIMER_ALT);
|
||||
pinState=(pinState & 0x03) | 0x8;
|
||||
}
|
||||
if (state==3)
|
||||
{
|
||||
GPIO_LOW(PIN_A4954_IN3);
|
||||
GPIO_LOW(PIN_A4954_IN4);
|
||||
//digitalWrite(PIN_A4954_IN3, LOW);
|
||||
//digitalWrite(PIN_A4954_IN4, LOW);
|
||||
}
|
||||
}
|
||||
|
||||
static void enableTCC0(uint8_t percent)
|
||||
{
|
||||
#ifdef MECHADUINO_HARDWARE
|
||||
return;
|
||||
#else
|
||||
Tcc* TCCx = TCC0 ;
|
||||
|
||||
|
||||
uint32_t ulValue=((uint32_t)(100-percent)*480)/100;
|
||||
//ERROR("Enable TCC0");
|
||||
|
||||
GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TCC0_TCC1 )) ;
|
||||
|
||||
while ( GCLK->STATUS.bit.SYNCBUSY == 1 ) ;
|
||||
|
||||
//ERROR("Setting TCC %d %d",ulValue,ulPin);
|
||||
TCCx->CTRLA.reg &= ~TCC_CTRLA_ENABLE;
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Set TCx as normal PWM
|
||||
TCCx->WAVE.reg |= TCC_WAVE_WAVEGEN_NPWM;
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Set TCx in waveform mode Normal PWM
|
||||
TCCx->CC[1].reg = (uint32_t)ulValue; //ch5 //IN3
|
||||
syncTCC(TCCx);
|
||||
|
||||
TCCx->CC[2].reg = (uint32_t)ulValue; //ch6 //IN4
|
||||
syncTCC(TCCx);
|
||||
|
||||
TCCx->CC[3].reg = (uint32_t)ulValue; //ch7 //IN2
|
||||
syncTCC(TCCx);
|
||||
|
||||
TCCx->CC[1].reg = (uint32_t)ulValue; //ch1 == ch5 //IN1
|
||||
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Set PER to maximum counter value (resolution : 0xFF)
|
||||
TCCx->PER.reg = DAC_MAX;
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Enable TCCx
|
||||
TCCx->CTRLA.reg |= TCC_CTRLA_ENABLE ;
|
||||
syncTCC(TCCx);
|
||||
//ERROR("Enable TCC0 DONE");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void setDAC(uint32_t DAC1, uint32_t DAC2)
|
||||
{
|
||||
TCC1->CC[1].reg = (uint32_t)DAC1; //D9 PA07 - VREF12
|
||||
syncTCC(TCC1);
|
||||
TCC1->CC[0].reg = (uint32_t)DAC2; //D4 - VREF34
|
||||
syncTCC(TCC1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void setupDAC(void)
|
||||
{
|
||||
Tcc* TCCx = TCC1 ;
|
||||
|
||||
|
||||
pinPeripheral(PIN_A4954_VREF34, PIO_TIMER_ALT);
|
||||
pinPeripheral(PIN_A4954_VREF12, PIO_TIMER);
|
||||
|
||||
GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TCC0_TCC1 )) ;
|
||||
|
||||
while ( GCLK->STATUS.bit.SYNCBUSY == 1 ) ;
|
||||
|
||||
//ERROR("Setting TCC %d %d",ulValue,ulPin);
|
||||
TCCx->CTRLA.reg &= ~TCC_CTRLA_ENABLE;
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Set TCx as normal PWM
|
||||
TCCx->WAVE.reg |= TCC_WAVE_WAVEGEN_NPWM;
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Set TCx in waveform mode Normal PWM
|
||||
TCCx->CC[1].reg = (uint32_t)0;
|
||||
syncTCC(TCCx);
|
||||
|
||||
TCCx->CC[0].reg = (uint32_t)0;
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Set PER to maximum counter value (resolution : 0xFFF = 12 bits)
|
||||
// =48e6/2^12=11kHz frequency
|
||||
TCCx->PER.reg = DAC_MAX;
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Enable TCCx
|
||||
TCCx->CTRLA.reg |= TCC_CTRLA_ENABLE ;
|
||||
syncTCC(TCCx);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void A4954::begin()
|
||||
{
|
||||
//setup the A4954 pins
|
||||
digitalWrite(PIN_A4954_IN3,LOW);
|
||||
pinMode(PIN_A4954_IN3,OUTPUT);
|
||||
digitalWrite(PIN_A4954_IN4,LOW);
|
||||
pinMode(PIN_A4954_IN4,OUTPUT);
|
||||
digitalWrite(PIN_A4954_IN2,LOW);
|
||||
pinMode(PIN_A4954_IN2,OUTPUT);
|
||||
digitalWrite(PIN_A4954_IN1,LOW);
|
||||
pinMode(PIN_A4954_IN1,OUTPUT);
|
||||
|
||||
//setup the PWM for current on the A4954, set for low current
|
||||
digitalWrite(PIN_A4954_VREF12,LOW);
|
||||
digitalWrite(PIN_A4954_VREF34,LOW);
|
||||
pinMode(PIN_A4954_VREF34, OUTPUT);
|
||||
pinMode(PIN_A4954_VREF12, OUTPUT);
|
||||
|
||||
enabled=true;
|
||||
lastStepMicros=0;
|
||||
forwardRotation=true;
|
||||
|
||||
enableTCC0(90);
|
||||
setupDAC();
|
||||
//
|
||||
// int i=0;
|
||||
// bridge1(0);
|
||||
// bridge2(0);
|
||||
//while (1)
|
||||
// {
|
||||
// int32_t x;
|
||||
// WARNING("MA %d",i);
|
||||
// x=(int32_t)((int64_t)i*(DAC_MAX))/3300;
|
||||
// setDAC(x,x);
|
||||
// delay(1000);
|
||||
// i=i+10;
|
||||
// if (i>1000)
|
||||
// {
|
||||
// i=0;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
//
|
||||
// WARNING("Setting DAC for 500mA output");
|
||||
// setDAC((int32_t)((int64_t)1000*(DAC_MAX))/3300,(int32_t)((int64_t)1000*(DAC_MAX))/3300);
|
||||
// bridge1(0);
|
||||
// bridge2(0);
|
||||
// while(1)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
return;
|
||||
}
|
||||
|
||||
void A4954::limitCurrent(uint8_t percent)
|
||||
{
|
||||
#ifdef MECHADUINO_HARDWARE
|
||||
return;
|
||||
#else
|
||||
//WARNING("current limit %d",percent);
|
||||
enableTCC0(percent);
|
||||
if (pinState & 0x01)
|
||||
{
|
||||
pinPeripheral(PIN_A4954_IN2, PIO_TIMER_ALT); //TCC0 WO[7]
|
||||
}
|
||||
if (pinState & 0x02)
|
||||
{
|
||||
pinPeripheral(PIN_A4954_IN1, PIO_TIMER); //TCC0 WO[1]
|
||||
}
|
||||
if (pinState & 0x04)
|
||||
{
|
||||
pinPeripheral(PIN_A4954_IN4, PIO_TIMER_ALT);
|
||||
}
|
||||
if (pinState & 0x08)
|
||||
{
|
||||
pinPeripheral(PIN_A4954_IN3, PIO_TIMER_ALT);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void A4954::enable(bool enable)
|
||||
{
|
||||
enabled=enable;
|
||||
if (enabled == false)
|
||||
{
|
||||
WARNING("A4954 disabled");
|
||||
setDAC(0,0); //turn current off
|
||||
bridge1(3); //tri state bridge outputs
|
||||
bridge2(3); //tri state bridge outputs
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//this is precise move and modulo of A4954_NUM_MICROSTEPS is a full step.
|
||||
// stepAngle is in A4954_NUM_MICROSTEPS units..
|
||||
// The A4954 has no idea where the motor is, so the calling function has to
|
||||
// to tell the A4954 what phase to drive motor coils.
|
||||
// A4954_NUM_MICROSTEPS is 256 by default so stepAngle of 1024 is 360 degrees
|
||||
// Note you can only move up to +/-A4954_NUM_MICROSTEPS from where you
|
||||
// currently are.
|
||||
int32_t A4954::move(int32_t stepAngle, uint32_t mA)
|
||||
{
|
||||
uint16_t angle;
|
||||
int32_t cos,sin;
|
||||
int32_t dacSin,dacCos;
|
||||
//static int i=0;
|
||||
|
||||
if (enabled == false)
|
||||
{
|
||||
//WARNING("A4954 disabled");
|
||||
setDAC(0,0); //turn current off
|
||||
bridge1(3); //tri state bridge outputs
|
||||
bridge2(3); //tri state bridge outputs
|
||||
return stepAngle;
|
||||
}
|
||||
|
||||
//WARNING("move %d %d",stepAngle,mA);
|
||||
//handle roll overs, could do with modulo operator
|
||||
stepAngle=stepAngle%SINE_STEPS;
|
||||
|
||||
//figure out our sine Angle
|
||||
// note our SINE_STEPS is 4x of microsteps for a reason
|
||||
//angle=(stepAngle+(SINE_STEPS/8)) % SINE_STEPS;
|
||||
angle=(stepAngle);
|
||||
|
||||
//calculate the sine and cosine of our angle
|
||||
sin=sine(angle);
|
||||
cos=cosine(angle);
|
||||
|
||||
//if we are reverse swap the sign of one of the angels
|
||||
if (false == forwardRotation)
|
||||
{
|
||||
cos=-cos;
|
||||
}
|
||||
|
||||
//scale sine result by current(mA)
|
||||
dacSin=((int32_t)mA*(int64_t)abs(sin))/SINE_MAX;
|
||||
|
||||
//scale cosine result by current(mA)
|
||||
dacCos=((int32_t)mA*(int64_t)abs(cos))/SINE_MAX;
|
||||
|
||||
// if (i==0)
|
||||
// {
|
||||
// WARNING("dacs are %d %d",dacSin,dacCos);
|
||||
// }
|
||||
|
||||
//convert value into DAC scaled to 3300mA max
|
||||
dacCos=(int32_t)((int64_t)dacCos*(DAC_MAX))/3300;
|
||||
//convert value into DAC scaled to 3300mA max
|
||||
dacSin=(int32_t)((int64_t)dacSin*(DAC_MAX))/3300;
|
||||
|
||||
//WARNING("dacs are %d %d ",dacSin,dacCos);
|
||||
|
||||
setDAC(dacSin,dacCos);
|
||||
|
||||
if (sin>0)
|
||||
{
|
||||
bridge1(1);
|
||||
}else
|
||||
{
|
||||
bridge1(0);
|
||||
}
|
||||
if (cos>0)
|
||||
{
|
||||
bridge2(1);
|
||||
}else
|
||||
{
|
||||
bridge2(0);
|
||||
}
|
||||
|
||||
// if (i++>3000)
|
||||
// {
|
||||
// i=0;
|
||||
// }
|
||||
// YELLOW_LED(led);
|
||||
// led=(led+1) & 0x01;
|
||||
lastStepMicros=micros();
|
||||
return stepAngle;
|
||||
}
|
||||
#pragma GCC pop_options
|
||||
|
||||
/**********************************************************************
|
||||
Copyright (C) 2018 MisfitTech LLC, All rights reserved.
|
||||
|
||||
MisfitTech uses a dual license model that allows the software to be used under
|
||||
a standard GPL open source license, or a commercial license. The standard GPL
|
||||
license requires that all software statically linked with MisfitTec Code is
|
||||
also distributed under the same GPL V2 license terms. Details of both license
|
||||
options follow:
|
||||
|
||||
- Open source licensing -
|
||||
MisfitTech is a free download and may be used, modified, evaluated and
|
||||
distributed without charge provided the user adheres to version two of the GNU
|
||||
General Public License (GPL) and does not remove the copyright notice or this
|
||||
text. The GPL V2 text is available on the gnu.org web site
|
||||
|
||||
- Commercial licensing -
|
||||
Businesses and individuals that for commercial or other reasons cannot comply
|
||||
with the terms of the GPL V2 license must obtain a low cost commercial license
|
||||
before incorporating MisfitTech code into proprietary software for distribution in
|
||||
any form. Commercial licenses can be purchased from www.misfittech.net
|
||||
and do not require any source files to be changed.
|
||||
|
||||
|
||||
This code is distributed in the hope that it will be useful. You cannot
|
||||
use MisfitTech's code unless you agree that you use the software 'as is'.
|
||||
MisfitTech's code is provided WITHOUT ANY WARRANTY; without even the implied
|
||||
warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. MisfitTech LLC disclaims all conditions and terms, be they
|
||||
implied, expressed, or statutory.
|
||||
|
||||
|
||||
Written by Trampas Stern for MisfitTech.
|
||||
|
||||
Misfit Tech invests time and resources providing this open source code,
|
||||
please support MisfitTech and open-source hardware by purchasing
|
||||
products from MisfitTech, www.misifittech.net!
|
||||
*********************************************************************/
|
||||
#include "A4954.h"
|
||||
#include "wiring_private.h"
|
||||
#include "syslog.h"
|
||||
#include "angle.h"
|
||||
#include "Arduino.h"
|
||||
#include "sine.h"
|
||||
|
||||
static uint8_t pinState=0;
|
||||
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize ("-Ofast")
|
||||
|
||||
|
||||
|
||||
|
||||
#define DAC_MAX (0x01FFL)
|
||||
// Wait for synchronization of registers between the clock domains
|
||||
static __inline__ void syncTCC(Tcc* TCCx) __attribute__((always_inline, unused));
|
||||
static void syncTCC(Tcc* TCCx) {
|
||||
//int32_t t0=1000;
|
||||
while (TCCx->SYNCBUSY.reg & TCC_SYNCBUSY_MASK)
|
||||
{
|
||||
// t0--;
|
||||
// if (t0==0)
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static inline void bridge1(int state)
|
||||
{
|
||||
if (state==0)
|
||||
{
|
||||
PORT->Group[g_APinDescription[PIN_A4954_IN1].ulPort].PINCFG[g_APinDescription[PIN_A4954_IN1].ulPin].bit.PMUXEN = 0;
|
||||
GPIO_OUTPUT(PIN_A4954_IN1);//pinMode(PIN_A4954_IN1,OUTPUT);
|
||||
GPIO_OUTPUT(PIN_A4954_IN2);//pinMode(PIN_A4954_IN2,OUTPUT);
|
||||
GPIO_HIGH(PIN_A4954_IN1);// digitalWrite(PIN_A4954_IN1, HIGH);
|
||||
GPIO_LOW(PIN_A4954_IN2);//digitalWrite(PIN_A4954_IN2, LOW);
|
||||
//pinPeripheral(PIN_A4954_IN2, PIO_TIMER_ALT);
|
||||
pinState=(pinState & 0x0C) | 0x1;
|
||||
}
|
||||
if (state==1)
|
||||
{
|
||||
PORT->Group[g_APinDescription[PIN_A4954_IN2].ulPort].PINCFG[g_APinDescription[PIN_A4954_IN2].ulPin].bit.PMUXEN = 0;
|
||||
GPIO_OUTPUT(PIN_A4954_IN2);//pinMode(PIN_A4954_IN2,OUTPUT);
|
||||
GPIO_OUTPUT(PIN_A4954_IN1);pinMode(PIN_A4954_IN1,OUTPUT);
|
||||
GPIO_LOW(PIN_A4954_IN1);//digitalWrite(PIN_A4954_IN1, LOW);
|
||||
GPIO_HIGH(PIN_A4954_IN2);//digitalWrite(PIN_A4954_IN2, HIGH);
|
||||
//pinPeripheral(PIN_A4954_IN1, PIO_TIMER);
|
||||
pinState=(pinState & 0x0C) | 0x2;
|
||||
}
|
||||
if (state==3)
|
||||
{
|
||||
GPIO_LOW(PIN_A4954_IN1);
|
||||
GPIO_LOW(PIN_A4954_IN2);
|
||||
//digitalWrite(PIN_A4954_IN1, LOW);
|
||||
//digitalWrite(PIN_A4954_IN2, LOW);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void bridge2(int state)
|
||||
{
|
||||
if (state==0)
|
||||
{
|
||||
PORT->Group[g_APinDescription[PIN_A4954_IN3].ulPort].PINCFG[g_APinDescription[PIN_A4954_IN3].ulPin].bit.PMUXEN = 0;
|
||||
GPIO_OUTPUT(PIN_A4954_IN3); //pinMode(PIN_A4954_IN3,OUTPUT);
|
||||
GPIO_OUTPUT(PIN_A4954_IN4);//pinMode(PIN_A4954_IN4,OUTPUT);
|
||||
GPIO_HIGH(PIN_A4954_IN3);//digitalWrite(PIN_A4954_IN3, HIGH);
|
||||
GPIO_LOW(PIN_A4954_IN4);//digitalWrite(PIN_A4954_IN4, LOW);
|
||||
//pinPeripheral(PIN_A4954_IN4, PIO_TIMER_ALT);
|
||||
pinState=(pinState & 0x03) | 0x4;
|
||||
}
|
||||
if (state==1)
|
||||
{
|
||||
PORT->Group[g_APinDescription[PIN_A4954_IN4].ulPort].PINCFG[g_APinDescription[PIN_A4954_IN4].ulPin].bit.PMUXEN = 0;
|
||||
GPIO_OUTPUT(PIN_A4954_IN4);//pinMode(PIN_A4954_IN4,OUTPUT);
|
||||
GPIO_OUTPUT(PIN_A4954_IN3);//pinMode(PIN_A4954_IN3,OUTPUT);
|
||||
GPIO_LOW(PIN_A4954_IN3);//digitalWrite(PIN_A4954_IN3, LOW);
|
||||
GPIO_HIGH(PIN_A4954_IN4);//digitalWrite(PIN_A4954_IN4, HIGH);
|
||||
//pinPeripheral(PIN_A4954_IN3, PIO_TIMER_ALT);
|
||||
pinState=(pinState & 0x03) | 0x8;
|
||||
}
|
||||
if (state==3)
|
||||
{
|
||||
GPIO_LOW(PIN_A4954_IN3);
|
||||
GPIO_LOW(PIN_A4954_IN4);
|
||||
//digitalWrite(PIN_A4954_IN3, LOW);
|
||||
//digitalWrite(PIN_A4954_IN4, LOW);
|
||||
}
|
||||
}
|
||||
|
||||
static void enableTCC0(uint8_t percent)
|
||||
{
|
||||
#ifdef MECHADUINO_HARDWARE
|
||||
return;
|
||||
#else
|
||||
Tcc* TCCx = TCC0 ;
|
||||
|
||||
|
||||
uint32_t ulValue=((uint32_t)(100-percent)*480)/100;
|
||||
//ERROR("Enable TCC0");
|
||||
|
||||
GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TCC0_TCC1 )) ;
|
||||
|
||||
while ( GCLK->STATUS.bit.SYNCBUSY == 1 ) ;
|
||||
|
||||
//ERROR("Setting TCC %d %d",ulValue,ulPin);
|
||||
TCCx->CTRLA.reg &= ~TCC_CTRLA_ENABLE;
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Set TCx as normal PWM
|
||||
TCCx->WAVE.reg |= TCC_WAVE_WAVEGEN_NPWM;
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Set TCx in waveform mode Normal PWM
|
||||
TCCx->CC[1].reg = (uint32_t)ulValue; //ch5 //IN3
|
||||
syncTCC(TCCx);
|
||||
|
||||
TCCx->CC[2].reg = (uint32_t)ulValue; //ch6 //IN4
|
||||
syncTCC(TCCx);
|
||||
|
||||
TCCx->CC[3].reg = (uint32_t)ulValue; //ch7 //IN2
|
||||
syncTCC(TCCx);
|
||||
|
||||
TCCx->CC[1].reg = (uint32_t)ulValue; //ch1 == ch5 //IN1
|
||||
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Set PER to maximum counter value (resolution : 0xFF)
|
||||
TCCx->PER.reg = DAC_MAX;
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Enable TCCx
|
||||
TCCx->CTRLA.reg |= TCC_CTRLA_ENABLE ;
|
||||
syncTCC(TCCx);
|
||||
//ERROR("Enable TCC0 DONE");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void setDAC(uint32_t DAC1, uint32_t DAC2)
|
||||
{
|
||||
TCC1->CC[1].reg = (uint32_t)DAC1; //D9 PA07 - VREF12
|
||||
syncTCC(TCC1);
|
||||
TCC1->CC[0].reg = (uint32_t)DAC2; //D4 - VREF34
|
||||
syncTCC(TCC1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void setupDAC(void)
|
||||
{
|
||||
Tcc* TCCx = TCC1 ;
|
||||
|
||||
|
||||
pinPeripheral(PIN_A4954_VREF34, PIO_TIMER_ALT);
|
||||
pinPeripheral(PIN_A4954_VREF12, PIO_TIMER);
|
||||
|
||||
GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID( GCM_TCC0_TCC1 )) ;
|
||||
|
||||
while ( GCLK->STATUS.bit.SYNCBUSY == 1 ) ;
|
||||
|
||||
//ERROR("Setting TCC %d %d",ulValue,ulPin);
|
||||
TCCx->CTRLA.reg &= ~TCC_CTRLA_ENABLE;
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Set TCx as normal PWM
|
||||
TCCx->WAVE.reg |= TCC_WAVE_WAVEGEN_NPWM;
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Set TCx in waveform mode Normal PWM
|
||||
TCCx->CC[1].reg = (uint32_t)0;
|
||||
syncTCC(TCCx);
|
||||
|
||||
TCCx->CC[0].reg = (uint32_t)0;
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Set PER to maximum counter value (resolution : 0xFFF = 12 bits)
|
||||
// =48e6/2^12=11kHz frequency
|
||||
TCCx->PER.reg = DAC_MAX;
|
||||
syncTCC(TCCx);
|
||||
|
||||
// Enable TCCx
|
||||
TCCx->CTRLA.reg |= TCC_CTRLA_ENABLE ;
|
||||
syncTCC(TCCx);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void A4954::begin()
|
||||
{
|
||||
//setup the A4954 pins
|
||||
digitalWrite(PIN_A4954_IN3,LOW);
|
||||
pinMode(PIN_A4954_IN3,OUTPUT);
|
||||
digitalWrite(PIN_A4954_IN4,LOW);
|
||||
pinMode(PIN_A4954_IN4,OUTPUT);
|
||||
digitalWrite(PIN_A4954_IN2,LOW);
|
||||
pinMode(PIN_A4954_IN2,OUTPUT);
|
||||
digitalWrite(PIN_A4954_IN1,LOW);
|
||||
pinMode(PIN_A4954_IN1,OUTPUT);
|
||||
|
||||
//setup the PWM for current on the A4954, set for low current
|
||||
digitalWrite(PIN_A4954_VREF12,LOW);
|
||||
digitalWrite(PIN_A4954_VREF34,LOW);
|
||||
pinMode(PIN_A4954_VREF34, OUTPUT);
|
||||
pinMode(PIN_A4954_VREF12, OUTPUT);
|
||||
|
||||
enabled=true;
|
||||
lastStepMicros=0;
|
||||
forwardRotation=true;
|
||||
|
||||
enableTCC0(90);
|
||||
setupDAC();
|
||||
//
|
||||
// int i=0;
|
||||
// bridge1(0);
|
||||
// bridge2(0);
|
||||
//while (1)
|
||||
// {
|
||||
// int32_t x;
|
||||
// WARNING("MA %d",i);
|
||||
// x=(int32_t)((int64_t)i*(DAC_MAX))/3300;
|
||||
// setDAC(x,x);
|
||||
// delay(1000);
|
||||
// i=i+10;
|
||||
// if (i>1000)
|
||||
// {
|
||||
// i=0;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
//
|
||||
// WARNING("Setting DAC for 500mA output");
|
||||
// setDAC((int32_t)((int64_t)1000*(DAC_MAX))/3300,(int32_t)((int64_t)1000*(DAC_MAX))/3300);
|
||||
// bridge1(0);
|
||||
// bridge2(0);
|
||||
// while(1)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
return;
|
||||
}
|
||||
|
||||
void A4954::limitCurrent(uint8_t percent)
|
||||
{
|
||||
#ifdef MECHADUINO_HARDWARE
|
||||
return;
|
||||
#else
|
||||
//WARNING("current limit %d",percent);
|
||||
enableTCC0(percent);
|
||||
if (pinState & 0x01)
|
||||
{
|
||||
pinPeripheral(PIN_A4954_IN2, PIO_TIMER_ALT); //TCC0 WO[7]
|
||||
}
|
||||
if (pinState & 0x02)
|
||||
{
|
||||
pinPeripheral(PIN_A4954_IN1, PIO_TIMER); //TCC0 WO[1]
|
||||
}
|
||||
if (pinState & 0x04)
|
||||
{
|
||||
pinPeripheral(PIN_A4954_IN4, PIO_TIMER_ALT);
|
||||
}
|
||||
if (pinState & 0x08)
|
||||
{
|
||||
pinPeripheral(PIN_A4954_IN3, PIO_TIMER_ALT);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void A4954::enable(bool enable)
|
||||
{
|
||||
enabled=enable;
|
||||
if (enabled == false)
|
||||
{
|
||||
WARNING("A4954 disabled");
|
||||
setDAC(0,0); //turn current off
|
||||
bridge1(3); //tri state bridge outputs
|
||||
bridge2(3); //tri state bridge outputs
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//this is precise move and modulo of A4954_NUM_MICROSTEPS is a full step.
|
||||
// stepAngle is in A4954_NUM_MICROSTEPS units..
|
||||
// The A4954 has no idea where the motor is, so the calling function has to
|
||||
// to tell the A4954 what phase to drive motor coils.
|
||||
// A4954_NUM_MICROSTEPS is 256 by default so stepAngle of 1024 is 360 degrees
|
||||
// Note you can only move up to +/-A4954_NUM_MICROSTEPS from where you
|
||||
// currently are.
|
||||
int32_t A4954::move(int32_t stepAngle, uint32_t mA)
|
||||
{
|
||||
uint16_t angle;
|
||||
int32_t cos,sin;
|
||||
int32_t dacSin,dacCos;
|
||||
//static int i=0;
|
||||
|
||||
if (enabled == false)
|
||||
{
|
||||
//WARNING("A4954 disabled");
|
||||
setDAC(0,0); //turn current off
|
||||
bridge1(3); //tri state bridge outputs
|
||||
bridge2(3); //tri state bridge outputs
|
||||
return stepAngle;
|
||||
}
|
||||
|
||||
//WARNING("move %d %d",stepAngle,mA);
|
||||
//handle roll overs, could do with modulo operator
|
||||
stepAngle=stepAngle%SINE_STEPS;
|
||||
|
||||
//figure out our sine Angle
|
||||
// note our SINE_STEPS is 4x of microsteps for a reason
|
||||
//angle=(stepAngle+(SINE_STEPS/8)) % SINE_STEPS;
|
||||
angle=(stepAngle);
|
||||
|
||||
//calculate the sine and cosine of our angle
|
||||
sin=sine(angle);
|
||||
cos=cosine(angle);
|
||||
|
||||
//if we are reverse swap the sign of one of the angels
|
||||
if (false == forwardRotation)
|
||||
{
|
||||
|