add firmware
This commit is contained in:
130
Firmware/.cproject
Normal file
130
Firmware/.cproject
Normal file
@@ -0,0 +1,130 @@
|
||||
<?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="de.innot.avreclipse.configuration.app.debug.1815879625">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="de.innot.avreclipse.configuration.app.debug.1815879625" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<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.GLDErrorParser" 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.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="de.innot.avreclipse.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=de.innot.avreclipse.buildArtefactType.app,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" description="" id="de.innot.avreclipse.configuration.app.debug.1815879625" name="Debug" parent="de.innot.avreclipse.configuration.app.debug">
|
||||
<folderInfo id="de.innot.avreclipse.configuration.app.debug.1815879625." name="/" resourcePath="">
|
||||
<toolChain id="de.innot.avreclipse.toolchain.winavr.app.debug.1435006567" name="AVR-GCC Toolchain" superClass="de.innot.avreclipse.toolchain.winavr.app.debug">
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.debug.1904781239" name="Generate HEX file for Flash memory" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.debug" value="true" valueType="boolean"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.debug.856130404" name="Generate HEX file for EEPROM" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.debug"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.debug.254108354" name="Generate Extended Listing (Source + generated Assembler)" superClass="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.debug"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.size.app.debug.1135162554" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size.app.debug"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.debug.124303798" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.debug" value="true" valueType="boolean"/>
|
||||
<targetPlatform id="de.innot.avreclipse.targetplatform.winavr.app.debug.212715962" name="AVR Cross-Target" superClass="de.innot.avreclipse.targetplatform.winavr.app.debug"/>
|
||||
<builder buildPath="${workspace_loc:/qlocktwo}/Debug" id="de.innot.avreclipse.target.builder.winavr.app.debug.535989835" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="AVR GNU Make Builder" superClass="de.innot.avreclipse.target.builder.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.assembler.winavr.app.debug.1741837686" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.app.debug">
|
||||
<option id="de.innot.avreclipse.assembler.option.debug.level.1582090768" name="Generate Debugging Info" superClass="de.innot.avreclipse.assembler.option.debug.level"/>
|
||||
<inputType id="de.innot.avreclipse.tool.assembler.input.1576045719" superClass="de.innot.avreclipse.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.compiler.winavr.app.debug.801818658" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.debug">
|
||||
<option id="de.innot.avreclipse.compiler.option.debug.level.2119670031" name="Generate Debugging Info" superClass="de.innot.avreclipse.compiler.option.debug.level"/>
|
||||
<option id="de.innot.avreclipse.compiler.option.optimize.1412682526" name="Optimization Level" superClass="de.innot.avreclipse.compiler.option.optimize"/>
|
||||
<option id="de.innot.avreclipse.compiler.option.incpath.586474395" name="Include Paths (-I)" superClass="de.innot.avreclipse.compiler.option.incpath" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/include}""/>
|
||||
</option>
|
||||
<inputType id="de.innot.avreclipse.compiler.winavr.input.1886533279" name="C Source Files" superClass="de.innot.avreclipse.compiler.winavr.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.cppcompiler.app.debug.42370336" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.app.debug">
|
||||
<option id="de.innot.avreclipse.cppcompiler.option.debug.level.78112230" name="Generate Debugging Info" superClass="de.innot.avreclipse.cppcompiler.option.debug.level"/>
|
||||
<option id="de.innot.avreclipse.cppcompiler.option.optimize.1255382026" name="Optimization Level" superClass="de.innot.avreclipse.cppcompiler.option.optimize"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.linker.winavr.app.debug.660790403" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.app.debug">
|
||||
<inputType id="de.innot.avreclipse.tool.linker.input.184398801" name="OBJ Files" superClass="de.innot.avreclipse.tool.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.cpplinker.app.debug.299414100" name="AVR C++ Linker" superClass="de.innot.avreclipse.tool.cpplinker.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.archiver.winavr.base.455153718" name="AVR Archiver" superClass="de.innot.avreclipse.tool.archiver.winavr.base"/>
|
||||
<tool id="de.innot.avreclipse.tool.objdump.winavr.app.debug.1987996966" name="AVR Create Extended Listing" superClass="de.innot.avreclipse.tool.objdump.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.objcopy.flash.winavr.app.debug.834635307" name="AVR Create Flash image" superClass="de.innot.avreclipse.tool.objcopy.flash.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.debug.1266925473" name="AVR Create EEPROM image" superClass="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.size.winavr.app.debug.1632615882" name="Print Size" superClass="de.innot.avreclipse.tool.size.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.avrdude.app.debug.1666007310" name="AVRDude" superClass="de.innot.avreclipse.tool.avrdude.app.debug"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="de.innot.avreclipse.configuration.app.release.1520781540">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="de.innot.avreclipse.configuration.app.release.1520781540" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<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.GLDErrorParser" 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.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="de.innot.avreclipse.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=de.innot.avreclipse.buildArtefactType.app,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" description="" id="de.innot.avreclipse.configuration.app.release.1520781540" name="Release" parent="de.innot.avreclipse.configuration.app.release">
|
||||
<folderInfo id="de.innot.avreclipse.configuration.app.release.1520781540." name="/" resourcePath="">
|
||||
<toolChain id="de.innot.avreclipse.toolchain.winavr.app.release.1311734183" name="AVR-GCC Toolchain" superClass="de.innot.avreclipse.toolchain.winavr.app.release">
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.release.1363521788" name="Generate HEX file for Flash memory" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.release"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.release.1215980984" name="Generate HEX file for EEPROM" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.release"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.release.743155204" name="Generate Extended Listing (Source + generated Assembler)" superClass="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.release"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.size.app.release.1780937977" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size.app.release"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.release.2012923909" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.release"/>
|
||||
<targetPlatform id="de.innot.avreclipse.targetplatform.winavr.app.release.169622357" name="AVR Cross-Target" superClass="de.innot.avreclipse.targetplatform.winavr.app.release"/>
|
||||
<builder buildPath="${workspace_loc:/qlocktwo}/Release" id="de.innot.avreclipse.target.builder.winavr.app.release.2058650331" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="AVR GNU Make Builder" superClass="de.innot.avreclipse.target.builder.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.assembler.winavr.app.release.1659325734" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.app.release">
|
||||
<option id="de.innot.avreclipse.assembler.option.debug.level.454997110" name="Generate Debugging Info" superClass="de.innot.avreclipse.assembler.option.debug.level" value="de.innot.avreclipse.assembler.option.debug.level.none" valueType="enumerated"/>
|
||||
<inputType id="de.innot.avreclipse.tool.assembler.input.326894171" superClass="de.innot.avreclipse.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.compiler.winavr.app.release.1786351850" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.release">
|
||||
<option id="de.innot.avreclipse.compiler.option.debug.level.1099693403" name="Generate Debugging Info" superClass="de.innot.avreclipse.compiler.option.debug.level" value="de.innot.avreclipse.compiler.option.debug.level.none" valueType="enumerated"/>
|
||||
<option id="de.innot.avreclipse.compiler.option.optimize.49787584" name="Optimization Level" superClass="de.innot.avreclipse.compiler.option.optimize" value="de.innot.avreclipse.compiler.optimize.size" valueType="enumerated"/>
|
||||
<inputType id="de.innot.avreclipse.compiler.winavr.input.1533993518" name="C Source Files" superClass="de.innot.avreclipse.compiler.winavr.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.cppcompiler.app.release.1379968464" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.app.release">
|
||||
<option id="de.innot.avreclipse.cppcompiler.option.debug.level.120261468" name="Generate Debugging Info" superClass="de.innot.avreclipse.cppcompiler.option.debug.level" value="de.innot.avreclipse.cppcompiler.option.debug.level.none" valueType="enumerated"/>
|
||||
<option id="de.innot.avreclipse.cppcompiler.option.optimize.1361502704" name="Optimization Level" superClass="de.innot.avreclipse.cppcompiler.option.optimize" value="de.innot.avreclipse.cppcompiler.optimize.size" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.linker.winavr.app.release.1232664678" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.app.release">
|
||||
<inputType id="de.innot.avreclipse.tool.linker.input.1712034637" name="OBJ Files" superClass="de.innot.avreclipse.tool.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.cpplinker.app.release.558428499" name="AVR C++ Linker" superClass="de.innot.avreclipse.tool.cpplinker.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.archiver.winavr.base.342619889" name="AVR Archiver" superClass="de.innot.avreclipse.tool.archiver.winavr.base"/>
|
||||
<tool id="de.innot.avreclipse.tool.objdump.winavr.app.release.911961420" name="AVR Create Extended Listing" superClass="de.innot.avreclipse.tool.objdump.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.objcopy.flash.winavr.app.release.1401821480" name="AVR Create Flash image" superClass="de.innot.avreclipse.tool.objcopy.flash.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.release.648662804" name="AVR Create EEPROM image" superClass="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.size.winavr.app.release.1988673121" name="Print Size" superClass="de.innot.avreclipse.tool.size.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.avrdude.app.release.1585386861" name="AVRDude" superClass="de.innot.avreclipse.tool.avrdude.app.release"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="qlocktwo.de.innot.avreclipse.project.winavr.elf_2.1.0.963828985" name="AVR Cross Target Application" projectType="de.innot.avreclipse.project.winavr.elf_2.1.0"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="refreshScope"/>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.1520781540;de.innot.avreclipse.configuration.app.release.1520781540.;de.innot.avreclipse.tool.compiler.winavr.app.release.1786351850;de.innot.avreclipse.compiler.winavr.input.1533993518">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.debug.1815879625;de.innot.avreclipse.configuration.app.debug.1815879625.;de.innot.avreclipse.tool.compiler.winavr.app.debug.801818658;de.innot.avreclipse.compiler.winavr.input.1886533279">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
27
Firmware/.project
Normal file
27
Firmware/.project
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>qlocktwo</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.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
<nature>de.innot.avreclipse.core.avrnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
23
Firmware/.settings/de.innot.avreclipse.core.prefs
Normal file
23
Firmware/.settings/de.innot.avreclipse.core.prefs
Normal file
@@ -0,0 +1,23 @@
|
||||
avrtarget/ClockFrequency=18432000
|
||||
avrtarget/ExtRAMSize=0
|
||||
avrtarget/ExtendedRAM=false
|
||||
avrtarget/MCUType=atmega168
|
||||
avrtarget/UseEEPROM=false
|
||||
avrtarget/UseExtendedRAMforHeap=true
|
||||
avrtarget/avrdude/BitBangDelay=
|
||||
avrtarget/avrdude/Bitclock=
|
||||
avrtarget/avrdude/EEPROMFile=
|
||||
avrtarget/avrdude/EEPROMFromConfig=true
|
||||
avrtarget/avrdude/FlashFile=
|
||||
avrtarget/avrdude/FlashFromConfig=true
|
||||
avrtarget/avrdude/NoChipErase=false
|
||||
avrtarget/avrdude/NoSigCheck=false
|
||||
avrtarget/avrdude/NoVerify=false
|
||||
avrtarget/avrdude/NoWrite=false
|
||||
avrtarget/avrdude/OtherOptions=
|
||||
avrtarget/avrdude/ProgrammerID=programmerconfig.1
|
||||
avrtarget/avrdude/UseCounter=false
|
||||
avrtarget/avrdude/WriteEEPROM=false
|
||||
avrtarget/avrdude/WriteFlash=true
|
||||
avrtarget/perConfig=false
|
||||
eclipse.preferences.version=1
|
||||
6
Firmware/.settings/org.eclipse.cdt.core.prefs
Normal file
6
Firmware/.settings/org.eclipse.cdt.core.prefs
Normal file
@@ -0,0 +1,6 @@
|
||||
eclipse.preferences.version=1
|
||||
environment/project/de.innot.avreclipse.configuration.app.debug.1815879625/AVRTARGETMCU/delimiter=;
|
||||
environment/project/de.innot.avreclipse.configuration.app.debug.1815879625/AVRTARGETMCU/operation=replace
|
||||
environment/project/de.innot.avreclipse.configuration.app.debug.1815879625/AVRTARGETMCU/value=atmega168
|
||||
environment/project/de.innot.avreclipse.configuration.app.debug.1815879625/append=true
|
||||
environment/project/de.innot.avreclipse.configuration.app.debug.1815879625/appendContributed=true
|
||||
19
Firmware/include/buttons.h
Normal file
19
Firmware/include/buttons.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* buttons.h
|
||||
*
|
||||
* Created on: 09.01.2016
|
||||
* Author: BlexTw11
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_BUTTONS_H_
|
||||
#define INCLUDE_BUTTONS_H_
|
||||
|
||||
#define BTN_PORT PORTD
|
||||
#define BTN_DDR DDRD
|
||||
|
||||
#define BTN_HOUR PD5
|
||||
#define BTN_MINUTE PD6
|
||||
#define BTN_MODE PD7
|
||||
|
||||
|
||||
#endif /* INCLUDE_BUTTONS_H_ */
|
||||
15
Firmware/include/dcf77.h
Normal file
15
Firmware/include/dcf77.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* dcf77.h
|
||||
*
|
||||
* Created on: 09.01.2016
|
||||
* Author: BlexTw11
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_DCF77_H_
|
||||
#define INCLUDE_DCF77_H_
|
||||
|
||||
#define DCF77_PORT PORTB
|
||||
#define DCF77_DDR DDRB
|
||||
#define DCF77_PIN PB0
|
||||
|
||||
#endif /* INCLUDE_DCF77_H_ */
|
||||
24
Firmware/include/ds1307.h
Normal file
24
Firmware/include/ds1307.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* ds1307.h
|
||||
*
|
||||
* Created on: 09.01.2016
|
||||
* Author: BlexTw11
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_DS1307_H_
|
||||
#define INCLUDE_DS1307_H_
|
||||
|
||||
#define I2C_PORT PORTC
|
||||
#define I2C_DDR DDRC
|
||||
#define I2C_CLK PC5
|
||||
#define I2C_DATA PC4
|
||||
|
||||
// Signal In from DS1307 (1 Hz)
|
||||
#define DS1307_PORT PORTD
|
||||
#define DS1307_DDR DDRD
|
||||
#define DS1307_PIN PD4
|
||||
|
||||
#define DS1307_ADDR 0b1101000
|
||||
|
||||
|
||||
#endif /* INCLUDE_DS1307_H_ */
|
||||
19
Firmware/include/global.h
Normal file
19
Firmware/include/global.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef global_h
|
||||
#define global_h
|
||||
|
||||
#define F_CPU 18432000UL
|
||||
|
||||
#define BAUD_RATE 9600
|
||||
|
||||
#define SET(port,pin) (port |= (1<<pin))
|
||||
#define CLR(port,pin) (port &= ~(1<<pin))
|
||||
#define TOGL(port,pin) (port ^= (1<<pin))
|
||||
|
||||
|
||||
#define LED_PORT PORTD
|
||||
#define LED_DDR DDRD
|
||||
#define LED_PIN PD3
|
||||
|
||||
typedef enum { FALSE = 0, TRUE } bool;
|
||||
|
||||
#endif
|
||||
13
Firmware/include/ldr.h
Normal file
13
Firmware/include/ldr.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* ldr.h
|
||||
*
|
||||
* Created on: 09.01.2016
|
||||
* Author: BlexTw11
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_LDR_H_
|
||||
#define INCLUDE_LDR_H_
|
||||
|
||||
|
||||
|
||||
#endif /* INCLUDE_LDR_H_ */
|
||||
33
Firmware/include/shift_register.h
Normal file
33
Firmware/include/shift_register.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef shift_register_h
|
||||
#define shift_register_h
|
||||
|
||||
#include <avr/io.h>
|
||||
|
||||
/* Definiert die Register-Ansteuerung.
|
||||
* Entweder per SPI oder per Software. */
|
||||
#define SPI // SOFTWARE
|
||||
|
||||
#ifdef SOFTWARE
|
||||
// Software
|
||||
#define PORT_SHIREG PORTC
|
||||
#define DDR_SHIREG DDRC // Richtungsregister
|
||||
#define PI_SCL PC5
|
||||
#define PI_SCK PC4
|
||||
#define PI_RCK PC3
|
||||
#define PI_SER PC2
|
||||
//#define PI_G PC2
|
||||
#else
|
||||
// SPI
|
||||
#define DDR_SPI DDRB
|
||||
#define PORT_SPI PORTB
|
||||
#define SPI_RCK PB2 // SS
|
||||
#define SPI_SCK PB5 // SCK
|
||||
#define SPI_SIN PB3 // MOSI
|
||||
#endif
|
||||
// Registerbreite (durch Kaskadierung erweiterbar)
|
||||
#define REG_WIDTH 32
|
||||
|
||||
void shiftReg_Init(void);
|
||||
void shiftReg_Transmit(uint32_t byte);
|
||||
|
||||
#endif
|
||||
20
Firmware/include/uart.h
Normal file
20
Firmware/include/uart.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* uart.h
|
||||
*
|
||||
* Created on: 26.11.2015
|
||||
* Author: BlexTw11
|
||||
*/
|
||||
|
||||
#ifndef UART_H_
|
||||
#define UART_H_
|
||||
|
||||
|
||||
void UART_init(uint16_t baud_rate);
|
||||
|
||||
uint8_t UART_rx_char(void);
|
||||
|
||||
void UART_tx_char(uint8_t data);
|
||||
|
||||
void UART_tx_str(char * data);
|
||||
|
||||
#endif /* UART_H_ */
|
||||
13
Firmware/include/woerter.h
Normal file
13
Firmware/include/woerter.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* woerter.h
|
||||
*
|
||||
* Created on: 09.01.2016
|
||||
* Author: BlexTw11
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_WOERTER_H_
|
||||
#define INCLUDE_WOERTER_H_
|
||||
|
||||
|
||||
|
||||
#endif /* INCLUDE_WOERTER_H_ */
|
||||
8
Firmware/src/buttons.c
Normal file
8
Firmware/src/buttons.c
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* buttons.c
|
||||
*
|
||||
* Created on: 09.01.2016
|
||||
* Author: BlexTw11
|
||||
*/
|
||||
|
||||
|
||||
8
Firmware/src/dcf77.c
Normal file
8
Firmware/src/dcf77.c
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* dcf77.c
|
||||
*
|
||||
* Created on: 09.01.2016
|
||||
* Author: BlexTw11
|
||||
*/
|
||||
|
||||
|
||||
61
Firmware/src/ds1307.c
Normal file
61
Firmware/src/ds1307.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* ds1307.c
|
||||
*
|
||||
* Created on: 09.01.2016
|
||||
* Author: BlexTw11
|
||||
*/
|
||||
#include <util/twi.h>
|
||||
|
||||
void TWIInit(void)
|
||||
{
|
||||
//set SCL to 400kHz
|
||||
TWSR = 0x00;
|
||||
TWBR = 0x0C;
|
||||
//enable TWI
|
||||
TWCR = (1<<TWEN);
|
||||
}
|
||||
|
||||
|
||||
void TWI_start(void)
|
||||
{
|
||||
TWCR = (1<<TWINT)|(1<<TWSTA)|(1<<TWEN);
|
||||
while ((TWCR & (1<<TWINT)) == 0);
|
||||
}
|
||||
|
||||
//send stop signal
|
||||
void TWI_stop(void)
|
||||
{
|
||||
TWCR = (1<<TWINT)|(1<<TWSTO)|(1<<TWEN);
|
||||
}
|
||||
|
||||
|
||||
void TWI_write(uint8_t u8data)
|
||||
{
|
||||
TWDR = u8data;
|
||||
TWCR = (1<<TWINT)|(1<<TWEN);
|
||||
while ((TWCR & (1<<TWINT)) == 0);
|
||||
}
|
||||
|
||||
|
||||
uint8_t TWI_read_ACK(void)
|
||||
{
|
||||
TWCR = (1<<TWINT)|(1<<TWEN)|(1<<TWEA);
|
||||
while ((TWCR & (1<<TWINT)) == 0);
|
||||
return TWDR;
|
||||
}
|
||||
|
||||
|
||||
uint8_t TWI_read_NACK(void)
|
||||
{
|
||||
TWCR = (1<<TWINT)|(1<<TWEN);
|
||||
while ((TWCR & (1<<TWINT)) == 0);
|
||||
return TWDR;
|
||||
}
|
||||
|
||||
uint8_t TWI_get_status(void)
|
||||
{
|
||||
uint8_t status;
|
||||
//mask status
|
||||
status = TWSR & 0xF8;
|
||||
return status;
|
||||
}
|
||||
8
Firmware/src/ldr.c
Normal file
8
Firmware/src/ldr.c
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* ldr.c
|
||||
*
|
||||
* Created on: 09.01.2016
|
||||
* Author: BlexTw11
|
||||
*/
|
||||
|
||||
|
||||
149
Firmware/src/main.c
Normal file
149
Firmware/src/main.c
Normal file
@@ -0,0 +1,149 @@
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <stdint.h>
|
||||
#include <util/delay.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include "global.h"
|
||||
#include "shift_register.h"
|
||||
#include "uart.h"
|
||||
|
||||
#define UART_MAXSTRLEN 20
|
||||
|
||||
volatile uint8_t uart_str_complete = 0; // 1 .. String komplett empfangen
|
||||
volatile uint8_t uart_str_count = 0;
|
||||
volatile char uart_buffer[UART_MAXSTRLEN + 1] = "";
|
||||
|
||||
volatile uint8_t flag_50ms;
|
||||
volatile uint8_t flag_1sec;
|
||||
|
||||
ISR(TIMER0_COMPA_vect)
|
||||
{
|
||||
static uint8_t millisekunden = 0;
|
||||
static uint8_t sekunden = 0;
|
||||
|
||||
if (millisekunden++ == 50)
|
||||
{
|
||||
//TOGL(PORTC, PC0);
|
||||
millisekunden = 0;
|
||||
sekunden++;
|
||||
flag_50ms = 1;
|
||||
}
|
||||
|
||||
if (sekunden == 20)
|
||||
{
|
||||
sekunden = 0;
|
||||
flag_1sec = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ISR(USART_RX_vect)
|
||||
{
|
||||
unsigned char nextChar;
|
||||
|
||||
// Daten aus dem Puffer lesen
|
||||
nextChar = UDR0;
|
||||
if( uart_str_complete == 0 )
|
||||
{ // wenn uart_string gerade in Verwendung, neues Zeichen verwerfen
|
||||
// Daten werden erst in uart_string geschrieben, wenn nicht String-Ende/max Zeichenlänge erreicht ist/string gerade verarbeitet wird
|
||||
if( nextChar != '\n' &&
|
||||
nextChar != '\r' &&
|
||||
uart_str_count < UART_MAXSTRLEN )
|
||||
{
|
||||
uart_buffer[uart_str_count] = nextChar;
|
||||
uart_str_count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
uart_buffer[uart_str_count] = '\0';
|
||||
uart_str_count = 0;
|
||||
uart_str_complete = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void init_timer0(void)
|
||||
{
|
||||
// Timer0 initialisieren.
|
||||
TCCR0A = (1 << WGM01); // CTC Modus
|
||||
TCCR0B = (1 << CS02); // Prescaler: 256
|
||||
OCR0A = 72-1; // Zaehlwert auf 73 setzen
|
||||
TIMSK0 |= (1 << OCIE0A); // Timer Interrupt Maske aktivieren
|
||||
|
||||
/*
|
||||
// Timer initialisieren.
|
||||
TCCR1B = (1 << CS12) | (1 << WGM12); // Prescaler auf 256
|
||||
|
||||
//TCNT0 = 0;
|
||||
|
||||
OCR1AL = 72-1;
|
||||
OCR1AH = 0;
|
||||
|
||||
TIMSK1 |= (1 << OCIE1A);
|
||||
*/
|
||||
}
|
||||
|
||||
int8_t parse_input(void)
|
||||
{
|
||||
if (uart_str_complete)
|
||||
{
|
||||
uart_str_complete = 0;
|
||||
if (uart_buffer[0] == 'L' && uart_buffer[1] == 'E' && uart_buffer[2] == 'D'
|
||||
&& uart_buffer[3] >= 0x1 && uart_buffer[3] <= 0xf)
|
||||
{
|
||||
return uart_buffer[3];
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
uint8_t toggle = 0,
|
||||
led = 1;
|
||||
int8_t input = 0;
|
||||
flag_50ms = 0;
|
||||
flag_1sec = 0;
|
||||
|
||||
init_timer0();
|
||||
//shiftReg_Init();
|
||||
//UART_init(BAUD_RATE);
|
||||
|
||||
LED_DDR = (1 << LED_PIN);
|
||||
LED_PORT &= ~(1 << LED_PIN);
|
||||
|
||||
sei();
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
||||
if (flag_1sec)
|
||||
{
|
||||
flag_1sec = 0;
|
||||
|
||||
//shiftReg_Transmit(led);
|
||||
|
||||
TOGL(LED_PORT, LED_PIN);
|
||||
}
|
||||
|
||||
/*
|
||||
input = parse_input();
|
||||
|
||||
if (input > 0)
|
||||
{
|
||||
shiftReg_Transmit(1 << input-1);
|
||||
UART_tx_str("ACK\n");
|
||||
}
|
||||
else if (input < 0)
|
||||
{
|
||||
UART_tx_str("NACK\n");
|
||||
input = 0;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
Firmware/src/matrix.c
Normal file
8
Firmware/src/matrix.c
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* matrix.c
|
||||
*
|
||||
* Created on: 09.01.2016
|
||||
* Author: BlexTw11
|
||||
*/
|
||||
|
||||
|
||||
96
Firmware/src/shift_register.c
Normal file
96
Firmware/src/shift_register.c
Normal file
@@ -0,0 +1,96 @@
|
||||
/**************************************************************************************************************
|
||||
*
|
||||
* shift_register.c
|
||||
*
|
||||
* Author: BlexTw11
|
||||
* Erstellt am: 04.09.2015
|
||||
*
|
||||
* Ansteuerung fuer Schieberegister (M74HC595).
|
||||
* Register koennen auch kaskadiert werden. Dazu muss das Define REG_WIDTH
|
||||
* in shift_register.h angepasst werden (vielfaches von 8).
|
||||
*
|
||||
***************************************************************************************************************/
|
||||
|
||||
#include <avr/io.h>
|
||||
#include "global.h"
|
||||
#include "shift_register.h"
|
||||
|
||||
/**
|
||||
* @brief Initialisiert die Ports fuer das Schieberegister.
|
||||
*/
|
||||
void shiftReg_Init(void)
|
||||
{
|
||||
#ifdef SOFTWARE
|
||||
// Setze Richtungsregister
|
||||
DDR_SHIREG = (1<<PI_SCL)|(1<<PI_SCK)|(1<<PI_RCK)|(1<<PI_SER);
|
||||
|
||||
//SET(DDR_SHIREG, PI_G);
|
||||
PORT_SHIREG &= ~( (1<<PI_SCL)|(1<<PI_SCK)|(1<<PI_RCK)|(1<<PI_SER) );
|
||||
|
||||
#elif defined SPI
|
||||
/* Set MOSI and SCK output, all others input */
|
||||
DDR_SPI = (1<<SPI_RCK)|(1<<SPI_SCK)|(1<<SPI_SIN);
|
||||
/* Enable SPI, Master, set clock rate fck/16 */
|
||||
SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR0);
|
||||
#endif
|
||||
|
||||
// Reset register
|
||||
shiftReg_Transmit(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialisiert die Ports fuer das Schieberegister.
|
||||
* @param[in] transData Zu uebertragende Daten. Wird byteweise gesendet.
|
||||
*/
|
||||
void shiftReg_Transmit(uint32_t transData)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
#ifdef SOFTWARE
|
||||
|
||||
uint32_t bit = (1 << (REG_WIDTH-1) ); // Bit auf MSB setzen, in Abhaengigkeit von Registerbreite.
|
||||
|
||||
// Setze SCLR auf High
|
||||
SET(PORT_SHIREG, PI_SCL);
|
||||
|
||||
for (i = 0; i < REG_WIDTH; i++)
|
||||
{
|
||||
// Shifte das Bit bei jedem Durchlauf nach rechts und AND-Verknuepfe es mit dem
|
||||
// Byte-Inhalt.
|
||||
if ( transData & (bit >> i) )
|
||||
{
|
||||
SET(PORT_SHIREG, PI_SER);
|
||||
}
|
||||
else
|
||||
{
|
||||
CLR(PORT_SHIREG, PI_SER);
|
||||
}
|
||||
|
||||
// Setze Impuls auf den Schiebe-Takt
|
||||
CLR(PORT_SHIREG, PI_SCK);
|
||||
SET(PORT_SHIREG, PI_SCK);
|
||||
CLR(PORT_SHIREG, PI_SCK);
|
||||
}
|
||||
|
||||
// Setze Impuls auf den Speichertakt.
|
||||
CLR(PORT_SHIREG, PI_RCK);
|
||||
SET(PORT_SHIREG, PI_RCK);
|
||||
CLR(PORT_SHIREG, PI_RCK);
|
||||
|
||||
#elif defined SPI
|
||||
|
||||
//for (i = 0; i < (REG_WIDTH >> 3); i++)
|
||||
{
|
||||
/* Start transmission */
|
||||
SPDR = (transData << 8);
|
||||
/* Wait for transmission complete */
|
||||
while(!(SPSR & (1 << SPIF)));
|
||||
|
||||
// Setze Impuls auf den Speichertakt.
|
||||
CLR(PORT_SPI, SPI_RCK);
|
||||
SET(PORT_SPI, SPI_RCK);
|
||||
CLR(PORT_SPI, SPI_RCK);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
47
Firmware/src/uart.c
Normal file
47
Firmware/src/uart.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* uart.c
|
||||
*
|
||||
* Created on: 26.11.2015
|
||||
* Author: BlexTw11
|
||||
*/
|
||||
#include <avr/io.h>
|
||||
#include "global.h"
|
||||
#include "uart.h"
|
||||
|
||||
void UART_init(uint16_t baud_rate)
|
||||
{
|
||||
// Set baud rate (Calculation type is VERY importent!)
|
||||
uint16_t baud_val = ( F_CPU/16/baud_rate - 1 );
|
||||
UBRR0H = baud_val >> 8;
|
||||
UBRR0L = baud_val & 0xff;
|
||||
|
||||
// enable receiver and transmitter
|
||||
UCSR0B = (1 << RXEN0) | (1 << TXEN0) | (1<<RXCIE0);
|
||||
|
||||
// set frame format: 8 bit data, 1 stop bit
|
||||
UCSR0C = (1 << UCSZ01) | (1 << UCSZ00);
|
||||
}
|
||||
|
||||
uint8_t UART_rx_char(void)
|
||||
{
|
||||
/* Wait for data to be received */
|
||||
while ( !(UCSR0A & (1<<RXC0)) );
|
||||
/* Get and return received data from buffer */
|
||||
return UDR0;
|
||||
}
|
||||
|
||||
void UART_tx_char(uint8_t data)
|
||||
{
|
||||
/* Wait for empty transmit buffer */
|
||||
while ( !( UCSR0A & (1<<UDRE0)) );
|
||||
/* Put data into buffer, sends the data */
|
||||
UDR0 = data;
|
||||
}
|
||||
|
||||
void UART_tx_str(char * data)
|
||||
{
|
||||
while(*data)
|
||||
UART_tx_char(*(data++));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user