From 6624532a422e984de58f0e04a884085688e47571 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 7 Apr 2013 10:19:13 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5557 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM32/pwm_lld.h | 4 ++-- os/hal/templates/pwm_lld.h | 25 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/os/hal/platforms/STM32/pwm_lld.h b/os/hal/platforms/STM32/pwm_lld.h index 8b1761f82..b6a614fe1 100644 --- a/os/hal/platforms/STM32/pwm_lld.h +++ b/os/hal/platforms/STM32/pwm_lld.h @@ -416,8 +416,8 @@ struct PWMDriver { * @notapi */ #define pwm_lld_is_channel_enabled(pwmp, channel) \ - ((pwmp->tim->CCR[channel] == 0) && \ - ((pwmp->tim->DIER & (2 << channel)) == 0)) + ((pwmp->tim->CCR[channel] != 0) || \ + ((pwmp->tim->DIER & (2 << channel)) != 0)) /*===========================================================================*/ /* External declarations. */ diff --git a/os/hal/templates/pwm_lld.h b/os/hal/templates/pwm_lld.h index dc6389418..46e357fd4 100644 --- a/os/hal/templates/pwm_lld.h +++ b/os/hal/templates/pwm_lld.h @@ -34,7 +34,7 @@ /** * @brief Number of PWM channels per PWM driver. */ -#define PWM_CHANNELS 4 +#define PWM_CHANNELS 4 /*===========================================================================*/ /* Driver pre-compile time settings. */ @@ -45,11 +45,11 @@ * @{ */ /** - * @brief XXX driver enable switch. - * @details If set to @p TRUE the support for XXX1 is included. + * @brief PWM driver enable switch. + * @details If set to @p TRUE the support for PWM1 is included. */ -#if !defined(PLATFORM_XXX_USE_XXX1) || defined(__DOXYGEN__) -#define PLATFORM_XXX_USE_XXX1 FALSE +#if !defined(PLATFORM_PWM_USE_PWM1) || defined(__DOXYGEN__) +#define PLATFORM_PWM_USE_PWM1 FALSE #endif /** @} */ @@ -154,12 +154,23 @@ struct PWMDriver { /* Driver macros. */ /*===========================================================================*/ +/** + * @brief Returns a PWM channel status. + * @pre The PWM unit must have been activated using @p pwmStart(). + * + * @param[in] pwmp pointer to a @p PWMDriver object + * @param[in] channel PWM channel identifier (0...PWM_CHANNELS-1) + * + * @notapi + */ +#define pwm_lld_is_channel_enabled(pwmp, channel) FALSE + /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ -#if PLATFORM_XXX_USE_XXX1 && !defined(__DOXYGEN__) -extern XXXDriver XXXD1; +#if PLATFORM_PWM_USE_PWM1 && !defined(__DOXYGEN__) +extern PWMDriver PWMD1; #endif #ifdef __cplusplus