-
Notifications
You must be signed in to change notification settings - Fork 164
Expand file tree
/
Copy pathmain.cpp
More file actions
49 lines (41 loc) · 1.03 KB
/
main.cpp
File metadata and controls
49 lines (41 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* Copyright (c) 2021, Jeff McBride
*
* 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>
using namespace modm::platform;
using namespace modm::literals;
// Rename because the ::Adc typename defined in the CMSIS header conflicts with
// the name imported from the modm::platform namespace
using AdcDev = modm::platform::Adc;
int
main()
{
/** This example reads all 6 ADC channels and prints their values to the
* debug UART.
**/
Board::initialize();
AdcDev::initialize<Board::SystemClock>();
AdcDev::connect<
GpioA17::Ad,
GpioA18::Ad,
GpioA19::Ad,
GpioA20::Ad,
GpioB0::Ad,
GpioB1::Ad>();
while (true)
{
MODM_LOG_INFO << "ADC Readings: ";
for(uint32_t i=0; i<6; i++)
{
MODM_LOG_INFO.printf("%5d ", AdcDev::readChannel(i));
}
MODM_LOG_INFO << modm::endl;
modm::delay(500ms);
}
}