-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58fa908
commit 7330500
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2021, Jeff McBride | ||
* Copyright (c) 2022, Christopher Durand | ||
* | ||
* This file is part of the modm project. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
#include <modm/board.hpp> | ||
#include <modm/io/iostream.hpp> | ||
|
||
using namespace modm::platform; | ||
using namespace modm::literals; | ||
|
||
using Ad2 = GpioA19::Ad; // channel 0, pin AD2 on board | ||
using Ad3 = GpioD30::Ad; // channel 8, pin AD3 on board | ||
|
||
int main() | ||
{ | ||
Board::initialize(); | ||
|
||
Afec0::initialize<Board::SystemClock>(); | ||
Afec0::connect<Ad2::Ad, Ad3::Ad>(); | ||
|
||
while (true) | ||
{ | ||
MODM_LOG_INFO << "ADC Readings: "; | ||
MODM_LOG_INFO.printf("%5d ", Afec0::readChannel(Afec0::getPinChannel<Ad2>())); | ||
MODM_LOG_INFO.printf("%5d ", Afec0::readChannel(Afec0::getPinChannel<Ad3>())); | ||
MODM_LOG_INFO << modm::endl; | ||
|
||
modm::delay(500ms); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<library> | ||
<extends>modm:samv71-xplained-ultra</extends> | ||
<options> | ||
<option name="modm:build:build.path">../../../build/samv71_xplained_ultra/adc</option> | ||
</options> | ||
<modules> | ||
<module>modm:build:scons</module> | ||
<module>modm:platform:adc:0</module> | ||
</modules> | ||
</library> |