diff options
Diffstat (limited to 'demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c')
-rw-r--r-- | demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c b/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c index c413e7986..78cb48340 100644 --- a/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c +++ b/demos/ARMCM3-STM32F100-DISCOVERY-GCC/main.c @@ -101,6 +101,7 @@ static void pwmpcb(PWMDriver *pwmp) { operation.*/
avg_ch1 = (samples[0] + samples[2] + samples[4] + samples[6]) / 4;
avg_ch2 = (samples[1] + samples[3] + samples[5] + samples[7]) / 4;
+
chSysLockFromIsr();
/* Changes the channels pulse width, the change will be effective
@@ -108,6 +109,7 @@ static void pwmpcb(PWMDriver *pwmp) { pwmEnableChannelI(pwmp, 2, PWM_FRACTION_TO_WIDTH(pwmp, 4096, avg_ch1));
pwmEnableChannelI(pwmp, 3, PWM_FRACTION_TO_WIDTH(pwmp, 4096, avg_ch2));
+
/* Starts an asynchronous ADC conversion operation, the conversion
will be executed in parallel to the current PWM cycle and will
terminate before the next PWM cycle.*/
|