File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,18 @@ class _MFIFO {
94
94
// once otherIdled == false.
95
95
}
96
96
97
+ void clear () {
98
+ uint32_t val;
99
+
100
+ while (queue_try_remove (&_queue[0 ], &val)) {
101
+ tight_loop_contents ();
102
+ }
103
+
104
+ while (queue_try_remove (&_queue[1 ], &val)) {
105
+ tight_loop_contents ();
106
+ }
107
+ }
108
+
97
109
private:
98
110
static void __no_inline_not_in_flash_func (_irq)() {
99
111
multicore_fifo_clear_irq ();
@@ -118,6 +130,8 @@ class _MFIFO {
118
130
119
131
class RP2040 ;
120
132
extern RP2040 rp2040;
133
+ extern " C" void main1 ();
134
+
121
135
class RP2040 {
122
136
public:
123
137
RP2040 () {
@@ -172,6 +186,12 @@ class RP2040 {
172
186
fifo.resumeOtherCore ();
173
187
}
174
188
189
+ void restartCore1 () {
190
+ multicore_reset_core1 ();
191
+ fifo.clear ();
192
+ multicore_launch_core1 (main1);
193
+ }
194
+
175
195
// Multicore comms FIFO
176
196
_MFIFO fifo;
177
197
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ void initVariant() { }
41
41
// Optional 2nd core setup and loop
42
42
extern void setup1 () __attribute__((weak));
43
43
extern void loop1 () __attribute__((weak));
44
- static void main1 () {
44
+ extern " C " void main1 () {
45
45
rp2040.fifo .registerCore ();
46
46
if (setup1) {
47
47
setup1 ();
You can’t perform that action at this time.
0 commit comments