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

analogWrite should check about ports with overlapping timers #55

Closed
gfwilliams opened this issue Oct 1, 2013 · 4 comments
Closed

analogWrite should check about ports with overlapping timers #55

gfwilliams opened this issue Oct 1, 2013 · 4 comments
Labels

Comments

@gfwilliams
Copy link
Member

Currently setting analogWrite on one pin can silently mess up the PWM on another if it uses the same timer, and sometimes (if it checked) it could avoid doing this.

@gfwilliams
Copy link
Member Author

Should prob be part of #142

@gfwilliams
Copy link
Member Author

See also this: http://forum.espruino.com/conversations/966

Looks like timers can overlap other peripherals - so we need to be aware of that.

@gfwilliams
Copy link
Member Author

So I think we need:

  • A list of which peripheral is currently on each pin
  • A function that checks that list to see if it's possible to enter deep sleep or not
  • A list of which peripherals can be on each pin (already have this in jspininfo.c)
  • A function that checks which pins a peripheral is used on
  • Code to shut down a given peripheral (incl. Timer Channel)

Then, every time we use a pin, we:

  • Figure out if the peripheral is used on another pin, and warn if it is
  • If it's a timer, check if we might be overwriting a previously set frequency
  • If we were using another peripheral on our pin, shut it down first
  • Finally properly initialise the peripheral on our pin

@gfwilliams
Copy link
Member Author

Closing - it seems nobody's been very bothered about this

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

No branches or pull requests

1 participant