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

Set PWM frequency #25

Open
Levi-Lesches opened this issue Jul 27, 2023 · 5 comments
Open

Set PWM frequency #25

Levi-Lesches opened this issue Jul 27, 2023 · 5 comments

Comments

@Levi-Lesches
Copy link

As of v0.8.1, the GPIOPwm class has a dutyCycle setter, but I can't find anything to set the frequency. Are there plans to add such a feature?

I checked the native code:

pwmSetClock(32); // 19.2 / 32 = 600KHz - Also starts the PWM

Seems like this is hard-coded

@danrubel
Copy link
Owner

Good idea. Yes, this seems like something I can add in the fall.
Code contributions are most welcome as well.

@Viserion-stack
Copy link

is there any update on that?

@danrubel
Copy link
Owner

No, nothing yet.
I'm hoping to publish 1.0 soon with support for Dart 3.x,
but have not had time to work on the PWM feature at all.

@Viserion-stack
Copy link

rpi_gpio.dart/lib/src/native/rpi_gpio_ext.cc
Line 300 in 42cc561
pwmSetClock(32); // 19.2 / 32 = 600KHz - Also starts the PWM

Tried to change clock to other value but seems it now working. Basically i just want to set freq to ~50Hz but seems it's more complex than I thought. Any idea how I can reach this?

@lengyuekongliu
Copy link

Is there any new information?

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

No branches or pull requests

4 participants