Compare commits

...

3 Commits

Author SHA1 Message Date
edd1c53401 Adapt to changed callback signature 2020-04-13 00:03:32 +02:00
cec0ec6299 Updated adc submodule 2020-04-05 03:40:25 +02:00
74b337804b Implemented example usage 2020-02-21 21:54:12 +01:00
3 changed files with 61 additions and 6 deletions

Submodule adc/adc updated: 2f54f9217f...5e9dac872a

View File

@@ -57,6 +57,21 @@
</dependencies>
</framework-data>
</AsfFrameworkConfig>
<AAFDebugger>
<AAFDebugFiles xmlns="">
<DebugFile>
<path>\Debug\adc.lss</path>
<AAFSetting>
<Label>Lss Files</Label>
<Extention>.lss</Extention>
<Regex>^\s*(?&lt;address&gt;[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,9 +194,15 @@
<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>

View File

@@ -1,18 +1,52 @@
#define ADC_INT_VECTOR
#include "adc/adc.hpp"
void adcTest()
static void adcReadCallback(const uint16_t &adcSample)
{
static_cast<void>(adcSample);
}
void adcTest1()
{
using namespace adc;
using adc_conf = Config<>;
using mode = AutoMode<TriggerSource::TIMER0_COMP_A>;
using adc_conf = Config<mode>;
Adc<adc_conf, io::P::C5> adcPin;
adcPin.read();
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()
{
adcTest();
adcTest1();
adcTest2();
adcTest3();
return 0;
}