diff --git a/inc/DynamicPwm.h b/inc/DynamicPwm.h index dbd66ea..f17d7d4 100644 --- a/inc/DynamicPwm.h +++ b/inc/DynamicPwm.h @@ -4,7 +4,6 @@ #define MICROBIT_DYNAMIC_PWM_H #define NO_PWMS 3 -#define MICROBIT_DISPLAY_PWM_PERIOD 1000 enum PwmPersistence { @@ -31,9 +30,8 @@ class DynamicPwm : public PwmOut * @param pin the name of the pin for the pwm to target * @param persistance the level of persistence for this pin PWM_PERSISTENCE_PERSISTENT (can not be replaced until freed, should only be used for system services really.) * or PWM_PERSISTENCE_TRANSIENT (can be replaced at any point if a channel is required.) - * @param period the frequency of the pwm channel in us. */ - DynamicPwm(PinName pin, PwmPersistence persistence = PWM_PERSISTENCE_TRANSIENT, int period = MICROBIT_DISPLAY_PWM_PERIOD); + DynamicPwm(PinName pin, PwmPersistence persistence = PWM_PERSISTENCE_TRANSIENT); public: @@ -62,7 +60,7 @@ class DynamicPwm : public PwmOut * DynamicPwm* pwm = DynamicPwm::allocate(PinName n); * @endcode */ - static DynamicPwm* allocate(PinName pin, PwmPersistence persistence = PWM_PERSISTENCE_TRANSIENT, int period = MICROBIT_DISPLAY_PWM_PERIOD); + static DynamicPwm* allocate(PinName pin, PwmPersistence persistence = PWM_PERSISTENCE_TRANSIENT); /** * Frees this DynamicPwm instance if the pointer is valid. diff --git a/source/DynamicPwm.cpp b/source/DynamicPwm.cpp index 8f82258..d61c6f4 100644 --- a/source/DynamicPwm.cpp +++ b/source/DynamicPwm.cpp @@ -48,10 +48,9 @@ void gpiote_reinit(PinName pin, PinName oldPin, uint8_t channel_number) * or PWM_PERSISTENCE_TRANSIENT (can be replaced at any point if a channel is required.) * @param period the frequency of the pwm channel in us. */ -DynamicPwm::DynamicPwm(PinName pin, PwmPersistence persistence, int period) : PwmOut(pin) +DynamicPwm::DynamicPwm(PinName pin, PwmPersistence persistence) : PwmOut(pin) { this->flags = persistence; - this->setPeriodUs(period); } /** @@ -75,14 +74,13 @@ void DynamicPwm::redirect(PinName pin) * @param pin the name of the pin for the pwm to target * @param persistance the level of persistence for this pin PWM_PERSISTENCE_PERSISTENT (can not be replaced until freed, should only be used for system services really.) * or PWM_PERSISTENCE_TRANSIENT (can be replaced at any point if a channel is required.) - * @param period the frequency of the pwm channel in us. * * Example: * @code * DynamicPwm* pwm = DynamicPwm::allocate(PinName n); * @endcode */ -DynamicPwm* DynamicPwm::allocate(PinName pin, PwmPersistence persistence, int period) +DynamicPwm* DynamicPwm::allocate(PinName pin, PwmPersistence persistence) { //try to find a blank spot first for(int i = 0; i < NO_PWMS; i++) @@ -90,7 +88,7 @@ DynamicPwm* DynamicPwm::allocate(PinName pin, PwmPersistence persistence, int pe if(pwms[i] == NULL) { lastUsed = i; - pwms[i] = new DynamicPwm(pin, persistence, period); + pwms[i] = new DynamicPwm(pin, persistence); return pwms[i]; } }