summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/stm32
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-12-20 14:41:32 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-12-20 14:41:32 +0000
commitca038722e88f047a2eb0e35ef0954aebcf932791 (patch)
tree2f408755b3a07b39e65d2336ef3a023c0a412334 /nuttx/arch/arm/src/stm32
parentc4080df06cc977a0801794b83a51f6739e347379 (diff)
downloadpx4-nuttx-ca038722e88f047a2eb0e35ef0954aebcf932791.tar.gz
px4-nuttx-ca038722e88f047a2eb0e35ef0954aebcf932791.tar.bz2
px4-nuttx-ca038722e88f047a2eb0e35ef0954aebcf932791.zip
First round of PWM driver debug changes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4204 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/stm32')
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_pwm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_pwm.c b/nuttx/arch/arm/src/stm32/stm32_pwm.c
index 1e3f4f07d..420537ebb 100644
--- a/nuttx/arch/arm/src/stm32/stm32_pwm.c
+++ b/nuttx/arch/arm/src/stm32/stm32_pwm.c
@@ -70,6 +70,7 @@
* Pre-processor Definitions
****************************************************************************/
/* Debug ********************************************************************/
+/* Non-standard debug that may be enabled just for testing PWM */
#ifdef CONFIG_DEBUG_PWM
# define pwmdbg dbg
@@ -434,10 +435,13 @@ static int pwm_start(FAR struct pwm_lowerhalf_s *dev, FAR const struct pwm_info_
uint16_t ocmode1;
uint16_t ocmode2;
+ DEBUGASSERT(priv != NULL && info != NULL);
+
pwmvdbg("TIM%d channel: %d frequency: %d duty: %08x\n",
priv->timid, priv->channel, info->frequency, info->duty);
+ DEBUGASSERT(info->frequency > 0 && info->duty > 0 && info->duty < uitoub16(100));
- /* Caculate optimal values for the timer prescaler and for the timer reload
+ /* Calculate optimal values for the timer prescaler and for the timer reload
* register. If' frequency' is the desired frequency, then
*
* reload = timclk / frequency