Skip to content

Set a baud rate limit for cdc-acm internally #577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cores/arduino/CDCSerialClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,13 @@ void CDCSerialClass::begin(const uint32_t dwBaudRate, const uint8_t config)
}


void CDCSerialClass::init(const uint32_t dwBaudRate, const uint8_t modeReg)
void CDCSerialClass::init(uint32_t dwBaudRate, const uint8_t modeReg)
{
/* Set a max internal baud rate due to the limitation of the
* Inter Processor Mailbox */
if(dwBaudRate > 115200)
dwBaudRate = 115200;

/* Set a per-byte write delay approximately equal to the time it would
* take to clock out a byte on a standard UART at this baud rate */
_writeDelayUsec = 8000000 / dwBaudRate;
Expand Down
2 changes: 1 addition & 1 deletion cores/arduino/CDCSerialClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class CDCSerialClass : public HardwareSerial
};

protected:
void init(const uint32_t dwBaudRate, const uint8_t config);
void init(uint32_t dwBaudRate, const uint8_t config);

uart_init_info *info;
uint32_t _writeDelayUsec;
Expand Down