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

Implement variable PWM frequency #756

Merged
merged 1 commit into from
Jan 14, 2016

Commits on Jan 12, 2016

  1. Implement variable PWM frequency

    * Supports 1 Hz to 65535 Hz
    * User facing API: analogWrite(pin, value, pwm_frequency)
    * Calculate an approriate prescaler for the range of frequencies
    * Allow updating frequency on the fly
    * Add tests for PWM with frequency
    
    Other changes
    
    * Remove extern "C" from analogWrite to allow overloaded versions
    * Share pwm_hal for Core, Photon and Electron
    
    Bugfixes
    
    * Fix duty cycle initialization making a second Duty Cycle initialization unecessary
    
    I tested this change on a Photon, Core and Electron for all the PWM capable pins. I verified a range of frequencies and duty cycles from 1 Hz up to 60 kHz with a multimeter. It was always spot on.
    monkbroc committed Jan 12, 2016
    Configuration menu
    Copy the full SHA
    00b02c8 View commit details
    Browse the repository at this point in the history