Skip to content
This repository has been archived by the owner on Feb 2, 2020. It is now read-only.

Commit

Permalink
Fixed #262. Always force to update if any call from managed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Palomino34 committed Aug 9, 2018
1 parent 5ab2c94 commit 58d5c64
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
8 changes: 1 addition & 7 deletions Targets/STM32F4xx/STM32F4_PWM.cpp
Expand Up @@ -414,8 +414,7 @@ TinyCLR_Result STM32F4_Pwm_SetPulseParameters(const TinyCLR_Pwm_Controller* self
treg->CCER &= ~invBit;
}

if (duration != (uint32_t)(state->dutyCycle[channel] * state->period))
treg->EGR = TIM_EGR_UG; // enforce register update - update immidiately any changes
treg->EGR = TIM_EGR_UG; // enforce register update - update immidiately any changes

state->invert[channel] = polarity;
state->dutyCycle[channel] = dutyCycle;
Expand All @@ -427,11 +426,6 @@ TinyCLR_Result STM32F4_Pwm_SetPulseParameters(const TinyCLR_Pwm_Controller* self
TinyCLR_Result STM32F4_Pwm_SetDesiredFrequency(const TinyCLR_Pwm_Controller* self, double& frequency) {
auto state = reinterpret_cast<PwmState*>(self->ApiInfo->State);

// If current frequency is same with desired frequency, no need to re-calculate
if (state->theoryFreq == frequency) {
return TinyCLR_Result::Success;
}

// If detected a different, save desired frequency
state->theoryFreq = frequency;

Expand Down
8 changes: 1 addition & 7 deletions Targets/STM32F7xx/STM32F7_PWM.cpp
Expand Up @@ -414,8 +414,7 @@ TinyCLR_Result STM32F7_Pwm_SetPulseParameters(const TinyCLR_Pwm_Controller* self
treg->CCER &= ~invBit;
}

if (duration != (uint32_t)(state->dutyCycle[channel] * state->period))
treg->EGR = TIM_EGR_UG; // enforce register update - update immidiately any changes
treg->EGR = TIM_EGR_UG; // enforce register update - update immidiately any changes

state->invert[channel] = polarity;
state->dutyCycle[channel] = dutyCycle;
Expand All @@ -427,11 +426,6 @@ TinyCLR_Result STM32F7_Pwm_SetPulseParameters(const TinyCLR_Pwm_Controller* self
TinyCLR_Result STM32F7_Pwm_SetDesiredFrequency(const TinyCLR_Pwm_Controller* self, double& frequency) {
auto state = reinterpret_cast<PwmState*>(self->ApiInfo->State);

// If current frequency is same with desired frequency, no need to re-calculate
if (state->theoryFreq == frequency) {
return TinyCLR_Result::Success;
}

// If detected a different, save desired frequency
state->theoryFreq = frequency;

Expand Down

0 comments on commit 58d5c64

Please sign in to comment.