Skip to content

Check function for serial error. #70

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jpellikk-arm
Copy link

@0xc0170 The API change corresponding to the PR below:
ARMmbed/mbed-hal-ksdk-mcu#57

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 23, 2016

How are you using this function? The async shall return an error during the transmission. However, the one byte transfer using attach() in mbed-drivers, does not accept any arguments. I assume this is the function you use to get serial errors.

It might be better to have defined error values, as oppose to boolean.

@jpellikk-arm
Copy link
Author

Yes, the use case I created the function for is detecting corrupted packets over SLIP; I assume corrupted packets on RX overrun, parity and framing error.

The 1st thing in in my interrupt routine (attach()'d) I check (using this function) if error occurred, and if so I discard all the data and start waiting for sync byte on the SLIP protocol I run over the serial line.

@jpellikk-arm
Copy link
Author

Perhaps it would make sens to return a bit field as a return value rather than boolean, and create defines the bits.

@jpellikk-arm
Copy link
Author

Updated according to the comments.

@jpellikk-arm
Copy link
Author

@0xc0170 Any comments to the change?
The implementation can be found in PR:
ARMmbed/mbed-hal-ksdk-mcu#57

* (in the mentioned order starting from the least significant bit).
*
* @param obj The serial object
* @return Non-zero value if any of the errors have occurred, 0 otherwise
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return values shall be described as @RetVal - each of the possible return values. You can rebase the current branch here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the documentation. Added a few @RetVal tags as an example; didn't want to enumerate the whole list of values. A developer should get the idea...

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 10, 2016

@jpellikk-arm Probably the last request - please add to the documentation that it should clear the flag once it reads it. I noticed it's missing here, and it's done in its ksdk implementation. Sorry for the delay for this merge, but we are close to the release.

To merge this, we should implement this for nrf51 as well, however this would break any other targets. We need to address this, will get back to you.

@jpellikk-arm
Copy link
Author

@0xc0170 Could you please merge this in? I don't have the rights to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants