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

misleading comment wrt GCLK use. #17

Open
WestfW opened this issue Sep 19, 2020 · 2 comments
Open

misleading comment wrt GCLK use. #17

WestfW opened this issue Sep 19, 2020 · 2 comments

Comments

@WestfW
Copy link
Contributor

WestfW commented Sep 19, 2020

This is cosmetic...
The code that sets the GCLK for the timer has a comment that is incorrect (copied from analogWrite() code?)
It says "use clock generator 0" when it's quite clearly setting GCLK1...

#if defined(__SAMD51__)
  GCLK->PCHCTRL[inst_gclk_id[instance]].reg =
      GCLK_PCHCTRL_GEN_GCLK1_Val |
      (1 << GCLK_PCHCTRL_CHEN_Pos); // use clock generator 0
#else

https://github.com/adafruit/Adafruit_ZeroTimer/blob/master/Adafruit_ZeroTimer.cpp#L140

On SAMD51, GCLK0 is 120MHz, and GCLK1 is 48MHz, so using CLK1 makes the SAMD51 and SAMD21 "compatible."

@ladyada
Copy link
Member

ladyada commented Sep 20, 2020

kk - pleaes submit a PR, since its a comment we will be able to merge it easily!

@WestfW
Copy link
Contributor Author

WestfW commented Sep 21, 2020

OK; done.
I'm slightly worried by the fact that it doesn't say anywhere in the TimerZero code that it's running the timers at 48MHz, although uses seem to assume that (ie https://github.com/adafruit/Adafruit_LvGL_Glue/blob/master/Adafruit_LvGL_Glue.cpp#L370 )

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

No branches or pull requests

2 participants