Skip to content

Commit 8fa992e

Browse files
committed
rename USBSerial to Adafruit_USBDev_CDC
1 parent 212fa6c commit 8fa992e

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

cores/nRF5/Arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void suspendLoop(void);
7171
#include "tusb.h"
7272
#ifdef __cplusplus
7373
#include "Adafruit_USBDevice.h"
74-
#include "USBSerial.h"
74+
#include "Adafruit_USBDev_CDC.h"
7575
#endif
7676
#endif
7777

cores/nRF5/usb/USBSerial.cpp renamed to cores/nRF5/usb/Adafruit_USBDev_CDC.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/*
23
* The MIT License (MIT)
34
*
@@ -23,21 +24,21 @@
2324
*/
2425
#ifdef NRF52840_XXAA
2526

26-
#include "USBSerial.h"
27+
#include "Adafruit_USBDev_CDC.h"
2728
#include "Arduino.h"
2829
#include "tusb.h"
2930

3031
#define EPOUT 0x00
3132
#define EPIN 0x80
3233

33-
USBSerial Serial;
34+
Adafruit_USBDev_CDC Serial;
3435

35-
USBSerial::USBSerial(void)
36+
Adafruit_USBDev_CDC::Adafruit_USBDev_CDC(void)
3637
{
3738

3839
}
3940

40-
uint16_t USBSerial::getDescriptor(uint8_t* buf, uint16_t bufsize)
41+
uint16_t Adafruit_USBDev_CDC::getDescriptor(uint8_t* buf, uint16_t bufsize)
4142
{
4243
// CDC is mostly always existed for DFU
4344
uint8_t desc[] = { TUD_CDC_DESCRIPTOR(0, 0, EPIN, 8, EPOUT, EPIN, 64) };
@@ -50,54 +51,54 @@ uint16_t USBSerial::getDescriptor(uint8_t* buf, uint16_t bufsize)
5051
}
5152

5253
// Baud and config is ignore in CDC
53-
void USBSerial::begin (uint32_t baud)
54+
void Adafruit_USBDev_CDC::begin (uint32_t baud)
5455
{
5556
}
56-
void USBSerial::begin (uint32_t baud, uint8_t config)
57+
void Adafruit_USBDev_CDC::begin (uint32_t baud, uint8_t config)
5758
{
5859
}
5960

60-
void USBSerial::end(void)
61+
void Adafruit_USBDev_CDC::end(void)
6162
{
6263
// nothing to do
6364
}
6465

65-
USBSerial::operator bool()
66+
Adafruit_USBDev_CDC::operator bool()
6667
{
6768
return tud_cdc_connected();
6869
}
6970

70-
int USBSerial::available(void)
71+
int Adafruit_USBDev_CDC::available(void)
7172
{
7273
return tud_cdc_available();
7374
}
7475

75-
int USBSerial::peek(void)
76+
int Adafruit_USBDev_CDC::peek(void)
7677
{
7778
return tud_cdc_peek(0);
7879
}
7980

80-
int USBSerial::read(void)
81+
int Adafruit_USBDev_CDC::read(void)
8182
{
8283
return (int) tud_cdc_read_char();
8384
}
8485

85-
size_t USBSerial::readBytes(char *buffer, size_t length)
86+
size_t Adafruit_USBDev_CDC::readBytes(char *buffer, size_t length)
8687
{
8788
return tud_cdc_read(buffer, length);
8889
}
8990

90-
void USBSerial::flush(void)
91+
void Adafruit_USBDev_CDC::flush(void)
9192
{
9293
tud_cdc_write_flush();
9394
}
9495

95-
size_t USBSerial::write(uint8_t ch)
96+
size_t Adafruit_USBDev_CDC::write(uint8_t ch)
9697
{
9798
return tud_cdc_write_char((char) ch);
9899
}
99100

100-
size_t USBSerial::write(const uint8_t *buffer, size_t size)
101+
size_t Adafruit_USBDev_CDC::write(const uint8_t *buffer, size_t size)
101102
{
102103
size_t remain = size;
103104
while ( remain && tud_cdc_connected() )

cores/nRF5/usb/USBSerial.h renamed to cores/nRF5/usb/Adafruit_USBDev_CDC.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@
2222
* THE SOFTWARE.
2323
*/
2424

25-
#ifndef USBSERIAL_H_
26-
#define USBSERIAL_H_
25+
#ifndef ADAFRUIT_USBDEV_CDC_H_
26+
#define ADAFRUIT_USBDEV_CDC_H_
2727

2828
#ifdef NRF52840_XXAA
2929

3030
#include "Adafruit_USBDevice.h"
3131
#include "Stream.h"
3232

33-
class USBSerial : public Stream, Adafruit_USBInterface
33+
class Adafruit_USBDev_CDC : public Stream, Adafruit_USBInterface
3434
{
3535
public:
36-
USBSerial(void);
36+
Adafruit_USBDev_CDC(void);
3737

3838
// fron Adafruit_USBInterface
3939
virtual uint16_t getDescriptor(uint8_t* buf, uint16_t bufsize);
@@ -59,8 +59,8 @@ class USBSerial : public Stream, Adafruit_USBInterface
5959
};
6060

6161

62-
extern USBSerial Serial;
62+
extern Adafruit_USBDev_CDC Serial;
6363

6464
#endif
6565

66-
#endif /* USBSERIAL_H_ */
66+
#endif /* ADAFRUIT_USBDEV_CDC_H_ */

0 commit comments

Comments
 (0)