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"]
|
||||
path = adc/adc
|
||||
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
@@ -55,8 +55,23 @@
|
||||
<dependencies>
|
||||
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.47.0" />
|
||||
</dependencies>
|
||||
</framework-data>
|
||||
</framework-data>
|
||||
</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 Condition=" '$(Configuration)' == 'Release' ">
|
||||
<ToolchainSettings>
|
||||
@@ -179,12 +194,22 @@
|
||||
<Compile Include="adc\adc.hpp">
|
||||
<SubType>compile</SubType>
|
||||
</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">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="adc" />
|
||||
<Folder Include="io" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||
</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"
|
||||
|
||||
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()
|
||||
{
|
||||
adcTest1();
|
||||
adcTest2();
|
||||
adcTest3();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user