all descriptors read - OK, interfaces work - bad (only first two works - why? need to debug)

This commit is contained in:
Edward Emelianov
2026-02-11 23:34:14 +03:00
parent 3a903d7d8c
commit e17058b2de
16 changed files with 565 additions and 259 deletions

View File

@@ -43,15 +43,20 @@ int main(void){
//uint32_t ctr = Tms;
USBPU_ON();
while(1){
/*if(Tms - ctr > 499){
ctr = Tms;
}*/
// Put here code working WITOUT USB connected
if(!usbON) continue;
int l = USB_receivestr(inbuff, MAXSTRLEN);
if(l < 0) USB_sendstr("ERROR: USB buffer overflow or string was too long\n");
else if(l){
const char *ans = parse_cmd(inbuff);
if(ans) USB_sendstr(ans);
for(int i = 0; i < 6; ++i){ // just echo for first time
int l = USB_receive(i, (uint8_t*)inbuff, MAXSTRLEN);
if(l) USB_send(i, (uint8_t*)inbuff, l);
}
// and here is code what should run when USB connected
if(Config_mode){
int l = USB_receivestr(ICFG, inbuff, MAXSTRLEN);
if(l < 0) CFGWR("ERROR: USB buffer overflow or string was too long\n");
else if(l){
const char *ans = parse_cmd(inbuff);
if(ans) CFGWR(ans);
}
}
}
}