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

[stm32] start implementing timer_get_frequency #286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

flixr
Copy link
Member

@flixr flixr commented Mar 6, 2014

Get the timer clock frequency in order to more conveniently calculate the prescaler.

  • untested and only valid for F1 and STM32F405xx/07xx and STM32F415xx/17xx
  • does not handle/check TIMPRE in RCC_CFGR found in F42xxx and F43xxx

Ran out of time, so in case this sounds useful and someone wants to test it and/or extend it for more chips, here we go....

untested and only valid for F1 and STM32F405xx/07xx and STM32F415xx/17xx

does not handle/check TIMPRE in RCC_CFGR found in F42xxx and F43xxx
{
return RCC_CFGR & RCC_CFGR_PPRE1;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any real motivation to have this as api funtions visible to users, it's something you would just use internally. If a user needs this information, they (should) have it from when they set up the clock themselves in the first place

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the only reason was to get this independent of the STM family, so the rest of the get_timer_frequency doesn't have to be implemented for each family...

@BuFran
Copy link
Member

BuFran commented Jul 14, 2014

I like this new api, but it needs more look to the other peripherals, such as usarts, spis and need to design more globally stable api.

Well, I agree with karlp in that the reading of PPRE1/PPRE2 should be internal to the clock computation routine, or it should be shifted to give more generic numbers 0...N

@flixr
Copy link
Member Author

flixr commented Aug 4, 2014

So you would rather have the full timer_get_frequency function implemented for each family?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants