Update CDC Class Driver character stream functions to use the correct avr-libc return codes for errors and EOF.
Fix pointer arithmetic on void byte buffers by explicitly typecasting the buffer pointers to uint8_t* before altering them.
This commit is contained in:
parent
c1782ac024
commit
5de364163f
11 changed files with 43 additions and 44 deletions
|
@ -342,14 +342,13 @@ void CDC_Host_CreateStream(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, FILE* Str
|
|||
|
||||
static int CDC_Host_putchar(char c, FILE* Stream)
|
||||
{
|
||||
CDC_Host_SendByte((USB_ClassInfo_CDC_Host_t*)fdev_get_udata(Stream), c);
|
||||
return 0;
|
||||
return CDC_Host_SendByte((USB_ClassInfo_CDC_Host_t*)fdev_get_udata(Stream), c) ? _FDEV_ERR : 0;
|
||||
}
|
||||
|
||||
static int CDC_Host_getchar(FILE* Stream)
|
||||
{
|
||||
if (!(CDC_Host_BytesReceived((USB_ClassInfo_CDC_Host_t*)fdev_get_udata(Stream))))
|
||||
return -1;
|
||||
return _FDEV_EOF;
|
||||
|
||||
return CDC_Host_ReceiveByte((USB_ClassInfo_CDC_Host_t*)fdev_get_udata(Stream));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue