diff --git a/CMakeLists.txt b/CMakeLists.txt index 395b907..f633e01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,4 +39,8 @@ target_link_libraries(mtgcard PUBLIC pico_unique_id ) +target_compile_definitions(mtgcard PRIVATE + PICO_ENTER_USB_BOOT_ON_EXIT=1 +) + pico_add_extra_outputs(mtgcard) diff --git a/src/main.cpp b/src/main.cpp index 733ec79..7f1e192 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -185,6 +186,12 @@ void tud_vendor_rx_cb(uint8_t itf, const uint8_t* buffer, uint16_t bufsize) return; } + // special command to reset to bootsel + if (buffer[0] == 0x99) + { + rom_reset_usb_boot(0, 0); + } + rx.state = RX::GETTING_CMC; rx.card_index = CardSlot::get_unused(flash);