Copy the arduino CDC reset handling

pull/144/head
Alex Voinea 2021-11-24 17:50:59 +01:00
parent e3b680cee7
commit 78c24606f5
1 changed files with 9 additions and 6 deletions

View File

@ -72,16 +72,19 @@ void EVENT_USB_Device_ControlRequest(void) {
* \param[in] CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced * \param[in] CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced
*/ */
void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t *const CDCInterfaceInfo) { void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t *const CDCInterfaceInfo) {
} if (CDCInterfaceInfo->State.LineEncoding.BaudRateBPS == 1200 && !(CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR)) {
if (pgm_read_word(FLASHEND - 1) == 0xDCFB)
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t *const CDCInterfaceInfo) { *(uint16_t *)(RAMEND - 1) = 0x7777; //MMU2-MK3 bootloader
if (CDCInterfaceInfo->State.LineEncoding.BaudRateBPS == 1200) { else
// *(uint16_t *)0x0800U = 0x7777; //old bootloader? *(uint16_t *)0x0800U = 0x7777; //MMU2-MK4 bootloader with UART support
*(uint16_t *)(RAMEND - 1) = 0x7777;
hal::cpu::resetPending = true; hal::cpu::resetPending = true;
hal::watchdog::Enable(hal::watchdog::configuration::compute(250)); hal::watchdog::Enable(hal::watchdog::configuration::compute(250));
} }
} }
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t *const CDCInterfaceInfo) {
}
} }
namespace modules { namespace modules {