Skip to content

Commit 46a815c

Browse files
committed
Replace RingBuff implementation with mbed CircularBuffer.
1 parent 8f27513 commit 46a815c

File tree

3 files changed

+5
-182
lines changed

3 files changed

+5
-182
lines changed

targets/TARGET_Infineon/TARGET_XMC4XXX/VirtualSerial/RingBuff.h

Lines changed: 0 additions & 176 deletions
This file was deleted.

targets/TARGET_Infineon/TARGET_XMC4XXX/VirtualSerial/USBSerial.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "VirtualSerial.h"
2121

2222
/****************************************************************** Globals **/
23-
static RingBuff<int16_t, 1024> ringBuf;
23+
static CircularBuffer<int16_t, 1024> ringBuf;
2424

2525
/**************************************************************** Functions **/
2626

@@ -35,7 +35,7 @@ static void usb_vcom_task() {
3535

3636
/* Check if new message is available */
3737
while(CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface)){
38-
ringBuf.add(CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface));
38+
ringBuf.push(CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface));
3939
}
4040
}
4141
}
@@ -77,9 +77,9 @@ int USBSerial::_getc() {
7777
int16_t val = 0;
7878

7979
// wait until character is available
80-
while(ringBuf.isEmpty());
80+
while(ringBuf.empty());
8181
// get & remove character from ring buffer
82-
ringBuf.pull(&val);
82+
ringBuf.pop(val);
8383
return val;
8484
}
8585

@@ -103,7 +103,7 @@ int USBSerial::writable(void){
103103
*/
104104
int USBSerial::readable(void){
105105

106-
if(!ringBuf.isEmpty()){
106+
if(!ringBuf.empty()){
107107
return 1;
108108
}
109109
return 0;

targets/TARGET_Infineon/TARGET_XMC4XXX/VirtualSerial/USBSerial.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#ifndef USBSERIAL_H_
1818
#define USBSERIAL_H_
1919

20-
#include "RingBuff.h"
2120
#include "mbed.h"
2221
#include "rtos.h"
2322
#include "Stream.h"

0 commit comments

Comments
 (0)