Skip to content

Unify counter.h and rtc.h interfaces #8331

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

Closed
7 tasks done
nordic-krch opened this issue Jun 12, 2018 · 2 comments
Closed
7 tasks done

Unify counter.h and rtc.h interfaces #8331

nordic-krch opened this issue Jun 12, 2018 · 2 comments
Labels
area: API Changes to public APIs area: Counter area: Drivers Enhancement Changes/Updates/Additions to existing features
Milestone

Comments

@nordic-krch
Copy link
Collaborator

nordic-krch commented Jun 12, 2018

Counter.h and rtc.h share almost the same functionality with only minor
differences:

  • rtc.h has option for initial value and initial alarm (set by rtc_set_config)
  • counter.h has pointer to the user context in the alarm callback

Both interfaces have drawbacks:

  • no information about the frequency so alarm is set in ticks which are virtual
  • no helper function to convert microseconds or milliseconds to ticks
  • in both APIs it is unclear if alarm is one shot or periodic
  • interfaces are limiting functionality of peripherals (TIMER, RTC) which usually
    have couple of capture/compare channels. Current interfaces allow usage of single channel
  • lack of information about overflow (unless alarm is periodic and is actual overflow)
  • lack of possibility to set alarm for absolute value

Counter.h and RTC.h should be unified. Implementation of unified interface can be based on low power RTC-like peripheral or more accurate high frequency general purpose timers.

Topic already mentioned in #5895

Pull Requests, targeting the topic-counters topic branch:

@nordic-krch to coordinate with @anangl once all PRs are posted.

@carlescufi
Copy link
Member

Related issues: #6498 and #7520

@carlescufi
Copy link
Member

Merged into master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: Counter area: Drivers Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

4 participants