samd21,samd51,nrf52840: unify bootloader entry process

This commit is contained in:
sago35
2022-07-05 22:28:13 +09:00
committed by Ron Evans
parent ff7c71c99c
commit fcefcb191c
9 changed files with 60 additions and 69 deletions
+6 -2
View File
@@ -320,7 +320,9 @@ func (usbcdc *USBCDC) handleInterrupt(interrupt.Interrupt) {
count := int(nrf.USBD.SIZE.EPOUT[0].Get())
if count >= 7 {
parseUSBLineInfo(udd_ep_out_cache_buffer[0][:count])
checkShouldReset()
if usbLineInfo.dwDTERate == 1200 && usbLineInfo.lineState&usb_CDC_LINESTATE_DTR == 0 {
EnterBootloader()
}
}
nrf.USBD.TASKS_EP0STATUS.Set(1)
}
@@ -484,7 +486,9 @@ func cdcSetup(setup usbSetup) bool {
if setup.bRequest == usb_CDC_SET_CONTROL_LINE_STATE {
usbLineInfo.lineState = setup.wValueL
checkShouldReset()
if usbLineInfo.dwDTERate == 1200 && usbLineInfo.lineState&usb_CDC_LINESTATE_DTR == 0 {
EnterBootloader()
}
nrf.USBD.TASKS_EP0STATUS.Set(1)
}