Compare commits
3 Commits
4f79d1d1d8
...
edd1c53401
| Author | SHA1 | Date | |
|---|---|---|---|
| edd1c53401 | |||
| cec0ec6299 | |||
| 74b337804b |
2
adc/adc
2
adc/adc
Submodule adc/adc updated: 2f54f9217f...5e9dac872a
@@ -57,6 +57,21 @@
|
|||||||
</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,9 +194,15 @@
|
|||||||
<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">
|
<Compile Include="adc\hardware.hpp">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</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>
|
||||||
|
|||||||
44
adc/main.cpp
44
adc/main.cpp
@@ -1,18 +1,52 @@
|
|||||||
|
|
||||||
|
#define ADC_INT_VECTOR
|
||||||
#include "adc/adc.hpp"
|
#include "adc/adc.hpp"
|
||||||
|
|
||||||
void adcTest()
|
static void adcReadCallback(const uint16_t &adcSample)
|
||||||
|
{
|
||||||
|
static_cast<void>(adcSample);
|
||||||
|
}
|
||||||
|
|
||||||
|
void adcTest1()
|
||||||
{
|
{
|
||||||
using namespace adc;
|
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;
|
Adc<adc_conf, io::P, io::P::C5> adcPin;
|
||||||
adcPin.read();
|
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()
|
||||||
{
|
{
|
||||||
adcTest();
|
adcTest1();
|
||||||
|
adcTest2();
|
||||||
|
adcTest3();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user