-
Notifications
You must be signed in to change notification settings - Fork 198
Add custom flush function feature #108
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
base: master
Are you sure you want to change the base?
Conversation
| void nmbs_platform_conf_create(nmbs_platform_conf* platform_conf) { | ||
| memset(platform_conf, 0, sizeof(nmbs_platform_conf)); | ||
| platform_conf->crc_calc = nmbs_crc_calc; | ||
| platform_conf->flush = flush; |
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.
I did a similar thing, but I try to keep original code
It makes nmbs->platform.flush an optional
static void flush(nmbs_t* nmbs) {
if (nmbs->platform.flush) {
nmbs->platform.flush(nmbs->platform.arg);
} else {
nmbs->platform.read(nmbs->msg.buf, sizeof(nmbs->msg.buf), 0, nmbs->platform.arg);
}
}
|
@debevv Could you please check this PR? |
|
Hi, sorry for the absence. The rest seems all ok |
|
My intention was exactly same as you mentioned in embedded system. |
Like in #105, a custom flush function can help reduce the blocking time of the read API, especially when using an intermediate buffer with DMA. I’ll also update my embedded example if this pull request is accepted.
This PR also includes the following minor changes:
__suseconds_tis not available on Apple arm64, so I added an alias for it.launch.jsonconfiguration to debug the tests directly in VS Code using thecppdbgdebugger.tests/nanomodbus_test.cto pass clang-format ci stepI've already ran tests and checked all passed.