Changeset - 30ab6b66325f
[Not reviewed]
default
0 12 0
Ethan Zonca - 7 years ago 2019-09-01 19:12:19
ez@ethanzonca.com
Add pilot tone and some power-saving stuff that really doesn't help at all
12 files changed with 168 insertions and 117 deletions:
0 comments (0 inline, 0 general)
.cproject
Show inline comments
 
<?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="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1766192373">
 
			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1766192373" moduleId="org.eclipse.cdt.core.settings" name="Default">
 
				<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"/>
 
					<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
 
					<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
 
				</extensions>
 
			</storageModule>
 
			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
 
				<configuration buildProperties="" id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1766192373" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
 
				<configuration artifactName="${ProjName}" buildProperties="" description="" id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1766192373" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
 
					<folderInfo id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1766192373.916722003" name="/" resourcePath="">
 
						<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1146369181" name="Cross ARM GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
 
						<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1146369181" name="Cross ARM GCC">
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1198449147" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix.1554715887" name="Prefix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.suffix.1885501034" name="Suffix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.suffix"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.c.346952497" name="C compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.c"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp.1266843195" name="C++ compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar.1782451793" name="Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy.1789112455" name="Hex/Bin converter" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump.1560601134" name="Listing generator" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.size.1777916382" name="Size command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.size"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.make.1943186274" name="Build command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.make"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm.1022389337" name="Remove command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.useglobalpath.1260930513" name="Use global path" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.useglobalpath"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.path.2109382822" name="Path" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.path"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash.201009083" name="Create flash image" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.2029371239" name="Create extended listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize.1417132825" name="Print size" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.886776108" name="ARM family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.architecture.715051182" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.architecture"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.57929621" name="Instruction set" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.thumbinterwork.2127475074" name="Thumb interwork (-mthumb-interwork)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.thumbinterwork"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.endianness.1513782494" name="Endianness" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.endianness"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.984280418" name="Float ABI" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.1046267714" name="FPU Type" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.unalignedaccess.1997957778" name="Unaligned access" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.unalignedaccess"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.family.417556629" name="AArch64 family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.family"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crc.1171042960" name="Feature crc" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crc"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crypto.115828287" name="Feature crypto" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crypto"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.fp.347836437" name="Feature fp" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.fp"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.simd.923326490" name="Feature simd" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.simd"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.cmodel.1478055729" name="Code model" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.cmodel"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.strictalign.425477012" name="Strict align (-mstrict-align)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.strictalign"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.target.other.287127581" name="Other target flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.target.other"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.1639896660" name="Optimization Level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength.663932160" name="Message length (-fmessage-length=0)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar.1112717891" name="'char' is signed (-fsigned-char)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections.1895787086" name="Function sections (-ffunction-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections.376475877" name="Data sections (-fdata-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nocommon.41546169" name="No common unitialized (-fno-common)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nocommon"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.noinlinefunctions.907937007" name="Do not inline functions (-fno-inline-functions)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.noinlinefunctions"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.freestanding.943379977" name="Assume freestanding environment (-ffreestanding)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.freestanding"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nobuiltin.1094832149" name="Disable builtin (-fno-builtin)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nobuiltin"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.spconstant.1216743180" name="Single precision constants (-fsingle-precision-constant)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.spconstant"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.PIC.1141636173" name="Position independent code (-fPIC)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.PIC"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.lto.407397258" name="Link-time optimizer (-flto)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.lto"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nomoveloopinvariants.664318140" name="Disable loop invariant move (-fno-move-loop-invariants)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nomoveloopinvariants"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.other.956776705" name="Other optimization flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.other"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.1183413164" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.syntaxonly.895045680" name="Check syntax only (-fsyntax-only)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.syntaxonly"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedantic.1287715911" name="Pedantic (-pedantic)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedantic"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedanticerrors.1832027292" name="Pedantic warnings as errors (-pedantic-errors)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedanticerrors"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn.1879450318" name="Inhibit all warnings (-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unused.1518552242" name="Warn on various unused elements (-Wunused)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unused"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.uninitialized.203716889" name="Warn on uninitialized variables (-Wuninitialised)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.uninitialized"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn.1091316351" name="Enable all common warnings (-Wall)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn.1909483649" name="Enable extra warnings (-Wextra)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration.1895866113" name="Warn on undeclared global function (-Wmissing-declaration)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion.1298319887" name="Warn on implicit conversions (-Wconversion)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith.1586747258" name="Warn if pointer arithmetic (-Wpointer-arith)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.padded.681723980" name="Warn if padding is included (-Wpadded)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.padded"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow.703265120" name="Warn if shadowed variable (-Wshadow)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.583577881" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.1580350646" name="Warn if struct is returned (-Wagreggate-return)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.1703238434" name="Warn if floats are compared as equal (-Wfloat-equal)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors.1843343550" name="Generate errors instead of warnings (-Werror)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.other.832542964" name="Other warning flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.other"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.300518905" name="Debug level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format.925925746" name="Debug format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.prof.1656054194" name="Generate prof information (-p)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.prof"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.gprof.854647627" name="Generate gprof information (-pg)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.gprof"/>
 
							<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other.1915699559" name="Other debugging flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other"/>
 
							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.971030964" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
 
							<builder id="ilg.gnuarmeclipse.managedbuild.cross.builder.2082002245" managedBuildOn="false" name="Gnu Make Builder.Default" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.1134351891" name="Cross ARM GNU Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.1814170446" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" useByScannerDiscovery="false" value="true" valueType="boolean"/>
 
								<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.1976458517" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
 
							</tool>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.66269454" name="Cross ARM C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler">
 
								<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1877426653" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
 
							</tool>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.31521072" name="Cross ARM C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler">
 
								<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.538112757" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input"/>
 
							</tool>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.695260548" name="Cross ARM C Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker">
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections.1175234160" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections" useByScannerDiscovery="false" value="true" valueType="boolean"/>
 
							</tool>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.95766250" name="Cross ARM C++ Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker">
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections.1934782132" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections" useByScannerDiscovery="false" value="true" valueType="boolean"/>
 
								<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input.2063228079" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input">
 
									<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
 
									<additionalInput kind="additionalinput" paths="$(LIBS)"/>
 
								</inputType>
 
							</tool>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver.943394393" name="Cross ARM GNU Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver"/>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash.1947850374" name="Cross ARM GNU Create Flash Image" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash"/>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting.995734243" name="Cross ARM GNU Create Listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting">
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source.363398502" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source" useByScannerDiscovery="false" value="true" valueType="boolean"/>
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.allheaders.2134601491" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.allheaders" useByScannerDiscovery="false" value="true" valueType="boolean"/>
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.demangle.1315779547" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.demangle" useByScannerDiscovery="false" value="true" valueType="boolean"/>
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.linenumbers.75607248" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.linenumbers" useByScannerDiscovery="false" value="true" valueType="boolean"/>
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.wide.1656042397" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.wide" useByScannerDiscovery="false" value="true" valueType="boolean"/>
 
							</tool>
 
							<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.1698996853" name="Cross ARM GNU Print Size" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize">
 
								<option id="ilg.gnuarmeclipse.managedbuild.cross.option.printsize.format.1148857532" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.printsize.format" useByScannerDiscovery="false"/>
 
							</tool>
 
							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.971030964" isAbstract="false" osList="all"/>
 
							<builder id="ilg.gnuarmeclipse.managedbuild.cross.builder.2082002245" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder.Default"/>
 
						</toolChain>
 
					</folderInfo>
 
				</configuration>
 
			</storageModule>
 
			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
 
		</cconfiguration>
 
	</storageModule>
 
	<storageModule moduleId="cdtBuildSystem" version="4.0.0">
 
		<project id="wsprhab.null.265558300" name="wsprhab"/>
 
	</storageModule>
 
	<storageModule moduleId="scannerConfiguration">
 
		<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
 
		<scannerConfigBuildInfo instanceId="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.578838654;ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.578838654.1745813540;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1627171814;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.708702570">
 
			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
 
		</scannerConfigBuildInfo>
 
		<scannerConfigBuildInfo instanceId="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1599930932;ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1599930932.1311518867;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1414490389;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1890329328">
 
			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
 
		</scannerConfigBuildInfo>
 
		<scannerConfigBuildInfo instanceId="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1766192373;ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1766192373.916722003;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.66269454;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1877426653">
 
			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
 
		</scannerConfigBuildInfo>
 
		<scannerConfigBuildInfo instanceId="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.578838654;ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.578838654.1745813540;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1322080936;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1385440032">
 
			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
 
		</scannerConfigBuildInfo>
 
		<scannerConfigBuildInfo instanceId="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1599930932;ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1599930932.1311518867;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1942734127;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1739179945">
 
			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
 
		</scannerConfigBuildInfo>
 
		<scannerConfigBuildInfo instanceId="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1766192373;ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1766192373.916722003;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.31521072;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.538112757">
 
			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
 
		</scannerConfigBuildInfo>
 
	</storageModule>
 
	<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
 
	<storageModule moduleId="refreshScope"/>
 
	<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
 
</cproject>
.settings/language.settings.xml
Show inline comments
 
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 
<project>
 
	<configuration id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1766192373" name="Default">
 
		<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
 
			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
 
			<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
 
			<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
 
			<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1836845659980131172" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
 
			<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1122202595071" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
 
				<language-scope id="org.eclipse.cdt.core.gcc"/>
 
				<language-scope id="org.eclipse.cdt.core.g++"/>
 
			</provider>
 
			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
 
		</extension>
 
	</configuration>
 
</project>
Makefile
Show inline comments
 
# STM32F0xx Makefile
 
# #####################################
 
#
 
# Part of the uCtools project
 
# uctools.github.com
 
#
 
#######################################
 
# user configuration:
 
#######################################
 

	
 
BUILD_NUMBER ?= 0
 

	
 
# SOURCES: list of sources in the user application
 
SOURCES = main.c  adc.c gpio.c i2c.c interrupts.c uart.c  gps.c system_stm32f0xx.c system.c wspr.c rtc.c
 
# TARGET: name of the user application
 
TARGET = wsprhab-b$(BUILD_NUMBER)
 

	
 
# BUILD_DIR: directory to place output files in
 
BUILD_DIR = build
 

	
 
# LD_SCRIPT: location of the linker script
 
LD_SCRIPT = STM32F031G6_FLASH.ld
 

	
 
# USER_DEFS user defined macros
 
USER_DEFS = -D HSE_VALUE=16000000
 
USER_DEFS += -D WSPRHAB_BUILD_NUMBER=$(BUILD_NUMBER)
 

	
 
# USER_INCLUDES: user defined includes
 
USER_INCLUDES =
 

	
 
# USB_INCLUDES: includes for the usb library
 
# USB_INCLUDES = -IMiddlewares/ST/STM32_USB_Device_Library/Core/Inc
 
#USB_INCLUDES += -IMiddlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
 

	
 
SI5351_INCLUDES = -Ilib/si5351
 

	
 
JTENCODE_INCLUDES = -Ilib/jtencode
 

	
 
# USER_CFLAGS: user C flags (enable warnings, enable debug info)
 
USER_CFLAGS = -Wall -g -ffunction-sections -fdata-sections -Os -fno-common --function-sections -fdata-sections 
 
USER_CFLAGS += -flto
 
#USER_CFLAGS += -flto
 

	
 
# USER_LDFLAGS:  user LD flags
 
USER_LDFLAGS = -fno-exceptions -ffunction-sections -fdata-sections -Wl,--gc-sections 
 
USER_LDFLAGS += -flto
 
USER_LDFLAGS += --static
 
#USER_LDFLAGS += -nostartfiles 
 

	
 
# TARGET_DEVICE: device to compile for
 
TARGET_DEVICE = STM32F031x6
 

	
 
#######################################
 
# end of user configuration
 
#######################################
 
#
 
#######################################
 
# binaries
 
#######################################
 
CC = arm-none-eabi-gcc
 
AR = arm-none-eabi-ar
 
RANLIB = arm-none-eabi-ranlib
 
SIZE = arm-none-eabi-size
 
OBJCOPY = arm-none-eabi-objcopy
 
MKDIR = mkdir -p
 
#######################################
 

	
 
# core and CPU type for Cortex M0
 
# ARM core type (CORE_M0, CORE_M3)
 
CORE = CORE_M0
 
# ARM CPU type (cortex-m0, cortex-m3)
 
CPU = cortex-m0
 

	
 
# where to build STM32Cube
 
CUBELIB_BUILD_DIR = $(BUILD_DIR)/STM32Cube
 

	
 
# various paths within the STmicro library
 
CMSIS_PATH = drivers/CMSIS
 
CMSIS_DEVICE_PATH = $(CMSIS_PATH)/Device/ST/STM32F0xx
 
DRIVER_PATH = drivers/STM32F0xx_HAL_Driver
 

	
 

	
 
# includes for gcc
 
INCLUDES = -I$(CMSIS_PATH)/Include
 
INCLUDES += -I$(CMSIS_DEVICE_PATH)/Include
 
INCLUDES += -I$(DRIVER_PATH)/Inc
 
INCLUDES += -Iinc
 
#INCLUDES += $(USB_INCLUDES)
 
INCLUDES += $(USER_INCLUDES)
 
INCLUDES += $(SI5351_INCLUDES)
inc/config.h
Show inline comments
 
#ifndef CONFIG_H
 
#define CONFIG_H
 

	
 

	
 
// --------------------------------------------------------------------------
 
// Transmitter config 
 
// --------------------------------------------------------------------------
 

	
 

	
 
//#define LED_DISABLE
 

	
 
// --------------------------------------------------------------------------
 
// ADC config (adc.c)
 
// --------------------------------------------------------------------------
 

	
 
// Temperature sensor offset (die temperature from ambient, esimate, in Celcius)
 
// Temperature sensor offset (die temperature from ambient, estimate, in Celcius)
 
#define ADC_TEMPERATURE_OFFSET -10
 

	
 

	
 
// --------------------------------------------------------------------------
 
// AX.25 config (ax25.c)
 
// --------------------------------------------------------------------------
 

	
 
// TX delay in milliseconds
 
#define TX_DELAY      500
 

	
 
// Maximum packet delay
 
#define MAX_PACKET_LEN 512  // bytes
 

	
 

	
 
// --------------------------------------------------------------------------
 
// APRS config (aprs.c)
 
// --------------------------------------------------------------------------
 

	
 
// Set your callsign and SSID here. Common values for the SSID are
 
// (from http://zlhams.wikidot.com/aprs-ssidguide):
 
//
 
// - Balloons:  11
 
// - Cars:       9
 
// - Home:       0
 
// - IGate:      5
 
#define S_CALLSIGN      "KD8TDF"
 
#define S_CALLSIGN_ID   11
 

	
 
// Destination callsign: APRS (with SSID=0) is usually okay.
 
#define D_CALLSIGN      "APRS"
 
#define D_CALLSIGN_ID   0
 

	
 
// Digipeating paths:
 
// (read more about digipeating paths here: http://wa8lmf.net/DigiPaths/ )
 
// The recommended digi path for a balloon is WIDE2-1 or pathless. The default
 
// is pathless. Uncomment the following two lines for WIDE2-1 path:
 
#define DIGI_PATH1      "WIDE2"
 
#define DIGI_PATH1_TTL  1
 

	
 
// Transmit the APRS sentence every X milliseconds
 
#define APRS_TRANSMIT_PERIOD 60123
 

	
 

	
 

	
 
// --------------------------------------------------------------------------
 
// GPS config (gps.c)
 
// --------------------------------------------------------------------------
 

	
inc/wspr.h
Show inline comments
 
#ifndef _WSPR_H
 
#define _WSPR_H
 

	
 
// Prototypes
 
void wspr_init(void);
 
void wspr_sleep(void);
 
void wspr_wakeup(void);
 
void wspr_transmit(uint8_t* grid_locator, uint8_t send_alternate);
 

	
 
void wspr_pilot_tone(void);
 

	
 
#endif
lib/si5351/si5351.h
Show inline comments
 
/*
 
 * si5351.h - Si5351 library for Arduino
 
 *
 
 * Copyright (C) 2015 Jason Milldrum <milldrum@gmail.com>
 
 *                    Dana H. Myers <k6jq@comcast.net>
 
 *
 
 * Many defines derived from clk-si5351.h in the Linux kernel.
 
 * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
 
 * Rabeeh Khoury <rabeeh@solid-run.com>
 
 *
 
 * do_div() macro derived from /include/asm-generic/div64.h in
 
 * the Linux kernel.
 
 * Copyright (C) 2003 Bernardo Innocenti <bernie@develer.com>
 
 *
 
 * This program is free software: you can redistribute it and/or modify
 
 * it under the terms of the GNU General Public License as published by
 
 * the Free Software Foundation, either version 3 of the License, or
 
 * (at your option) any later version.
 
 *
 
 * This program is distributed in the hope that it will be useful,
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
 * GNU General Public License for more details.
 
 *
 
 * You should have received a copy of the GNU General Public License
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
#ifndef SI5351_H_
 
#define SI5351_H_
 

	
 
#include <stdint.h>
 
#include "stm32f0xx_hal.h"
 

	
 
/* Define definitions */
 

	
 
#define SI5351_BUS_BASE_ADDR				((0x60 & 0x7f) << 1)
 
#define SI5351_XTAL_FREQ					25000000
 
#define SI5351_XTAL_FREQ					26000000
 
#define SI5351_PLL_FIXED					90000000000ULL
 
#define SI5351_FREQ_MULT					100ULL
 
#define SI5351_DEFAULT_CLK					1000000000ULL
 

	
 
#define SI5351_PLL_VCO_MIN					600000000
 
#define SI5351_PLL_VCO_MAX					900000000
 
#define SI5351_MULTISYNTH_MIN_FREQ		  	1000000
 
#define SI5351_MULTISYNTH_DIVBY4_FREQ	 	150000000
 
#define SI5351_MULTISYNTH_MAX_FREQ		  	160000000
 
#define SI5351_MULTISYNTH_SHARE_MAX			112500000
 
#define SI5351_MULTISYNTH67_MAX_FREQ	  	SI5351_MULTISYNTH_DIVBY4_FREQ
 
#define SI5351_CLKOUT_MIN_FREQ			    	8000
 
#define SI5351_CLKOUT_MAX_FREQ			    	SI5351_MULTISYNTH_MAX_FREQ
 
#define SI5351_CLKOUT67_MAX_FREQ		    	SI5351_MULTISYNTH67_MAX_FREQ
 

	
 
#define SI5351_PLL_A_MIN			        		15
 
#define SI5351_PLL_A_MAX				        	90
 
#define SI5351_PLL_B_MAX				        	(SI5351_PLL_C_MAX-1)
 
#define SI5351_PLL_C_MAX				        	1048575
 
#define SI5351_MULTISYNTH_A_MIN			   	6
 
#define SI5351_MULTISYNTH_A_MAX		   		1800
 
#define SI5351_MULTISYNTH67_A_MAX	   		254
 
#define SI5351_MULTISYNTH_B_MAX			   	(SI5351_MULTISYNTH_C_MAX-1)
 
#define SI5351_MULTISYNTH_C_MAX			   	1048575
 
#define SI5351_MULTISYNTH_P1_MAX		    	((1<<18)-1)
 
#define SI5351_MULTISYNTH_P2_MAX		    	((1<<20)-1)
 
#define SI5351_MULTISYNTH_P3_MAX		    	((1<<20)-1)
 

	
 
#define SI5351_DEVICE_STATUS			      	0
 
#define SI5351_INTERRUPT_STATUS		   		1
 
#define SI5351_INTERRUPT_MASK		     		2
 
#define SI5351_STATUS_SYS_INIT		    		(1<<7)
 
#define SI5351_STATUS_LOL_B			       	(1<<6)
 
#define SI5351_STATUS_LOL_A			       	(1<<5)
 
#define SI5351_STATUS_LOS				       	(1<<4)
 
#define SI5351_OUTPUT_ENABLE_CTRL		   	3
 
#define SI5351_OEB_PIN_ENABLE_CTRL		  	9
 
#define SI5351_PLL_INPUT_SOURCE		   		15
 
#define SI5351_CLKIN_DIV_MASK			     	(3<<6)
 
#define SI5351_CLKIN_DIV_1				      	(0<<6)
 
#define SI5351_CLKIN_DIV_2			      		(1<<6)
 
#define SI5351_CLKIN_DIV_4			      		(2<<6)
 
#define SI5351_CLKIN_DIV_8				      	(3<<6)
 
#define SI5351_PLLB_SOURCE			      		(1<<3)
 
#define SI5351_PLLA_SOURCE			      		(1<<2)
 

	
 
#define SI5351_CLK0_CTRL			        		16
 
#define SI5351_CLK1_CTRL			        		17
src/adc.c
Show inline comments
 
@@ -27,92 +27,98 @@ void adc_init(void)
 
    hadc.Init.ScanConvMode = ADC_SCAN_DIRECTION_FORWARD;
 
    hadc.Init.EOCSelection = EOC_SINGLE_CONV;
 
    hadc.Init.LowPowerAutoWait = DISABLE;
 
    hadc.Init.LowPowerAutoPowerOff = DISABLE;
 
    hadc.Init.ContinuousConvMode = DISABLE;
 
    hadc.Init.DiscontinuousConvMode = DISABLE;
 
    hadc.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
 
    hadc.Init.DMAContinuousRequests = DISABLE;
 
    hadc.Init.Overrun = OVR_DATA_PRESERVED;
 
    HAL_ADC_Init(&hadc);
 
 
    sConfig.Channel = ADC_CHANNEL_6;
 
    sConfig.Rank = ADC_RANK_CHANNEL_NUMBER;
 
    sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;
 
    HAL_ADC_ConfigChannel(&hadc, &sConfig);
 
 
    sConfig.Channel = ADC_CHANNEL_TEMPSENSOR;
 
    sConfig.Rank = ADC_RANK_CHANNEL_NUMBER;
 
    sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;
 
    HAL_ADC_ConfigChannel(&hadc, &sConfig);
 
 
 
    // TODO: AAH might not want to be running this DMA all the time! Meh.
 
 
    __DMA1_CLK_ENABLE();
 
    HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 0, 0);
 
    HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
 
 
    hdma_adc.Instance = DMA1_Channel1;
 
    hdma_adc.Init.Direction = DMA_PERIPH_TO_MEMORY;
 
    hdma_adc.Init.PeriphInc = DMA_PINC_DISABLE;
 
    hdma_adc.Init.MemInc = DMA_MINC_ENABLE;
 
    hdma_adc.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
 
    hdma_adc.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
 
    hdma_adc.Init.Mode = DMA_CIRCULAR;
 
    hdma_adc.Init.Priority = DMA_PRIORITY_LOW;
 
    HAL_DMA_Init(&hdma_adc);
 
 
    __HAL_LINKDMA(&hadc,DMA_Handle,hdma_adc);
 
 
 
    HAL_ADC_Start_DMA(&hadc, adc_buffer, ADC_BUF_LEN);
 
 
 
}
 
 
void adc_start(void)
 
{
 
	// TODO: Is stopping the clocks enough? Might need to disable periph?
 
    __ADC1_CLK_ENABLE();
 
	__DMA1_CLK_ENABLE();
 
    HAL_ADC_Start_DMA(&hadc, adc_buffer, ADC_BUF_LEN);
 
}
 
 
 
void adc_stop(void)
 
{
 
    HAL_ADC_Stop_DMA(&hadc);
 
    __DMA1_CLK_DISABLE();
 
    __ADC1_CLK_DISABLE();
 
 
}
 
 
 
uint8_t adc_get_vbatt(void)
 
{
 
    return 33; //adc_buffer[0] / 62.5; // tenths of volts ish
 
}
 
 
 
 
//See RM0091 section 13.9 and appendix A.7.16
 
//Temperature sensor raw value at 30 degrees C, VDDA=3.3V
 
#define TEMP30_CAL_ADDR ((uint16_t*) ((uint32_t) 0x1FFFF7B8))
 
//Temperature sensor raw value at 110 degrees C, VDDA=3.3V
 
#define TEMP110_CAL_ADDR ((uint16_t*) ((uint32_t) 0x1FFFF7C2))
 
#define ADC_TEMPERATURE_OFFSET 0
 
 
int16_t adc_get_dietemp(void)
 
{
 
    int32_t tempraw = adc_buffer[1];
 
    int32_t temperature;
 
    temperature = tempraw - ((int32_t)*TEMP30_CAL_ADDR);
 
    temperature = temperature * (110L - 30L);
 
    temperature = temperature / (*TEMP110_CAL_ADDR - *TEMP30_CAL_ADDR);
 
    temperature = temperature + 30L;
 
 
    temperature = temperature + ADC_TEMPERATURE_OFFSET;
 
 
    return 14; //temperature;
 
    // TODO: Verify
 
}
 
 
 
ADC_HandleTypeDef* adc_gethandle(void)
 
{
 
    return &hadc;
 
}
src/gpio.c
Show inline comments
 
#include "gpio.h"
 
#include "config.h"
 
 
// Initialize GPIOs
 
void gpio_init(void)
 
{
 
 
  GPIO_InitTypeDef GPIO_InitStruct;
 
 
  /* GPIO Ports Clock Enable */
 
  __GPIOF_CLK_ENABLE();
 
  __GPIOA_CLK_ENABLE();
 
  __GPIOB_CLK_ENABLE();
 
 
 
  // Oscillator enable pin
 
  GPIO_InitStruct.Pin = OSC_EN_Pin;
 
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
 
  GPIO_InitStruct.Pull = GPIO_NOPULL;
 
  GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
 
  HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
 
  HAL_GPIO_WritePin(GPIOF, OSC_EN_Pin, 0); // disable
 
 
 
  // GPS enable pin
 
  GPIO_InitStruct.Pin = GPS_NEN_Pin;
 
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
 
  GPIO_InitStruct.Pull = GPIO_NOPULL;
 
  GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
 
  HAL_GPIO_Init(GPS_NEN_GPIO_Port, &GPIO_InitStruct);
 
  HAL_GPIO_WritePin(GPS_NEN_GPIO_Port, GPS_NEN_Pin, 1); // disable
 
 
  /*Configure GPIO pins : PA0 PA2 PA3 PA4 
 
                           PA5 PA7 PA15 */
 
  GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4 
 
                          |GPIO_PIN_5|GPIO_PIN_7|GPIO_PIN_15;
 
  GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
 
  GPIO_InitStruct.Pull = GPIO_NOPULL;
 
  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 
 
//  /*Configure GPIO pin : PA1 */
 
//  GPIO_InitStruct.Pin = GPIO_PIN_1;
 
//  GPIO_InitStruct.Mode = GPIO_MODE_EVT_RISING;
 
//  GPIO_InitStruct.Pull = GPIO_NOPULL;
 
//  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 
 
  /*Configure GPIO pin : PtPin */
 
  GPIO_InitStruct.Pin = LED_BLUE_Pin;
 
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
 
  GPIO_InitStruct.Pull = GPIO_NOPULL;
 
  GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
 
  HAL_GPIO_Init(LED_BLUE_GPIO_Port, &GPIO_InitStruct);
 
 
  /*Configure GPIO pins : PB1 PB3 PB4 PB5 */
 
  GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5;
 
  GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
 
  GPIO_InitStruct.Pull = GPIO_NOPULL;
 
  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 
 
  /*Configure GPIO pin : PtPin */
 
  GPIO_InitStruct.Pin = TCXO_EN_Pin;
 
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
 
  GPIO_InitStruct.Pull = GPIO_NOPULL;
 
  GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
 
  HAL_GPIO_Init(TCXO_EN_GPIO_Port, &GPIO_InitStruct);
 
  HAL_GPIO_WritePin(TCXO_EN_GPIO_Port, TCXO_EN_Pin, 0); // disable
 
 
}
 
 
void led_blink(uint8_t n)
 
{
 
    for(int i = 0; i < n; i++)
 
    {
 
        HAL_GPIO_WritePin(LED_BLUE, 1);
 
        HAL_Delay(100);
 
        HAL_GPIO_WritePin(LED_BLUE, 0);
 
        HAL_Delay(100);
 
    }
 
	#ifndef LED_DISABLE
 
		for(int i = 0; i < n; i++)
 
		{
 
			HAL_GPIO_WritePin(LED_BLUE, 1);
 
			HAL_Delay(100);
 
			HAL_GPIO_WritePin(LED_BLUE, 0);
 
			HAL_Delay(100);
 
		}
 
	#endif
 
}
src/main.c
Show inline comments
 
//
 
// WSPRHAB: Minimal high-altitude balloon tracker with WSPR telemetry
 
//
 
 
#include "stm32f0xx_hal.h"
 
#include "adc.h"
 
#include "system.h"
 
#include "i2c.h"
 
#include "uart.h"
 
#include "gpio.h"
 
#include "wspr.h"
 
#include "rtc.h"
 
#include "gps.h"
 
#include "config.h"
 
 
 
// We have access to the 1PPS pin of the gps... could have trim routine for internal oscillator based on this when we have a fix
 
// Probable wake up 1 minute early -- 0.45min possible +/- on wakeup time with 15min sync intervals
 
 
 
// TODO: Add JT9 message with more grid locator digits + altitude + vbatt + temp
 
// MSG13charmax:
 
// 	X: gridloc
 
//  Y: altitude
 
//  Z: temperature
 
//  KD8TDF XXYYZZ // could use alt callsign thing
 
 
enum _state
 
{
 
    SYSTEM_IDLE = 0, // awaiting RTC interrupt for wakeup TODO wake up before scheduled time to get fix?
 
    SYSTEM_GPSACQ, // RTC interrupted
 
    SYSTEM_WSPRTX, // Wait for timeslot and actually transmit the message
 
};
 
 
static void __calc_gridloc(char *dst, double lat, double lon);
 
static void ledpulse(void);
 
 
uint32_t statled_ontime = 0;
 
 
 
int main(void)
 
{
 
    HAL_Init();
 
    HAL_Delay(1000); // startup delay before infinisleep
 
 
    sysclk_init();
 
    rtc_init();
 
    gpio_init();
 
    adc_init();
 
    wspr_init();
 
 
    uint32_t led_timer = HAL_GetTick();
 
 
    led_blink(4);
 
 
    uint16_t blink_rate = BLINK_FAST;
 
    uint8_t state = SYSTEM_GPSACQ;
 
 
    uint32_t gps_polltimer = 0;
 
    uint32_t fix_acq_starttime = 0;
 
    uint32_t nextwspr_time = 0;
 
    uint8_t nextwspr_time_valid = 0;
 
    uint32_t last_wspr_tx_time = 0;
 
 
    uint8_t packet_type = 0;
 
 
    // Transmit pilot tone to test TX on bootup
 
    HAL_Delay(1000);
 
    wspr_pilot_tone();
 
    adc_stop();
 
    HAL_Delay(1000);
 
 
    while (1)
 
    {
 
    	// TODO: Disable GPIO port clocking when not needed!
 
 
    	// Every 10 minutes, wake up and try to wspr
 
    	if(state == SYSTEM_IDLE && (HAL_GetTick() - last_wspr_tx_time > 60000 * 10))
 
    	{
 
    		state = SYSTEM_GPSACQ;
 
    	}
 
//    	if(state == SYSTEM_IDLE && (HAL_GetTick() - last_wspr_tx_time > 60000 * 10))
 
//    	{
 
//    		state = SYSTEM_GPSACQ;
 
//    	}
 
 
        // Update fix status every 2 seconds
 
        // Update fix status every 2 seconds, only if the GPS is powered on
 
        if(HAL_GetTick() - gps_polltimer > 2000)
 
        {
 
            if(gps_ison())
 
            {
 
            	gps_update_data();
 
 
            	// If odd minute
 
            	if(gps_getdata()->minute % 2)
 
            	{
 
            		// Wait until even minute plus one second, coming soon
 
            		nextwspr_time = HAL_GetTick() + (60000 - (gps_getdata()->second * 1000));
 
                    nextwspr_time_valid = 1;
 
 
            	}
 
            	// If even minute
 
            	else
 
            	{
 
            		// Wait until odd minute, one minute and some change away
 
            		nextwspr_time = HAL_GetTick() + 60000 + (60000 - (gps_getdata()->second * 1000));
 
                    nextwspr_time_valid = 1;
 
            	}
 
            }
 
            gps_polltimer = HAL_GetTick();
 
        }
 
 
 
 
        switch(state)
 
        {
 
 
            // Idling: sleep and wait for RTC timeslot trigger
 
            case SYSTEM_IDLE:
 
            {
 
                blink_rate = BLINK_SLOW;
 
 
                // Actually sleep for real: disable systick and sleep until RTC interrupt
 
//                HAL_SuspendTick();
 
 
                // Enter sleep mode: wait for interrupt
 
                HAL_PWR_EnterSLEEPMode(0, PWR_SLEEPENTRY_WFI);
 
 
                // We have woken up!
 
 
                // This is hopefully the only timer that needs to stay alive in idle mode
 
 //               last_wspr_tx_time += 0; // move this timer forward based on sleep length
 
 
 //               HAL_ResumeTick();
 
 
                // TODO: Eventually use GPS time to calibrate the RTC maybe
 
 
            } break;
 
 
 
            // Attempt to acquire GPS fix
 
            case SYSTEM_GPSACQ:
 
            {
 
                blink_rate = BLINK_FAST;
 
                HAL_PWR_EnterSLEEPMode(0, PWR_SLEEPENTRY_WFI);
 
                HAL_PWR_EnterSLEEPMode(0, PWR_SLEEPENTRY_WFI);
 
                HAL_PWR_EnterSLEEPMode(0, PWR_SLEEPENTRY_WFI);
 
                HAL_PWR_EnterSLEEPMode(0, PWR_SLEEPENTRY_WFI);
 
 
 
                if(!gps_ison())
 
                {
 
                	fix_acq_starttime = HAL_GetTick();
 
                    gps_poweron(); // power on and initialize GPS module
 
                }
 
 
                // TODO: Move GPS processing into here from above!
 
 
 
                // If 3d fix with a decent enough precision
 
                if( ((gps_getdata()->fixtype == 2) || (gps_getdata()->fixtype == 3)) && gps_getdata()->pdop < 10 && nextwspr_time_valid == 1)
 
                {
 
                    // Disable GPS module
 
                    gps_poweroff();
 
 
                    // TODO: Set RTC from GPS time
 
 
                    // TODO: Set RTC for countdown to next transmission timeslot!
 
 
                    // TODO: Set wspr countdown timer for this transmission!
 
                    fix_acq_starttime = 0;
 
                    state = SYSTEM_WSPRTX;
 
                    adc_start();
 
                }
 
                // If no decent fix in 3 minutes
 
                else if(HAL_GetTick() - fix_acq_starttime > 60000 * 3)
 
                {
 
                	// Flash error code and go to idle, try again next time
 
                	led_blink(4);
 
                    gps_poweroff();
 
                    fix_acq_starttime = 0;
 
                    last_wspr_tx_time = HAL_GetTick(); // repeat acq/tx cycle after big time delay
 
                	state = SYSTEM_IDLE;
 
                }
 
            } break;
 
 
            
 
            // Wait for wspr timeslot and start transmitting
 
            case SYSTEM_WSPRTX:
 
            {
 
            	blink_rate = BLINK_MED;
 
                // Wait for wspr countdown timer to expire and go to tx
 
//                if(timeout_expired)
 
//                {
 
 
            	// If we're after the minute but not more than 2s after the minute, start tx
 
            	if(HAL_GetTick() >= nextwspr_time)
 
            	{
 
            		if(HAL_GetTick() < nextwspr_time + 2000)
 
            		{
 
            			volatile double latitude_flt = (double)gps_getdata()->latitude / 10000000.0;
 
            			volatile double longitude_flt = (double)gps_getdata()->longitude / 10000000.0;
 
            			volatile uint8_t grid_locator[7];
 
 
            			__calc_gridloc(grid_locator, latitude_flt, longitude_flt);
 
 
                        // TODO: Switch between alternate and standard packet
 
						wspr_transmit(grid_locator, packet_type);
 
                        packet_type = !packet_type; // alternate packet type
 
						last_wspr_tx_time = HAL_GetTick();
 
						state = SYSTEM_IDLE;
 
                        adc_stop();
 
            		}
 
            		else
 
            		{
 
            			// Window was missed, go back to idle, and try again after time delay
 
						last_wspr_tx_time = HAL_GetTick();
 
            			state = SYSTEM_IDLE;
 
                        adc_stop();
 
            		}
 
                    nextwspr_time_valid = 0; // invalidate wspr time
 
                }
 
            	else
 
            	{
 
                    HAL_PWR_EnterSLEEPMode(0, PWR_SLEEPENTRY_WFI);
 
                    HAL_PWR_EnterSLEEPMode(0, PWR_SLEEPENTRY_WFI);
 
                    HAL_PWR_EnterSLEEPMode(0, PWR_SLEEPENTRY_WFI);
 
                    HAL_PWR_EnterSLEEPMode(0, PWR_SLEEPENTRY_WFI);
 
            	}
 
 
                // Schedule next wakeup (maybe 2mins prior ot timeslot if no osc trim)
 
                // Schedule next wakeup (maybe 2mins prior to timeslot if no osc trim)
 
                // Next wakeup should enter SYSTEM_GPSACQ state...
 
 
            } break;
 
 
        }
 
 
		#ifndef LED_DISABLE
 
			if(HAL_GetTick() - led_timer > blink_rate)
 
			{
 
				ledpulse();
 
				led_timer = HAL_GetTick();
 
			}
 
 
        if(HAL_GetTick() - led_timer > blink_rate)
 
        {
 
            ledpulse();
 
            led_timer = HAL_GetTick();
 
        }
 
 
        if(statled_ontime && HAL_GetTick() - statled_ontime > 10)
 
        {
 
            HAL_GPIO_WritePin(LED_BLUE, 0);
 
            statled_ontime = 0;
 
        }
 
			if(statled_ontime && HAL_GetTick() - statled_ontime > 10)
 
			{
 
				HAL_GPIO_WritePin(LED_BLUE, 0);
 
				statled_ontime = 0;
 
			}
 
		#endif
 
 
    }
 
}
 
 
static void ledpulse(void)
 
{
 
    HAL_GPIO_WritePin(LED_BLUE, 1);
 
	statled_ontime = HAL_GetTick();
 
}
 
 
static void __calc_gridloc(char *dst, double lat, double lon)
 
{
 
	int o1, o2, o3;
 
	int a1, a2, a3;
 
	double remainder;
 
	// longitude
 
	remainder = lon + 180.0;
 
	o1 = (int)(remainder / 20.0);
 
	remainder = remainder - (double)o1 * 20.0;
 
	o2 = (int)(remainder / 2.0);
 
	remainder = remainder - 2.0 * (double)o2;
 
	o3 = (int)(12.0 * remainder);
 
 
	// latitude
 
	remainder = lat + 90.0;
 
	a1 = (int)(remainder / 10.0);
 
	remainder = remainder - (double)a1 * 10.0;
 
	a2 = (int)(remainder);
 
	remainder = remainder - (double)a2;
 
	a3 = (int)(24.0 * remainder);
 
	dst[0] = (char)o1 + 'A';
 
	dst[1] = (char)a1 + 'A';
 
	dst[2] = (char)o2 + '0';
 
	dst[3] = (char)a2 + '0';
 
	dst[4] = (char)o3 + 'A';
 
	dst[5] = (char)a3 + 'A';
 
	dst[6] = (char)0;
 
}
 
src/rtc.c
Show inline comments
 
//
 
// RTC: configure real-time clock
 
//
 
 
#include "stm32f0xx_hal.h"
 
#include "rtc.h"
 
 
 
RTC_HandleTypeDef hrtc;
 
 
static void Error_Handler(void)
 
{
 
	volatile uint8_t crap = 1;
 
}
 
 
// Initialize RTC
 
void rtc_init(void)
 
{
 
	__HAL_RCC_RTC_ENABLE();
 
 
    
 
  RTC_TimeTypeDef sTime;
 
  RTC_DateTypeDef sDate;
 
  RTC_AlarmTypeDef sAlarm;
 
	RTC_TimeTypeDef sTime;
 
	RTC_DateTypeDef sDate;
 
	RTC_AlarmTypeDef sAlarm;
 
 
  hrtc.Instance = RTC;
 
  hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
 
  hrtc.Init.AsynchPrediv = 124;
 
  hrtc.Init.SynchPrediv = 322; // if this has enough bits should be 1.0018Hz based on 40kHz LSI
 
  hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
 
  hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
 
  hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
 
	hrtc.Instance = RTC;
 
	hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
 
	hrtc.Init.AsynchPrediv = 124;
 
	hrtc.Init.SynchPrediv = 322; // if this has enough bits should be 1.0018Hz based on 40kHz LSI
 
	hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
 
	hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
 
	hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
 
 
  if (HAL_RTC_Init(&hrtc) != HAL_OK)
 
  {
 
    Error_Handler();
 
  }
 
	if (HAL_RTC_Init(&hrtc) != HAL_OK)
 
	{
 
		Error_Handler();
 
	}
 
 
  sTime.Hours = 0x0;
 
  sTime.Minutes = 0x0;
 
  sTime.Seconds = 0x0;
 
  sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
 
  sTime.StoreOperation = RTC_STOREOPERATION_RESET;
 
  if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD) != HAL_OK)
 
  {
 
    Error_Handler();
 
  }
 
	sTime.Hours = 0x0;
 
	sTime.Minutes = 0x0;
 
	sTime.Seconds = 0x0;
 
	sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
 
	sTime.StoreOperation = RTC_STOREOPERATION_RESET;
 
	if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD) != HAL_OK)
 
	{
 
		Error_Handler();
 
	}
 
 
  sDate.WeekDay = RTC_WEEKDAY_MONDAY;
 
  sDate.Month = RTC_MONTH_JANUARY;
 
  sDate.Date = 0x1;
 
  sDate.Year = 0x0;
 
	sDate.WeekDay = RTC_WEEKDAY_MONDAY;
 
	sDate.Month = RTC_MONTH_JANUARY;
 
	sDate.Date = 0x1;
 
	sDate.Year = 0x0;
 
 
  if (HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BCD) != HAL_OK)
 
  {
 
    Error_Handler();
 
  }
 
	if (HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BCD) != HAL_OK)
 
	{
 
		Error_Handler();
 
	}
 
 
 
    /**Enable the Alarm A 
 
    */
 
  sAlarm.AlarmTime.Hours = 0x0;
 
  sAlarm.AlarmTime.Minutes = 0x0;
 
  sAlarm.AlarmTime.Seconds = 0x0;
 
  sAlarm.AlarmTime.SubSeconds = 0x0;
 
  sAlarm.AlarmTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
 
  sAlarm.AlarmTime.StoreOperation = RTC_STOREOPERATION_RESET;
 
	/**Enable the Alarm A
 
	*/
 
	sAlarm.AlarmTime.Hours = 0x0;
 
	sAlarm.AlarmTime.Minutes = 0x0;
 
	sAlarm.AlarmTime.Seconds = 0x0;
 
	sAlarm.AlarmTime.SubSeconds = 0x0;
 
	sAlarm.AlarmTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
 
	sAlarm.AlarmTime.StoreOperation = RTC_STOREOPERATION_RESET;
 
 
  // Alarm will trigger on the Xth second of every minute
 
  sAlarm.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY | RTC_ALARMMASK_HOURS | RTC_ALARMMASK_MINUTES;
 
  sAlarm.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_ALL;
 
  sAlarm.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_DATE;
 
  sAlarm.AlarmDateWeekDay = 0x1;
 
  sAlarm.Alarm = RTC_ALARM_A;
 
  if (HAL_RTC_SetAlarm(&hrtc, &sAlarm, RTC_FORMAT_BCD) != HAL_OK)
 
  {
 
    Error_Handler();
 
  }
 
	// Alarm will trigger on the Xth second of every minute
 
	sAlarm.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY | RTC_ALARMMASK_HOURS | RTC_ALARMMASK_MINUTES;
 
	sAlarm.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_ALL;
 
	sAlarm.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_DATE;
 
	sAlarm.AlarmDateWeekDay = 0x1;
 
	sAlarm.Alarm = RTC_ALARM_A;
 
	if (HAL_RTC_SetAlarm(&hrtc, &sAlarm, RTC_FORMAT_BCD) != HAL_OK)
 
	{
 
		Error_Handler();
 
	}
 
 
  HAL_NVIC_SetPriority(RTC_IRQn, 0, 0);
 
  HAL_NVIC_EnableIRQ(RTC_IRQn);
 
	HAL_NVIC_SetPriority(RTC_IRQn, 0, 0);
 
	HAL_NVIC_EnableIRQ(RTC_IRQn);
 
}
 
 
void rtc_cal(void)
 
{
 
	// Do something with hrtc.Instance->CALR; // this has a plus and minus component, see refman
 
}
 
 
RTC_HandleTypeDef* rtc_gethandle(void)
 
{
 
	return &hrtc;
 
}
 
 
src/system.c
Show inline comments
 
//
 
// System: basic low-level system configuration
 
//
 

	
 
#include "stm32f0xx_hal.h"
 
#include "system.h"
 
#include "wspr.h"
 

	
 
void enter_sleep(void)
 
{
 
    //HAL_SuspendTick();
 
    wspr_sleep();
 
    HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
 
    wspr_wakeup();
 
    //HAL_ResumeTick();
 
}
 

	
 

	
 
void enter_deepsleep(void)
 
{
 
    // Request to enter STOP mode with regulator in low power mode
 
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
 
    // After wake-up from STOP reconfigure the PLL
 
    sysclk_init();
 
}
 

	
 

	
 
// Initialize system clocks
 
void sysclk_init(void)
 
{
 
    RCC_OscInitTypeDef RCC_OscInitStruct;
 
    RCC_ClkInitTypeDef RCC_ClkInitStruct;
 
    RCC_PeriphCLKInitTypeDef PeriphClkInit;
 

	
 
    // TODO: Probably disable HSI14? This only drives the ADC
 
    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSI14|RCC_OSCILLATORTYPE_LSI;
 
    RCC_OscInitStruct.HSIState = RCC_HSI_ON;
 
    RCC_OscInitStruct.HSI14State = RCC_HSI14_ON;
 
    RCC_OscInitStruct.HSICalibrationValue = 16;
 
    RCC_OscInitStruct.HSI14CalibrationValue = 16;
 
    RCC_OscInitStruct.LSIState = RCC_LSI_ON;
 
    RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
 
    HAL_RCC_OscConfig(&RCC_OscInitStruct);
 

	
 
    RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
 
                                |RCC_CLOCKTYPE_PCLK1;
 
    RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
 
    RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV4;
 
    RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
 
    HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0);
 

	
 
    PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_I2C1;
 
    PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_SYSCLK; //RCC_USART1CLKSOURCE_PCLK1;
 
    PeriphClkInit.I2c1ClockSelection = RCC_I2C1CLKSOURCE_SYSCLK;
 
    PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
 
    HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);
 

	
 
    HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
 

	
 
    HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
 

	
 
    __SYSCFG_CLK_ENABLE();
 
    // SysTick_IRQn interrupt configuration
 
    HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
 
}
src/wspr.c
Show inline comments
 
#include "stm32f0xx_hal.h"
 
#include "si5351.h"
 
#include "jtencode.h"
 
#include "gpio.h"
 
#include "wspr.h"
 
#include "i2c.h"
 
#include "gps.h"
 
#include "adc.h"
 
#include "config.h"
 

	
 

	
 
#define WSPR_DEFAULT_FREQ 10140100UL
 
#define WSPR_TONE_SPACING 146 // ~1.46 Hz
 
#define WSPR_CTC 10672 // CTC value for WSPR
 

	
 
char call_orig[7] = "KD8TDF";
 
#define DBM_ORIG 10
 

	
 

	
 
// Test stuff
 
char call[7] = "KD8TDF";
 
char loc[7] = "EN82";
 
uint8_t dbm = 10;
 
uint8_t tx_buffer[255];
 

	
 
// Frequencies and channel info
 
uint32_t freq = WSPR_DEFAULT_FREQ;
 
uint8_t symbol_count = WSPR_SYMBOL_COUNT;
 
uint16_t ctc = WSPR_CTC;
 
uint16_t tone_spacing = WSPR_TONE_SPACING;
 
volatile uint8_t proceed = 0;
 

	
 
TIM_HandleTypeDef htim1;
 

	
 

	
 

	
 
void wspr_init(void)
 
{
 
    // Turn off ICs
 
    HAL_GPIO_WritePin(OSC_NOTEN, 1);
 
    HAL_GPIO_WritePin(TCXO_EN, 0);
 
}
 

	
 
// Do anything needed to prepare for sleep
 
void wspr_sleep(void)
 
{
 
    HAL_TIM_Base_Stop_IT(&htim1);
 
}
 

	
 
void wspr_wakeup(void)
 
{
 
    HAL_TIM_Base_Start_IT(&htim1);
 
}
 

	
 

	
 
// Bring up TCXO and oscillator IC
 
@@ -259,48 +260,103 @@ void wspr_transmit(uint8_t* grid_locator
 
    si5351_output_enable(SI5351_CLK0, 1);
 
    //si5351_pll_reset(SI5351_PLLA);
 

	
 
    // Make sure the other outputs of the SI5351 are disabled
 
    si5351_output_enable(SI5351_CLK1, 0); // Disable the clock initially
 
    si5351_output_enable(SI5351_CLK2, 0); // Disable the clock initially
 

	
 
    // disable clock powers
 
    si5351_set_clock_pwr(SI5351_CLK1, 0);
 
    si5351_set_clock_pwr(SI5351_CLK2, 0);
 

	
 

	
 
    // Encode message to transmit
 
    wspr_encode(call, loc, dbm, tx_buffer);
 

	
 
    // Key transmitter
 
    si5351_output_enable(SI5351_CLK0, 1);
 

	
 
    // Loop through and transmit symbols TODO: Do this from an ISR or ISR-triggered main loop function call (optimal)
 
    uint8_t i;
 
    for(i=0; i<symbol_count; i++)
 
    {
 
        uint32_t freq2 = (freq * 100) + (tx_buffer[i] * tone_spacing);
 
        si5351_set_freq(freq2, 0, SI5351_CLK0);
 
        HAL_GPIO_TogglePin(LED_BLUE);
 

	
 
        proceed = 0;
 
        while(!proceed);
 
    }
 

	
 
    // Disable transmitter
 
    si5351_output_enable(SI5351_CLK0, 0);
 

	
 
    HAL_GPIO_WritePin(OSC_NOTEN, 1);
 
    HAL_GPIO_WritePin(TCXO_EN, 0);
 

	
 
    i2c_deinit();
 

	
 
    // Disable timer
 
    HAL_NVIC_DisableIRQ(TIM1_BRK_UP_TRG_COM_IRQn);
 
    HAL_TIM_Base_Stop_IT(&htim1);
 
    HAL_TIM_Base_DeInit(&htim1);
 

	
 
    __TIM1_CLK_DISABLE();
 

	
 

	
 
}
 

	
 

	
 
// Transmit boot-up test tones to check tx
 
void wspr_pilot_tone(void)
 
{
 
	// Bring up TCXO
 
    HAL_GPIO_WritePin(OSC_NOTEN, 0);
 
    HAL_GPIO_WritePin(TCXO_EN, 1);
 
    HAL_Delay(100);
 

	
 
    // Bring up the chip
 
    i2c_init();
 
    si5351_init(i2c_get(), SI5351_CRYSTAL_LOAD_8PF, 0);
 
    si5351_set_correction(0);
 
    si5351_set_freq(WSPR_DEFAULT_FREQ * 100, 0, SI5351_CLK0);
 
    si5351_drive_strength(SI5351_CLK0, SI5351_DRIVE_6MA); // Set for max power if desired (8ma max)
 
    si5351_output_enable(SI5351_CLK0, 1);
 

	
 
    // Make sure the other outputs of the SI5351 are disabled
 
    si5351_output_enable(SI5351_CLK1, 0); // Disable the clock initially
 
    si5351_output_enable(SI5351_CLK2, 0); // Disable the clock initially
 

	
 
    // disable clock powers
 
    si5351_set_clock_pwr(SI5351_CLK1, 0);
 
    si5351_set_clock_pwr(SI5351_CLK2, 0);
 

	
 
    // Key transmitter
 
    si5351_output_enable(SI5351_CLK0, 1);
 

	
 
    uint8_t tone_table[7] = {50, 100, 70, 50, 0, 10, 0};
 

	
 
    // Boot-up pilot tones
 
    for(uint8_t i=0; i<7; i++)
 
    {
 
        uint32_t freq2 = (WSPR_DEFAULT_FREQ + 10*tone_table[i]) * 100;
 
        si5351_set_freq(freq2, 0, SI5351_CLK0);
 
		#ifndef LED_DISABLE
 
        	HAL_GPIO_TogglePin(LED_BLUE);
 
		#endif
 
        HAL_Delay(500);
 
    }
 

	
 

	
 
    // Disable transmitter
 
    si5351_output_enable(SI5351_CLK0, 0);
 

	
 
    HAL_GPIO_WritePin(OSC_NOTEN, 1);
 
    HAL_GPIO_WritePin(TCXO_EN, 0);
 

	
 
    i2c_deinit();
 

	
 
    // Make sure LED is off if we had an odd number of toggles above
 
	HAL_GPIO_WritePin(LED_BLUE, 0);
 

	
 
}
 

	
0 comments (0 inline, 0 general)