summaryrefslogtreecommitdiff
path: root/include/pwm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/pwm.h')
-rw-r--r--include/pwm.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/pwm.h b/include/pwm.h
index 2ac46b3812..03e424ee05 100644
--- a/include/pwm.h
+++ b/include/pwm.h
@@ -6,6 +6,11 @@
#ifndef __CROS_EC_PWM_H
#define __CROS_EC_PWM_H
+#include <inttypes.h>
+
+#define PWM_RAW_TO_PERCENT(v) DIV_ROUND_NEAREST((uint32_t)(v)*100, UINT16_MAX)
+#define PWM_PERCENT_TO_RAW(v) ((uint32_t)(v)*UINT16_MAX / 100)
+
/* The values are defined in board.h */
enum pwm_channel;