Allow for resetting to USB bootsel via vendor-specific protocol
This commit is contained in:
parent
83e3b51b40
commit
868a0562be
@ -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)
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
|
||||
#include <hardware/clocks.h>
|
||||
#include <pico/binary_info.h>
|
||||
#include <pico/bootrom.h>
|
||||
#include <pico/stdlib.h>
|
||||
#include <tusb.h>
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user