Skip to content

Equivalent to "tone()" function #426

Answered by Vollbrecht
JasterV asked this question in Q&A
Discussion options

You must be logged in to vote

The pwm-trait in embedded-hal 0.2.x s a bit under-specified. That's why it was discarded in the current alpha versions and is under rework.

Understanding how Timer / PWM hardware peripherals work is essential if you want to work with embedded-mcu. Try to study around it but here is a short rundown.

  1. It is hardware logic that runs in parallel to your processor.
  2. Its just a counter that counts a register up / or low depending on some configurations, in its simplest form.
  3. It can trigger interupts / events with an internal comperator ( e.g if it reaches count X you set in register A it will fire)
  4. The timer itself is derived from some higher clock ( depending on processor - main oscillator etc)…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@JasterV
Comment options

Answer selected by JasterV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants