Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

PWM.clear_channel followed by init_channel fails #55

Open
mlv opened this issue Feb 26, 2015 · 0 comments
Open

PWM.clear_channel followed by init_channel fails #55

mlv opened this issue Feb 26, 2015 · 0 comments

Comments

@mlv
Copy link

mlv commented Feb 26, 2015

I need to change the subcycle_time_us of a channel after it's been initialized, but it seems to be impossible.

First, I tried PWM.clear_channel(chan) before PWM.init_channel(chan, subcycle_time_us=new_stu), but it gave an error that the channel was already initialized. Next, I tried a more draconian cleanup() call (I don't want to touch other channels, and this would mean initializing all of them which I really don't want to do, but even that didn't work.

It looks like the problem is the virtbase pointer in the channel structure. It's used throughout pwm.c to indicate whether the channel has been initialized. init_channel checks if it's set, and assumes it's initialized if it is set. But clear_channel doesn't clear it (and neither does shutdown (called by cleanup)). As there's no way to clear virtbase, there's no way to change the subcycle_time_us of a channel.

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

No branches or pull requests

1 participant