forked from OpenStickCommunity/GP2040-CE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
44 lines (35 loc) · 930 Bytes
/
main.cpp
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
/*
* SPDX-License-Identifier: MIT
* SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com)
*/
// Pi Pico includes
#include "pico/multicore.h"
// GP2040 includes
#include "gp2040.h"
#include "gp2040aux.h"
#include <cstdlib>
// Custom implementation of __gnu_cxx::__verbose_terminate_handler() to reduce binary size
namespace __gnu_cxx {
void __verbose_terminate_handler()
{
abort();
}
}
// Launch our second core with additional modules loaded in
void core1() {
multicore_lockout_victim_init(); // block core 1
// Create GP2040 w/ Additional Modules for Core 1
GP2040Aux * gp2040Core1 = new GP2040Aux();
gp2040Core1->setup();
gp2040Core1->run();
}
int main() {
// Create GP2040 Main Core (core0), Core1 is dependent on Core0
GP2040 * gp2040 = new GP2040();
gp2040->setup();
// Create GP2040 Thread for Core1
multicore_launch_core1(core1);
// Start Core0 Loop
gp2040->run();
return 0;
}