aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32/pwm_lld.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-11-21 09:41:46 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-11-21 09:41:46 +0000
commit43902259c696eabe39836ce96c3e00b5bbf0fb82 (patch)
treed9ea1bdfe47c71e75bbf545a496d36bdc139f7da /os/hal/platforms/STM32/pwm_lld.h
parenta2e1f71fc25c29620af68246125f81151f80f733 (diff)
downloadChibiOS-43902259c696eabe39836ce96c3e00b5bbf0fb82.tar.gz
ChibiOS-43902259c696eabe39836ce96c3e00b5bbf0fb82.tar.bz2
ChibiOS-43902259c696eabe39836ce96c3e00b5bbf0fb82.zip
Fixed bugs 3114266 and 3114319.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2404 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32/pwm_lld.h')
-rw-r--r--os/hal/platforms/STM32/pwm_lld.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/os/hal/platforms/STM32/pwm_lld.h b/os/hal/platforms/STM32/pwm_lld.h
index fcd66bbda..b22e3a315 100644
--- a/os/hal/platforms/STM32/pwm_lld.h
+++ b/os/hal/platforms/STM32/pwm_lld.h
@@ -250,22 +250,24 @@ struct PWMDriver {
* Please refer to the STM32 HAL driver documentation
* and/or the STM32 Reference Manual for the right clock
* source.
- * @param[in] nsec PWM clock cycle time in nanoseconds
+ * @param[in] pwmclk PWM clock frequency in cycles
* @return The value to be stored in the @p pc_psc field of the
* @p PWMConfig structure.
*/
-#define PWM_COMPUTE_PSC(clksrc, nsec) \
- ((uint16_t)(((clksrc) / (1000000000 / (nsec))) - 1))
+#define PWM_COMPUTE_PSC(clksrc, pwmclk) \
+ ((uint16_t)(((clksrc) / (pwmclk)) - 1))
/**
* @brief PWM cycle period initialization utility.
* @note The calculated value must fit into an unsigned 16 bits integer.
*
- * @param[in] clkperiod PWM clock period in nanoseconds
- * @param[in] pwmperiod PWM cycle period in nanoseconds
+ * @param[in] pwmclk PWM clock frequency in cycles
+ * @param[in] pwmperiod PWM cycle period in microseconds
+ * @return The value to be stored in the @p pc_arr field of the
+ * @p PWMConfig structure.
*/
-#define PWM_COMPUTE_ARR(clkperiod, pwmperiod) \
- ((uint16_t)(((clkperiod) / (1000000000 / (pwmperiod))) - 1))
+#define PWM_COMPUTE_ARR(pwmclk, pwmperiod) \
+ ((uint16_t)(((pwmclk) / (1000000 / (pwmperiod))) - 1))
/**
* @brief Converts from degrees to pulse width.