mirror of
https://github.com/eddyem/stm32samples.git
synced 2025-12-06 10:45:11 +03:00
fix bug in USB CDC
This commit is contained in:
parent
9a010dfa13
commit
5f91b4eca7
@ -310,17 +310,14 @@ static uint16_t EP0_Handler(ep_t ep){
|
||||
}
|
||||
}else if (ep.rx_flag){ // got data over EP0 or host acknowlegement
|
||||
if(ep.rx_cnt){
|
||||
// EP_WriteIRQ(0, (uint8_t *)0, 0);
|
||||
//EP_WriteIRQ(0, (uint8_t *)0, 0);
|
||||
if(setup_packet.bRequest == SET_LINE_CODING){
|
||||
linecoding_handler((usb_LineCoding*)ep0databuf);
|
||||
}
|
||||
}
|
||||
// Close transaction
|
||||
epstatus = CLEAR_DTOG_RX(epstatus);
|
||||
epstatus = CLEAR_DTOG_TX(epstatus);
|
||||
// wait for new data from host
|
||||
epstatus = SET_VALID_RX(epstatus);
|
||||
epstatus = SET_STALL_TX(epstatus);
|
||||
epstatus = SET_VALID_TX(epstatus);
|
||||
} else if (ep.tx_flag){ // package transmitted
|
||||
// now we can change address after enumeration
|
||||
if ((USB->DADDR & USB_DADDR_ADD) != USB_Dev.USB_Addr){
|
||||
|
||||
@ -330,18 +330,14 @@ uint16_t EP0_Handler(ep_t ep){
|
||||
}
|
||||
}else if (ep.rx_flag){ // got data over EP0 or host acknowlegement
|
||||
if(ep.rx_cnt){
|
||||
//EP_WriteIRQ(0, (uint8_t *)0, 0);
|
||||
if(setup_packet.bRequest == SET_LINE_CODING){
|
||||
WRITEDUMP("SET_LINE_CODING");
|
||||
linecoding_handler((usb_LineCoding*)ep0databuf);
|
||||
}
|
||||
//EP_WriteIRQ(0, (uint8_t *)0, 0);
|
||||
}
|
||||
// Close transaction
|
||||
epstatus = CLEAR_DTOG_RX(epstatus);
|
||||
epstatus = CLEAR_DTOG_TX(epstatus);
|
||||
// wait for new data from host
|
||||
epstatus = SET_VALID_RX(epstatus);
|
||||
epstatus = SET_STALL_TX(epstatus);
|
||||
epstatus = SET_VALID_TX(epstatus);
|
||||
} else if (ep.tx_flag){ // package transmitted
|
||||
// now we can change address after enumeration
|
||||
if ((USB->DADDR & USB_DADDR_ADD) != USB_Dev.USB_Addr){
|
||||
|
||||
@ -307,17 +307,14 @@ static uint16_t EP0_Handler(ep_t ep){
|
||||
}
|
||||
}else if (ep.rx_flag){ // got data over EP0 or host acknowlegement
|
||||
if(ep.rx_cnt){
|
||||
// EP_WriteIRQ(0, (uint8_t *)0, 0);
|
||||
//EP_WriteIRQ(0, (uint8_t *)0, 0);
|
||||
if(setup_packet.bRequest == SET_LINE_CODING){
|
||||
linecoding_handler((usb_LineCoding*)ep0databuf);
|
||||
}
|
||||
}
|
||||
// Close transaction
|
||||
epstatus = CLEAR_DTOG_RX(epstatus);
|
||||
epstatus = CLEAR_DTOG_TX(epstatus);
|
||||
// wait for new data from host
|
||||
epstatus = SET_VALID_RX(epstatus);
|
||||
epstatus = SET_STALL_TX(epstatus);
|
||||
epstatus = SET_VALID_TX(epstatus);
|
||||
} else if (ep.tx_flag){ // package transmitted
|
||||
// now we can change address after enumeration
|
||||
if ((USB->DADDR & USB_DADDR_ADD) != USB_Dev.USB_Addr){
|
||||
|
||||
@ -307,17 +307,14 @@ static uint16_t EP0_Handler(ep_t ep){
|
||||
}
|
||||
}else if (ep.rx_flag){ // got data over EP0 or host acknowlegement
|
||||
if(ep.rx_cnt){
|
||||
// EP_WriteIRQ(0, (uint8_t *)0, 0);
|
||||
//EP_WriteIRQ(0, (uint8_t *)0, 0);
|
||||
if(setup_packet.bRequest == SET_LINE_CODING){
|
||||
linecoding_handler((usb_LineCoding*)ep0databuf);
|
||||
}
|
||||
}
|
||||
// Close transaction
|
||||
epstatus = CLEAR_DTOG_RX(epstatus);
|
||||
epstatus = CLEAR_DTOG_TX(epstatus);
|
||||
// wait for new data from host
|
||||
epstatus = SET_VALID_RX(epstatus);
|
||||
epstatus = SET_STALL_TX(epstatus);
|
||||
epstatus = SET_VALID_TX(epstatus);
|
||||
} else if (ep.tx_flag){ // package transmitted
|
||||
// now we can change address after enumeration
|
||||
if ((USB->DADDR & USB_DADDR_ADD) != USB_Dev.USB_Addr){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user