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
This commit is contained in:
patacongo 2011-12-20 14:41:32 +00:00
parent 28e28a380d
commit 95b25141d4

View File

@ -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