Compare commits
4 Commits
060da11a75
...
example
| Author | SHA1 | Date | |
|---|---|---|---|
| edd1c53401 | |||
| cec0ec6299 | |||
| 74b337804b | |||
| 4f79d1d1d8 |
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +1,6 @@
|
|||||||
[submodule "adc/adc"]
|
[submodule "adc/adc"]
|
||||||
path = adc/adc
|
path = adc/adc
|
||||||
url = git@git.blackmark.me:avr/adc.git
|
url = git@git.blackmark.me:avr/adc.git
|
||||||
|
[submodule "adc/io"]
|
||||||
|
path = adc/io
|
||||||
|
url = git@git.blackmark.me:avr/io.git
|
||||||
|
|||||||
2
adc/adc
2
adc/adc
Submodule adc/adc updated: c741dc98a1...5e9dac872a
@@ -47,16 +47,31 @@
|
|||||||
<avrtoolinterfaceclock>125000</avrtoolinterfaceclock>
|
<avrtoolinterfaceclock>125000</avrtoolinterfaceclock>
|
||||||
<AsfFrameworkConfig>
|
<AsfFrameworkConfig>
|
||||||
<framework-data xmlns="">
|
<framework-data xmlns="">
|
||||||
<options />
|
<options />
|
||||||
<configurations />
|
<configurations />
|
||||||
<files />
|
<files />
|
||||||
<documentation help="" />
|
<documentation help="" />
|
||||||
<offline-documentation help="" />
|
<offline-documentation help="" />
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.47.0" />
|
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.47.0" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</framework-data>
|
</framework-data>
|
||||||
</AsfFrameworkConfig>
|
</AsfFrameworkConfig>
|
||||||
|
<AAFDebugger>
|
||||||
|
<AAFDebugFiles xmlns="">
|
||||||
|
<DebugFile>
|
||||||
|
<path>\Debug\adc.lss</path>
|
||||||
|
<AAFSetting>
|
||||||
|
<Label>Lss Files</Label>
|
||||||
|
<Extention>.lss</Extention>
|
||||||
|
<Regex>^\s*(?<address>[a-f0-9]*):\s*.*$</Regex>
|
||||||
|
<DebugEnabled>true</DebugEnabled>
|
||||||
|
<RegexGroups>address</RegexGroups>
|
||||||
|
<DebuggerExpression>$pc</DebuggerExpression>
|
||||||
|
</AAFSetting>
|
||||||
|
</DebugFile>
|
||||||
|
</AAFDebugFiles>
|
||||||
|
</AAFDebugger>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
<ToolchainSettings>
|
<ToolchainSettings>
|
||||||
@@ -179,12 +194,22 @@
|
|||||||
<Compile Include="adc\adc.hpp">
|
<Compile Include="adc\adc.hpp">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="adc\config.hpp">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="adc\hardware.hpp">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="io\io.hpp">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="main.cpp">
|
<Compile Include="main.cpp">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="adc" />
|
<Folder Include="adc" />
|
||||||
|
<Folder Include="io" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
1
adc/io
Submodule
1
adc/io
Submodule
Submodule adc/io added at 80de36ee7e
46
adc/main.cpp
46
adc/main.cpp
@@ -1,6 +1,52 @@
|
|||||||
|
|
||||||
|
#define ADC_INT_VECTOR
|
||||||
#include "adc/adc.hpp"
|
#include "adc/adc.hpp"
|
||||||
|
|
||||||
|
static void adcReadCallback(const uint16_t &adcSample)
|
||||||
|
{
|
||||||
|
static_cast<void>(adcSample);
|
||||||
|
}
|
||||||
|
|
||||||
|
void adcTest1()
|
||||||
|
{
|
||||||
|
using namespace adc;
|
||||||
|
|
||||||
|
using mode = AutoMode<TriggerSource::TIMER0_COMP_A>;
|
||||||
|
using adc_conf = Config<mode>;
|
||||||
|
|
||||||
|
Adc<adc_conf, io::P, io::P::C5> adcPin;
|
||||||
|
adcPin.init(adcReadCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
void adcTest2()
|
||||||
|
{
|
||||||
|
using namespace adc;
|
||||||
|
|
||||||
|
using mode = FreeRunningMode;
|
||||||
|
using adc_conf = Config<mode>;
|
||||||
|
|
||||||
|
Adc<adc_conf, InputSource, InputSource::VBG> adcPin;
|
||||||
|
adcPin.init(adcReadCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
void adcTest3()
|
||||||
|
{
|
||||||
|
using namespace adc;
|
||||||
|
|
||||||
|
using mode = SingleMode;
|
||||||
|
using adc_conf = Config<mode>;
|
||||||
|
|
||||||
|
Adc<adc_conf, InputSource, InputSource::VBG> adcPin;
|
||||||
|
adcPin.init();
|
||||||
|
auto adcSample = adcPin.read();
|
||||||
|
static_cast<void>(adcSample);
|
||||||
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
adcTest1();
|
||||||
|
adcTest2();
|
||||||
|
adcTest3();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user