[riot-notifications] [RIOT-OS/RIOT] At driver uart initialize status (#10826)

ranbe1 notifications at github.com
Sat Jan 19 22:23:08 CET 2019


<!--
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.
-->

### Contribution description

at the file drivers/at.c there's the uart_init function which returns 0 no matter what, in case the function failed the user/tester won't know that it failed or why.
i changed the function uart_init to return the result of the uart_init which could be:
UART_OK
UART_NODEV
UART_NOBAUD

then in tests/driver_at/main in the init function, i checked if the result code is equal to one of the last two, if yes, i printed it and returned 1.


### Testing procedure

<!--
Details steps to test your contribution:
-you can compile driver_at test, for any of the at devices
-it was working, just not correctly, in my opinion.
- the expected success test output
in case of wrong uart:
"Invalid UART device given!"
or in case of wrong baudrate:
"Baudrate is not applicable!"
-->


### Issues/PRs references

<!--
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
-->

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/10826

-- Commit Summary --

  * Refactored uart_init  function in drivers/at to return the result of the uart initialization
  * Refactored init function at tests/driver_at/main to check the return value of the uart initialization and in case of an error print the cause to the error

-- File Changes --

    M drivers/at/at.c (4)
    M tests/driver_at/main.c (12)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/10826.patch
https://github.com/RIOT-OS/RIOT/pull/10826.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10826
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190119/02ba7706/attachment.html>


More information about the notifications mailing list