projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Set default code optimization to size; remove dead declarations.[F
[bertos.git]
/
bertos
/
drv
/
pwm.h
diff --git
a/bertos/drv/pwm.h
b/bertos/drv/pwm.h
index 03d98453499af5f23a6fb4643a414acfefebc1b9..f03582142213a1402ea2a39c9fe88e137286c66d 100644
(file)
--- a/
bertos/drv/pwm.h
+++ b/
bertos/drv/pwm.h
@@
-31,23
+31,59
@@
*
* \version $Id$
*
*
* \version $Id$
*
- * \brief P
WM driver (interface)
+ * \brief P
ulse Width Modulation (PWM) driver.
*
* \version $Id$
* \author Francesco Sacchi <batt@develer.com>
*
* \version $Id$
* \author Francesco Sacchi <batt@develer.com>
+ * \author Daniele Basile <asterix@develer.com>
+ *
+ * $WIZ$ module_name = "pwm"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_pwm.h"
*/
#ifndef DRV_PWM_H
#define DRV_PWM_H
*/
#ifndef DRV_PWM_H
#define DRV_PWM_H
-#include <pwm_map.h>
+#include "hw/pwm_map.h"
+
+#include <cpu/attr.h>
+
+#include CPU_HEADER(pwm)
+
#include <cfg/compiler.h>
#include <cfg/compiler.h>
+#define PWM_MAX_DUTY ((pwm_duty_t)0xFFFF)
+#define PWM_MAX_PERIOD 0xFFFF
+#define PWM_MAX_PERIOD_LOG2 16
+
+/**
+ * PWM type define.
+ */
typedef uint16_t pwm_duty_t;
typedef uint16_t pwm_duty_t;
+typedef uint32_t pwm_freq_t;
+
+
+
+/**
+ * Set PWM polarity of pwm \p dev.
+ */
+INLINE void pwm_setPolarity(PwmDev dev, bool pol)
+{
+ pwm_hw_setPolarity(dev, pol);
+}
void pwm_setDuty(PwmDev dev, pwm_duty_t duty);
void pwm_setDuty(PwmDev dev, pwm_duty_t duty);
+void pwm_setFrequency(PwmDev dev, pwm_freq_t freq);
+void pwm_enable(PwmDev dev, bool state);
void pwm_init(void);
void pwm_init(void);
-#define PWM_MAX_DUTY 100
+/**
+ * Test function prototypes.
+ *
+ * See pwm_test.c for implemntation of these functions.
+ */
+int pwm_testRun(void);
+int pwm_testSetUp(void);
+int pwm_testTearDown(void);
#endif /* DRV_PWM_H */
#endif /* DRV_PWM_H */