usbcan_gpio: both USB interfaces works; start adding GPIO functions

This commit is contained in:
Edward Emelianov
2026-03-07 14:37:42 +03:00
parent 760bec420b
commit fb8b93b0fe
9 changed files with 55 additions and 23 deletions

View File

@@ -104,7 +104,9 @@ static const char *cmd_parser(char *buf){
case 'i':
return setiface(buf);
default:
return buf-1; // echo wrong data
// echo wrong data with terminating '\n'
SENDn(buf-1);
return NULL;
}
}
// "short" commands
@@ -138,8 +140,9 @@ static const char *cmd_parser(char *buf){
void GPIO_process(){
char inbuff[MAXSTRLEN];
int l = RECV(inbuff, MAXSTRLEN);
if(l == 0) return;
if(l < 0) SEND("ERROR: USB buffer overflow or string was too long\n");
else if(l){
else{
const char *ans = cmd_parser(inbuff);
if(ans) SEND(ans);
}