mirror of
https://github.com/eddyem/stm32samples.git
synced 2026-02-28 11:54:30 +03:00
some fixes, now speed is big enough
This commit is contained in:
@@ -38,6 +38,7 @@ int main(void){
|
||||
SysTick_Config(72000);
|
||||
#ifdef EBUG
|
||||
usart_setup();
|
||||
DBG("Start");
|
||||
uint32_t tt = 0;
|
||||
#endif
|
||||
USB_setup();
|
||||
|
||||
Binary file not shown.
@@ -198,8 +198,14 @@ void get_descriptor(config_pack_t *pack){
|
||||
break;
|
||||
case STRING_DESCRIPTOR:
|
||||
DBG("STRING_DESCRIPTOR");
|
||||
if(descridx < iDESCR_AMOUNT) wr0((const uint8_t *)StringDescriptor[descridx], *((uint8_t*)StringDescriptor[descridx]), pack->wLength);
|
||||
else EP_WriteIRQ(0, NULL, 0);
|
||||
if(descridx < iDESCR_AMOUNT){
|
||||
wr0((const uint8_t *)StringDescriptor[descridx], *((uint8_t*)StringDescriptor[descridx]), pack->wLength);
|
||||
DBGs(StringDescriptor[descridx]);
|
||||
}else{
|
||||
EP_WriteIRQ(0, NULL, 0);
|
||||
DBG("Wrong index");
|
||||
DBGs(uhex2str(descridx));
|
||||
}
|
||||
break;
|
||||
case DEVICE_QUALIFIER_DESCRIPTOR:
|
||||
DBG("DEVICE_QUALIFIER_DESCRIPTOR");
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "usb_lib.h"
|
||||
|
||||
// definition of parts common for USB_DeviceDescriptor & USB_DeviceQualifierDescriptor
|
||||
// bcdUSB: 2.00
|
||||
#define bcdUSB 0x0200
|
||||
// bcdUSB: 1.10
|
||||
#define bcdUSB 0x0110
|
||||
// Class - Misc (EF), subclass - common (2), protocol - interface association descr (1)
|
||||
#define bDeviceSubClass 0x02
|
||||
#define bDeviceProtocol 0x01
|
||||
|
||||
@@ -101,6 +101,7 @@ static void rxtx_handler(){
|
||||
}
|
||||
rcvbuflen = EP_Read(1, (uint8_t*)rcvbuf);
|
||||
USB->EPnR[1] = epstatus & ~(USB_EPnR_CTR_RX | USB_EPnR_STAT_RX | USB_EPnR_STAT_TX); // keep RX in STALL state until read data
|
||||
chkin(); // try to write current data into RXbuf if it's not busy
|
||||
}else{ // tx successfull
|
||||
DBG("Tx OK");
|
||||
USB->EPnR[1] = (epstatus & ~(USB_EPnR_CTR_TX | USB_EPnR_STAT_TX)) ^ USB_EPnR_STAT_RX;
|
||||
@@ -124,6 +125,7 @@ void WEAK clstate_handler(uint16_t val){
|
||||
|
||||
// SEND_BREAK
|
||||
void WEAK break_handler(){
|
||||
CDCready = 0;
|
||||
DBG("break_handler()");
|
||||
}
|
||||
|
||||
@@ -159,7 +161,6 @@ void usb_class_request(config_pack_t *req, uint8_t *data, uint16_t datalen){
|
||||
break;
|
||||
case SEND_BREAK:
|
||||
DBG("SEND_BREAK");
|
||||
CDCready = 0;
|
||||
break_handler();
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
#include "usb_descr.h"
|
||||
#include "usb_dev.h"
|
||||
|
||||
/*
|
||||
|
||||
#undef DBG
|
||||
#define DBG(x)
|
||||
#undef DBGs
|
||||
#define DBGs(x)
|
||||
*/
|
||||
|
||||
|
||||
static ep_t endpoints[STM32ENDPOINTS];
|
||||
|
||||
@@ -54,6 +54,7 @@ static inline void std_d2h_req(){
|
||||
default:
|
||||
DBG("Wrong");
|
||||
DBGs(uhex2str(setup_packet->bRequest));
|
||||
EP_WriteIRQ(0, NULL, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -90,19 +91,17 @@ void WEAK usb_standard_request(){
|
||||
std_d2h_req();
|
||||
}else{
|
||||
std_h2d_req();
|
||||
//EP_WriteIRQ(0, NULL, 0);
|
||||
}
|
||||
break;
|
||||
case REQ_RECIPIENT_INTERFACE:
|
||||
DBG("REQ_RECIPIENT_INTERFACE");
|
||||
if(dev2host && setup_packet->bRequest == GET_DESCRIPTOR){
|
||||
get_descriptor(setup_packet);
|
||||
}//else EP_WriteIRQ(0, NULL, 0);
|
||||
}
|
||||
break;
|
||||
case REQ_RECIPIENT_ENDPOINT:
|
||||
DBG("REQ_RECIPIENT_ENDPOINT");
|
||||
if(setup_packet->bRequest == CLEAR_FEATURE){
|
||||
//EP_WriteIRQ(0, NULL, 0);
|
||||
}else{
|
||||
DBG("Wrong");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user