Compare commits
1
Commits
4f79d1d1d8
...
74b337804b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74b337804b |
No files matched your search
+1
-1
Submodule adc/adc updated: 2f54f9217f...bcae00c0f3.
@@ -179,9 +179,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>
|
||||
|
||||
+39
-5
@@ -1,18 +1,52 @@
|
||||
|
||||
#define ADC_INT_VECTOR
|
||||
#include "adc/adc.hpp"
|
||||
|
||||
void adcTest()
|
||||
static void adcReadCallback(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;
|
||||
}
|
||||
Reference in new issue
Block a user