| 59 | } |
| 60 | |
| 61 | void System::reboot(BootMode bootMode) { |
| 62 | // Halt all running USB instances |
| 63 | USBHostManager::getInstance().shutdown(); |
| 64 | |
| 65 | // Make sure that the other core is halted |
| 66 | // We do not want it to be talking to devices (e.g. OLED display) while we reboot |
| 67 | multicore_lockout_start_timeout_us(0xfffffffffffffff); |
| 68 | |
| 69 | watchdog_hw->scratch[5] = static_cast<uint32_t>(bootMode); |
| 70 | |
| 71 | // This is based on MicroPythons machine.reset() |
| 72 | watchdog_reboot(0, 0, 0); |
| 73 | for (;;) { |
| 74 | __wfi(); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | System::BootMode System::takeBootMode() { |
| 79 | // If the boot was not caused by software we don't enter any of the special modes |
no test coverage detected