conn icon indicating copy to clipboard operation
conn copied to clipboard

gpio: refactor PWM to be context based

Open maruel opened this issue 4 years ago • 1 comments

Users forget to stop the PWM at the end of the program, causing user reports like #286 and #363.

We must design an API that makes it clear that the PWM blocking operation must be canceled before the termination of the program.

Discussion about this change is done in https://docs.google.com/document/d/1vQdZdoOMaIan7dKwcAzqHbfM_LCnnSMUQvqypRkjohM.

(ported from https://github.com/google/periph/issues/384)

maruel avatar May 16 '21 19:05 maruel

I have an idea about this, we can have a start function that is blocking and starting PWM so people need to close this function before the program's end and we can there defer the cancelation.

I can create a PR for this. also because we don't have any context in the periph package so using context for this specific function may be not a good idea.

1995parham avatar Oct 25 '21 20:10 1995parham