[riot-notifications] [RIOT-OS/RIOT] periph/timer: Fix return codes of timer API (#12199)
notifications at github.com
Wed Sep 11 14:04:27 CEST 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
This PR changes the documentation of the periph/timer API to reflect most implementations, i.e., changing the return codes for `timer_set`, `timer_set_absolute`, and `timer_clear` to always use `0` on success instead of `1`. Rational is as follows:
- most (if not all) C API commonly use `0` for success
- its confusing that `timer_init` returns `0` on success and `-1` on error, but other functions (see above) return `1` for success while still returning `-1` on error. So no bool logic could be used either.
- most of our implementation already do this (bc. the original contributed assumed said default, or/and just didn't read the documentation)
- the impact of this change is minimal (or even none) for code in RIOT main tree, as return codes are hardly (or never) used - at least for the functions changed here.
### Testing procedure
run `tests/periph_timer` or any other timer test on your favourite board and verify it still works.
I will add a link to our HIL test results in the comments below, after this PR is open.
### Issues/PRs references
You can view, comment on, or merge this pull request online at:
-- Commit Summary --
* periph/timer: always return 0 for success
* cpu/atmega_common: adapt timer to return 0 on success
* cpu/cc2538: adapt timer to return 0 on success
* cpu/cc26x0: adapt timer to return 0 on success
* cpu/kinetis: adapt timer to return 0 on success
* cpu/lm4f120: adapt timer to return 0 on success
* cpu/lpc1768: adapt timer to return 0 on success
* cpu/mips32r2: adapt timer to return 0 on success
* cpu/native: adapt timer to return 0 on success
* cpu/nrf5x: adapt timer to return 0 on success
* cpu/sam0: adapt timer to return 0 on success
* cpu/sam3: adapt timer to return 0 on success
-- File Changes --
M cpu/atmega_common/periph/timer.c (2)
M cpu/cc2538/periph/timer.c (4)
M cpu/cc26x0/periph/timer.c (2)
M cpu/kinetis/periph/timer.c (10)
M cpu/lm4f120/periph/timer.c (4)
M cpu/lpc1768/periph/timer.c (4)
M cpu/mips32r2_common/periph/timer.c (6)
M cpu/native/periph/timer.c (4)
M cpu/nrf5x_common/periph/timer.c (4)
M cpu/sam0_common/periph/timer.c (4)
M cpu/sam3/periph/timer.c (2)
M drivers/include/periph/timer.h (6)
-- Patch Links --
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications