diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-12-16 15:48:50 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-12-16 15:48:50 +0000 |
commit | 494cd0f0953d131bb31dcda508abfbd4eaef9899 (patch) | |
tree | f6b799556a1b75cd6de792edf3ebe9cabef8fb7d /os/hal/src | |
parent | ba37ee4f4b32aa3dc67b80ce09cbda7c5a449f4f (diff) | |
download | ChibiOS-494cd0f0953d131bb31dcda508abfbd4eaef9899.tar.gz ChibiOS-494cd0f0953d131bb31dcda508abfbd4eaef9899.tar.bz2 ChibiOS-494cd0f0953d131bb31dcda508abfbd4eaef9899.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1425 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/src')
-rw-r--r-- | os/hal/src/pwm.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/os/hal/src/pwm.c b/os/hal/src/pwm.c index ddae89d45..ad3c15728 100644 --- a/os/hal/src/pwm.c +++ b/os/hal/src/pwm.c @@ -88,6 +88,9 @@ void pwmStop(PWMDriver *pwmp) { /**
* @brief Setups a PWM channel.
+ * @details Associates a configuration to a PWM channel, this operation is
+ * required before a channel can be enabled using
+ * @p pwmEnableChannel().
* * @param[in] pwmp pointer to a @p PWMDriver object
* @param[in] channel PWM channel identifier
@@ -123,7 +126,8 @@ void pwmEnableChannel(PWMDriver *pwmp, "pwmEnableChannel");
chSysLock();
- chDbgAssert(pwmp->pd_state == PWM_READY,
+ chDbgAssert((pwmp->pd_state == PWM_READY) &&
+ (pwmp->pd_channel_configs[channel] != NULL),
"pwmEnableChannel(), #1", "invalid state");
pwm_lld_enable_channel(pwmp, channel, width);
chSysUnlock();
@@ -143,7 +147,8 @@ void pwmDisableChannel(PWMDriver *pwmp, pwmchannel_t channel) { "pwmEnableChannel");
chSysLock();
- chDbgAssert(pwmp->pd_state == PWM_READY,
+ chDbgAssert((pwmp->pd_state == PWM_READY) &&
+ (pwmp->pd_channel_configs[channel] != NULL),
"pwmDisableChannel(), #1", "invalid state");
pwm_lld_disable_channel(pwmp, channel);
chSysUnlock();
|