Skip to content
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

periph/timer: API inconstency #4371

Closed
OlegHahm opened this issue Dec 1, 2015 · 9 comments
Closed

periph/timer: API inconstency #4371

OlegHahm opened this issue Dec 1, 2015 · 9 comments
Assignees
Labels
Area: drivers Area: Device drivers Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. State: stale State: The issue / PR has no activity for >185 days Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Comments

@OlegHahm
Copy link
Member

OlegHahm commented Dec 1, 2015

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.

@OlegHahm OlegHahm added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. Area: drivers Area: Device drivers labels Dec 1, 2015
@dkm
Copy link
Member

dkm commented Dec 2, 2015

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

@PeterKietzmann
Copy link
Member

@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 :-)

@OlegHahm OlegHahm modified the milestone: Release 2016.03 Dec 7, 2015
@haukepetersen
Copy link
Contributor

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
Copy link
Member

A-Paul commented Mar 31, 2016

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
Copy link
Contributor

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

@haukepetersen haukepetersen modified the milestones: Release 2016.07, Release 2016.04 Apr 1, 2016
@OlegHahm
Copy link
Member Author

OlegHahm commented Apr 1, 2016

  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
Copy link
Contributor

kYc0o commented Jul 26, 2016

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

@kYc0o kYc0o modified the milestones: Release 2016.10, Release 2016.07 Jul 26, 2016
@miri64
Copy link
Member

miri64 commented Nov 2, 2016

This somehow flew under my radar. Postponed.

@miri64 miri64 modified the milestones: Release 2017.01, Release 2016.10 Nov 2, 2016
@PeterKietzmann PeterKietzmann modified the milestones: Release 2017.01, Release 2017.04 Jan 26, 2017
@stale
Copy link

stale bot commented Aug 10, 2019

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.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Aug 10, 2019
@stale stale bot closed this as completed Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. State: stale State: The issue / PR has no activity for >185 days Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

No branches or pull requests

8 participants