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

PWM support initial commit #557

Merged
merged 3 commits into from Dec 31, 2017
Merged

PWM support initial commit #557

merged 3 commits into from Dec 31, 2017

Conversation

ghost
Copy link

@ghost ghost commented Dec 31, 2017

Description

This PR adds support for PWM output on Quail, Netduino3, STM32F429i-Disco and STM32F411 boards.

It is still missing :

  • sanity checks
  • support for the other reference boards
  • support of Polarity.Low

How Has This Been Tested?

Tested on Quail and F429i-Disco. Netduino3 has same MCU as Quail so it should work as well.
Not tested on IngenuityMicro Electron board (F411)

Screenshots

nice try
20 KHz PWM output on Quail, yellow trace on socket #2 polarity high 20% duty-cycle, blue trace on socket #3 polarity low 80% duty-cycle.

PwmController PWM = PwmController.FromId("TIM4");
PWM.SetDesiredFrequency(20000);

pwm2 = PWM.OpenPin(3*16+15);        // Quail PD15-PWM2
pwm2.SetActiveDutyCyclePercentage(0.2);
pwm2.Start();

pwm3 = PWM.OpenPin(3 * 16 + 13);    // Quail PD13/PWM3
pwm3.SetActiveDutyCyclePercentage(0.8);
pwm3.Start();

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Christophe Gerbier added 3 commits December 31, 2017 14:01
Initial commit

Signed-off-by: Christophe Gerbier <[email protected]>
Mising files
Forgot to remove the PWM_OUTPUT_ACTIVE_LOW test...
@nfbot
Copy link
Member

nfbot commented Dec 31, 2017

Hi @MikroBusNet,

I'm nanoFramework bot.
Thank you for your contribution!

A human will be reviewing it shortly. 😉

@piwi1263 piwi1263 merged commit 6fd503a into nanoframework:develop Dec 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants