Hi,
is there any way to generate microsecond pulses on a GPIO line using MP where the pulse width could be configurable in multiples of micro seconds?
The minimum is one pulse.
I have an idea to use the timer callback to trigger a GPIO line but I am not sure if the processing is fast enough to do that.
Any thoughts?
Pulse Generation
Re: Pulse Generation
The timer class for the pyboard doesn't currently expose the one-shot mode. I'm pretty sure that the underlying hardware does support it though.
Here's some code which initializes PWM mode (so repetitive pulses, controlled with a microsecond resolution:
https://github.com/dhylands/upy-example ... .py#L6-L13
You could then use the stm module to flip appropriate bits to make this one-shot instead of PWM, but I'm not sure exactly how to do this off the top of my head. I normally consult the datasheet.
Here's some code which initializes PWM mode (so repetitive pulses, controlled with a microsecond resolution:
https://github.com/dhylands/upy-example ... .py#L6-L13
You could then use the stm module to flip appropriate bits to make this one-shot instead of PWM, but I'm not sure exactly how to do this off the top of my head. I normally consult the datasheet.