aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32/pwm_lld.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-04-05 18:21:00 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-04-05 18:21:00 +0000
commitad009f46d58f4f555cd412aa2f2a267da01db4e0 (patch)
tree18b4e9fd44f637c664c075b9d611465ed015fc60 /os/hal/platforms/STM32/pwm_lld.h
parentc4fec713d238a4396ee5693c986e3d25a74082e5 (diff)
downloadChibiOS-ad009f46d58f4f555cd412aa2f2a267da01db4e0.tar.gz
ChibiOS-ad009f46d58f4f555cd412aa2f2a267da01db4e0.tar.bz2
ChibiOS-ad009f46d58f4f555cd412aa2f2a267da01db4e0.zip
STM32 PWM driver optimization, changed the behavior of pwmChangePeriod().
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2869 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32/pwm_lld.h')
-rw-r--r--os/hal/platforms/STM32/pwm_lld.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/os/hal/platforms/STM32/pwm_lld.h b/os/hal/platforms/STM32/pwm_lld.h
index 3d0d9d79c..2b3ce7183 100644
--- a/os/hal/platforms/STM32/pwm_lld.h
+++ b/os/hal/platforms/STM32/pwm_lld.h
@@ -296,10 +296,6 @@ struct PWMDriver {
#endif
/* End of the mandatory fields.*/
/**
- * @brief Bit mask of the enabled channels.
- */
- uint32_t enabled_channels;
- /**
* @brief Pointer to the TIMx registers block.
*/
TIM_TypeDef *tim;
@@ -309,6 +305,25 @@ struct PWMDriver {
/* Driver macros. */
/*===========================================================================*/
+/**
+ * @brief Changes the period the PWM peripheral.
+ * @details This function changes the period of a PWM unit that has already
+ * been activated using @p pwmStart().
+ * @pre The PWM unit must have been activated using @p pwmStart().
+ * @post The PWM unit period is changed to the new value.
+ * @note The function has effect at the next cycle start.
+ * @note If a period is specified that is shorter than the pulse width
+ * programmed in one of the channels then the behavior is not
+ * guaranteed.
+ *
+ * @param[in] pwmp pointer to a @p PWMDriver object
+ * @param[in] period new cycle time in ticks
+ *
+ * @notapi
+ */
+#define pwm_lld_change_period(pwmp, period) \
+ ((pwmp)->tim->ARR = (uint16_t)((period) - 1))
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
@@ -339,7 +354,6 @@ extern "C" {
void pwm_lld_init(void);
void pwm_lld_start(PWMDriver *pwmp);
void pwm_lld_stop(PWMDriver *pwmp);
- void pwm_lld_change_period(PWMDriver *pwmp, pwmcnt_t period);
void pwm_lld_enable_channel(PWMDriver *pwmp,
pwmchannel_t channel,
pwmcnt_t width);