Skip to content

Commit

Permalink
USBD_CDC: Allow setting the CDC string descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
jepler committed Jun 20, 2024
1 parent c67266b commit 0f45969
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/arduino/Adafruit_USBD_CDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ uint16_t Adafruit_USBD_CDC::getInterfaceDescriptor(uint8_t itfnum_deprecated,
}

// Baud and config is ignore in CDC
void Adafruit_USBD_CDC::begin(uint32_t baud) {
void Adafruit_USBD_CDC::begin(uint32_t baud, const char *descriptor) {
(void)baud;

// already called begin()
Expand All @@ -102,10 +102,14 @@ void Adafruit_USBD_CDC::begin(uint32_t baud) {
}

_instance = _instance_count++;
this->setStringDescriptor("TinyUSB Serial");
this->setStringDescriptor(descriptor);
TinyUSBDevice.addInterface(*this);
}

void Adafruit_USBD_CDC::begin(uint32_t baud) {
Adafruit_USBD_CDC::begin("TinyUSB Serial");
}

void Adafruit_USBD_CDC::begin(uint32_t baud, uint8_t config) {
(void)config;
this->begin(baud);
Expand Down
1 change: 1 addition & 0 deletions src/arduino/Adafruit_USBD_CDC.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Adafruit_USBD_CDC : public Stream, public Adafruit_USBD_Interface {
(void)pin_tx;
}
void begin(uint32_t baud);
void begin(uint32_t baud, char *descriptor);
void begin(uint32_t baud, uint8_t config);
void end(void);

Expand Down

0 comments on commit 0f45969

Please sign in to comment.