Start Programm

This commit is contained in:
BlubbFish 2020-10-19 18:16:51 +02:00
parent a5a8edfb18
commit da2c79f81a
10 changed files with 492 additions and 0 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
/Platine/*.T3000OPEN
/Aisler
/Gehäuse/PCB
/Programm/Audio-Switch/Audio-Switch.componentinfo.xml

View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Atmel Studio Solution File, Format Version 11.00
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "Audio-Switch", "Audio-Switch\Audio-Switch.cppproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AVR = Debug|AVR
Release|AVR = Release|AVR
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,183 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.Atmel.AVRGCC8.CPP</ToolchainName>
<ProjectGuid>dce6c7e3-ee26-4d79-826b-08594b9ad897</ProjectGuid>
<avrdevice>ATmega48PA</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>CPP</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>Audio-Switch</AssemblyName>
<Name>Audio-Switch</Name>
<RootNamespace>Audio-Switch</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<BootSegment>2</BootSegment>
<ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey />
<AsfFrameworkConfig>
<framework-data xmlns="">
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.48.0" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGccCpp>
<avrgcc.common.Device>-mmcu=atmega48pa -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\gcc\dev\atmega48pa"</avrgcc.common.Device>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>NDEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcccpp.compiler.symbols.DefSymbols>
<ListValues>
<Value>NDEBUG</Value>
</ListValues>
</avrgcccpp.compiler.symbols.DefSymbols>
<avrgcccpp.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include</Value>
</ListValues>
</avrgcccpp.compiler.directories.IncludePaths>
<avrgcccpp.compiler.optimization.level>Optimize for size (-Os)</avrgcccpp.compiler.optimization.level>
<avrgcccpp.compiler.optimization.PackStructureMembers>True</avrgcccpp.compiler.optimization.PackStructureMembers>
<avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
<avrgcccpp.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</avrgcccpp.linker.libraries.Libraries>
<avrgcccpp.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include</Value>
</ListValues>
</avrgcccpp.assembler.general.IncludePaths>
</AvrGccCpp>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGccCpp>
<avrgcc.common.Device>-mmcu=atmega48pa -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\gcc\dev\atmega48pa"</avrgcc.common.Device>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>DEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcccpp.compiler.symbols.DefSymbols>
<ListValues>
<Value>DEBUG</Value>
</ListValues>
</avrgcccpp.compiler.symbols.DefSymbols>
<avrgcccpp.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include</Value>
</ListValues>
</avrgcccpp.compiler.directories.IncludePaths>
<avrgcccpp.compiler.optimization.level>Optimize (-O1)</avrgcccpp.compiler.optimization.level>
<avrgcccpp.compiler.optimization.PackStructureMembers>True</avrgcccpp.compiler.optimization.PackStructureMembers>
<avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcccpp.compiler.optimization.DebugLevel>Default (-g2)</avrgcccpp.compiler.optimization.DebugLevel>
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
<avrgcccpp.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</avrgcccpp.linker.libraries.Libraries>
<avrgcccpp.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.4.351\include</Value>
</ListValues>
</avrgcccpp.assembler.general.IncludePaths>
<avrgcccpp.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcccpp.assembler.debugging.DebugLevel>
</AvrGccCpp>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="io\ports\pin.hpp">
<SubType>compile</SubType>
</Compile>
<Compile Include="io\ports\portb.hpp">
<SubType>compile</SubType>
</Compile>
<Compile Include="io\ports\portc.hpp">
<SubType>compile</SubType>
</Compile>
<Compile Include="io\ports\portd.hpp">
<SubType>compile</SubType>
</Compile>
<Compile Include="main.cpp">
<SubType>compile</SubType>
</Compile>
<Compile Include="peripheral.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="Programm.hpp">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="io" />
<Folder Include="io\ports" />
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>

View File

@ -0,0 +1,31 @@
/*
* Programm.hpp
*
* Created: 19.10.2020 18:03:50
* Author: netz
*/
#define F_CPU 8000000
#include "peripheral.h"
template <int delay_plus>
class ProgrammT {
public:
ProgrammT() {
}
void Setup() {
}
void Loop() {
}
void PttVect() {
}
};
typedef ProgrammT<settings_prog_delay_plus> Programm;

View File

@ -0,0 +1,93 @@
/*
* pin.cpp
*
* Created: 25.01.2020 21:02:41
* Author: netz
*/
#ifndef BLUBBLIB_PIN_HPP
#define BLUBBLIB_PIN_HPP
#include <avr/io.h>
namespace blubblib {
template <typename PortT, uint8_t Pin>
struct pin {
static void Set(bool value = true) {
if (value) {
PortT::Port(PortT::Port() | (1<<Pin));
} else {
PortT::Port(PortT::Port() & ~(1<<Pin));
}
}
static void Clear() {
Set(false);
}
static void Toggle() {
PortT::Port(PortT::Port() ^ (1<<Pin));
}
static bool Get() {
return (PortT::Port() & (1<<Pin)) != 0;
}
static bool Value() {
return (PortT::Pin() & (1<<Pin)) != 0;
}
static void Output(bool value) {
if (value) {
PortT::Dir(PortT::Dir() | (1<<Pin));
} else {
PortT::Dir(PortT::Dir() & ~(1<<Pin));
}
}
static bool Output() {
return (PortT::Dir() & (1<<Pin)) != 0;
}
static void MakeOutput() {
Output(true);
}
static void MakeInput() {
Output(false);
Clear();
}
static void MakeLow() {
Clear();
Output(true);
}
static void MakeHigh() {
Set();
Output(true);
}
static void SetValue(bool value) {
Set(value);
}
static void SetHigh() {
Set(true);
}
static void SetLow() {
Set(false);
}
static bool Read() {
return Value();
}
static void Pullup() {
Output(false);
SetHigh();
}
};
}
#endif

View File

@ -0,0 +1,40 @@
/*
* portb.cpp
*
* Created: 19.10.2020 17:46:58
* Author: netz
*/
#ifndef BLUBBLIB_PORTB_HPP
#define BLUBBLIB_PORTB_HPP
#include <avr/io.h>
namespace blubblib {
struct portb {
static uint8_t Port() {
return PORTB;
}
static void Port(uint8_t v) {
PORTB = v;
}
static uint8_t Pin() {
return PINB;
}
static void Pin(uint8_t v) {
PINB = v;
}
static uint8_t Dir() {
return DDRB;
}
static void Dir(uint8_t v) {
DDRB = v;
}
};
}
#endif

View File

@ -0,0 +1,40 @@
/*
* portc.cpp
*
* Created: 19.10.2020 17:46:58
* Author: netz
*/
#ifndef BLUBBLIB_PORTC_HPP
#define BLUBBLIB_PORTC_HPP
#include <avr/io.h>
namespace blubblib {
struct portc {
static uint8_t Port() {
return PORTC;
}
static void Port(uint8_t v) {
PORTC = v;
}
static uint8_t Pin() {
return PINC;
}
static void Pin(uint8_t v) {
PINC = v;
}
static uint8_t Dir() {
return DDRC;
}
static void Dir(uint8_t v) {
DDRC = v;
}
};
}
#endif

View File

@ -0,0 +1,40 @@
/*
* portd.cpp
*
* Created: 19.10.2020 17:46:58
* Author: netz
*/
#ifndef BLUBBLIB_PORTD_HPP
#define BLUBBLIB_PORTD_HPP
#include <avr/io.h>
namespace blubblib {
struct portd {
static uint8_t Port() {
return PORTD;
}
static void Port(uint8_t v) {
PORTD = v;
}
static uint8_t Pin() {
return PIND;
}
static void Pin(uint8_t v) {
PIND = v;
}
static uint8_t Dir() {
return DDRD;
}
static void Dir(uint8_t v) {
DDRD = v;
}
};
}
#endif

View File

@ -0,0 +1,23 @@
/*
* Audio-Switch.cpp
*
* Created: 19.10.2020 17:26:46
* Author : netz
*/
#include "Programm.hpp"
#include <avr/interrupt.h>
Programm p;
int main(void) {
sei();
p.Setup();
while (1) {
p.Loop();
}
}
ISR(INT0_vect) {
p.PttVect();
}

View File

@ -0,0 +1,19 @@
/*
* peripheral.h
*
* Created: 19.10.2020 18:08:27
* Author: netz
*/
#ifndef PERIPHERAL_H_
#define PERIPHERAL_H_
namespace {
//Programm settings
extern int const settings_prog_delay_plus = 5000;
}
#endif /* PERIPHERAL_H_ */