[riot-notifications] [RIOT-OS/RIOT] periph/timer: Fix return codes of timer API (#12199)

Sebastian Meiling notifications at github.com
Wed Sep 11 14:37:59 CEST 2019

@kaspar030 as I wrote the timer API is inconsistent as it uses `0` for success for `timer_init` but `1` for all other functions. But also it *always* uses `-1` for error, hence true/false (bool logic) doesn't work either -> would always be true for `timer_set` in the current state (master). 

So to me the fix is either as proposed in this PR, or change return code for `timer_set` to `0` on error. But then it is confusing compared to `timer_init`. 

Also the (not so) funny fact is that in master most implementation already follow the logic for return codes as proposed in this PR. I guess bc the implementer didn't read the API doc and copied from `timer_init` or was used to have `0` on success from other C projects and hence assumed RIOT follows that.

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...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190911/3793a569/attachment.htm>

More information about the notifications mailing list