aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include/pwm.h
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-03-08 21:19:58 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-03-08 21:19:58 +0000
commitce7f7103df5f634f7b57d90e115c5824adcb68a0 (patch)
tree48064ba690d7002bb8fc7b78f3f9dd76729b785c /os/hal/include/pwm.h
parent63bf265ddf9ad40ad981c5a145c601972b91426e (diff)
downloadChibiOS-ce7f7103df5f634f7b57d90e115c5824adcb68a0.tar.gz
ChibiOS-ce7f7103df5f634f7b57d90e115c5824adcb68a0.tar.bz2
ChibiOS-ce7f7103df5f634f7b57d90e115c5824adcb68a0.zip
MISRA fixes for high level HAL.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7738 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/include/pwm.h')
-rw-r--r--os/hal/include/pwm.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/os/hal/include/pwm.h b/os/hal/include/pwm.h
index cb948e850..6841e0e43 100644
--- a/os/hal/include/pwm.h
+++ b/os/hal/include/pwm.h
@@ -28,7 +28,7 @@
#ifndef _PWM_H_
#define _PWM_H_
-#if HAL_USE_PWM || defined(__DOXYGEN__)
+#if (HAL_USE_PWM == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -41,22 +41,22 @@
/**
* @brief Standard output modes mask.
*/
-#define PWM_OUTPUT_MASK 0x0F
+#define PWM_OUTPUT_MASK 0x0FU
/**
* @brief Output not driven, callback only.
*/
-#define PWM_OUTPUT_DISABLED 0x00
+#define PWM_OUTPUT_DISABLED 0x00U
/**
* @brief Positive PWM logic, active is logic level one.
*/
-#define PWM_OUTPUT_ACTIVE_HIGH 0x01
+#define PWM_OUTPUT_ACTIVE_HIGH 0x01U
/**
* @brief Inverse PWM logic, active is logic level zero.
*/
-#define PWM_OUTPUT_ACTIVE_LOW 0x02
+#define PWM_OUTPUT_ACTIVE_LOW 0x02U
/** @} */
/*===========================================================================*/
@@ -77,7 +77,7 @@
typedef enum {
PWM_UNINIT = 0, /**< Not initialized. */
PWM_STOP = 1, /**< Stopped. */
- PWM_READY = 2, /**< Ready. */
+ PWM_READY = 2 /**< Ready. */
} pwmstate_t;
/**
@@ -192,9 +192,9 @@ typedef void (*pwmcallback_t)(PWMDriver *pwmp);
* @iclass
*/
#define pwmEnableChannelI(pwmp, channel, width) do { \
- (pwmp)->enabled |= 1 << (channel); \
+ (pwmp)->enabled |= ((pwmchnmsk_t)1U << (pwmchnmsk_t)(channel)); \
pwm_lld_enable_channel(pwmp, channel, width); \
-} while (0)
+} while (false)
/**
* @brief Disables a PWM channel.
@@ -211,9 +211,9 @@ typedef void (*pwmcallback_t)(PWMDriver *pwmp);
* @iclass
*/
#define pwmDisableChannelI(pwmp, channel) do { \
- (pwmp)->enabled &= ~(1 << (channel)); \
+ (pwmp)->enabled &= ~((pwmchnmsk_t)1U << (pwmchnmsk_t)(channel)); \
pwm_lld_disable_channel(pwmp, channel); \
-} while (0)
+} while (false)
/**
* @brief Returns a PWM channel status.
@@ -225,7 +225,7 @@ typedef void (*pwmcallback_t)(PWMDriver *pwmp);
* @iclass
*/
#define pwmIsChannelEnabledI(pwmp, channel) \
- ((bool)((pwmp)->enabled & (1 << (channel))))
+ (((pwmp)->enabled & ((pwmchnmsk_t)1U << (pwmchnmsk_t)(channel))) != 0U)
/**
* @brief Enables the periodic activation edge notification.
@@ -304,7 +304,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_PWM */
+#endif /* HAL_USE_PWM == TRUE */
#endif /* _PWM_H_ */