add SPI (not tested yet)

This commit is contained in:
Edward Emelianov
2026-02-20 23:38:29 +03:00
parent 6c21d9f91a
commit 061fd8bec8
13 changed files with 167 additions and 8 deletions

View File

@@ -303,6 +303,10 @@ int USB_sendstr(uint8_t ifno, const char *string){
return USB_send(ifno, (const uint8_t*)string, len);
}
int USB_rcvlen(uint8_t ifno){
return RB_datalen((ringbuffer*)&rbin[ifno]);
}
/**
* @brief USB_receive - get binary data from receiving ring-buffer
* @param buf (i) - buffer for received data
@@ -336,7 +340,7 @@ int USB_receivestr(uint8_t ifno, char *buf, int len){
}
int l = RB_readto((ringbuffer*)&rbin[ifno], '\n', (uint8_t*)buf, len);
if(l < 1){
if(rbin[ifno].length == RB_datalen((ringbuffer*)&rbin[ifno])){ // buffer is full but no '\n' found
if(rbin[ifno].length >= RB_datalen((ringbuffer*)&rbin[ifno]) - 1){ // buffer is full but no '\n' found
while(1 != RB_clearbuf((ringbuffer*)&rbin[ifno]));
return -1;
}