-
Notifications
You must be signed in to change notification settings - Fork 33
zephyrCommon: Add Print::write(const uint8_t*, size_t) default implementation #57
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
zephyrCommon: Add Print::write(const uint8_t*, size_t) default implementation #57
Conversation
ba6ac8e
to
0c2f284
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion this should go into cores/arduino/zephyrSerial.cpp
.
At the moment we are not really very well integrating the Arduino Core API in serial aspect, so perhaps you may want to drop the arduino::Print
and use arduino::ZephyrSerial::
and also add the write
in respective header file where we write the func prototypes.
When compile with enabling CONFIG_DEBUG option, the Print::write virtual function failed to link. This implementation is usually not used. Because the override implementation that implements by the subclass will be used. Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
0c2f284
to
4a4601e
Compare
The Print class is also used by (TCP) Client class, UDP class, and also user-defined classes via the Stream class. I rewrited it to splitting into the new file named 'zephyrPrint.cpp'. |
} | ||
|
||
return i; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, so this seems to be taken from here
size_t Print::write(const uint8_t *buffer, size_t size)
{
size_t n = 0;
while (size--) {
if (write(*buffer++)) n++;
else break;
}
return n;
}
but with for loop instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One confirmation.
Is it okayto copy from GPL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, I think this way that you have done is also okay.
Seems like this file can in future have a similar structure to original Print.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a good starting point to me.
Built locally, LGTM.
Been too long since approved, I do not see any nacks, hence merging. |
When compile with enabling CONFIG_DEBUG option,
the Print::write virtual function failed to link.
This implementation is usually not used.
Because the override implementation that implements by the subclass will be used.
Signed-off-by: TOKITA Hiroshi tokita.hiroshi@fujitsu.com