RIOT-OS / RIOT

RIOT - The friendly OS for IoT
https://riot-os.org
GNU Lesser General Public License v2.1
4.95k stars 1.99k forks source link

periph/timer: API inconstency #4371

Closed OlegHahm closed 5 years ago

OlegHahm commented 8 years ago

Reviewing #4089 I realized that periph/timer API seems to be inconsistent. timer_init() returns 0 on success, while all other functions return 1 on success. I think all periph functions which just return a boolean value should return the same one. Ideally this would be rather a macro like PERIPH_SUCCESS than a literal.

dkm commented 8 years ago

same kind of inconsistency exists in nrf24l01p driver : some functions return 0 (preload, unregister, ...) on success, some return 1 (set_channel, ...).

PeterKietzmann commented 8 years ago

@dkm you're right. As stated in #4389 I think the whole driver could need some rework. But it's not part of this issue :-)

haukepetersen commented 8 years ago

all driver interfaces except spi and i2c have been reworked, and including these two they all have the same return values.

@OlegHahm: is this enough to close this PR, or do you insist on some macro on top of this?

A-Paul commented 8 years ago

It may be a surprise, ;-) but I still recommend using macros. Not sure if there is need to list all the advantages... I might help finding names and applying them. Preferably after this release.

haukepetersen commented 8 years ago

I don't care (though I am not a fan of it). So lets keep this issue open.

OlegHahm commented 8 years ago
  1. I don't see the initial issue solved. timer_init() still returns 0 on success, while the other functions return 1 on success.
  2. I agree with @A-Paul here, that macros would be preferable (and would help to avoid such a confusion).
kYc0o commented 8 years ago

Still inconsistent. Let's move it for the next release.

miri64 commented 8 years ago

This somehow flew under my radar. Postponed.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.