-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathmain.cpp
More file actions
45 lines (40 loc) · 861 Bytes
/
main.cpp
File metadata and controls
45 lines (40 loc) · 861 Bytes
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
/*
* Copyright (c) 2020, Erik Henriksson
*
* 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 Board;
using namespace std::chrono_literals;
static volatile bool blink = true;
void
isr()
{
blink = !blink;
// Kids, please don't do serial logging in ISRs...
MODM_LOG_DEBUG << "blink: " << (blink ? "true" : "false") << modm::endl;
}
int
main()
{
Board::initialize();
ExternalInterrupt::initialize(Board::SystemClock::ClockGen32kHz);
ExtInt<3>::initialize(&isr);
ExtInt<3>::connect<D12>();
while (1)
{
if (blink)
{
Led::toggle();
} else
{
Led::set(0);
}
modm::delay(100ms);
}
return 0;
}