projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reformat and typo.
[bertos.git]
/
bertos
/
drv
/
pwm.c
diff --git
a/bertos/drv/pwm.c
b/bertos/drv/pwm.c
index 3946188262263c0f406062adef2fac522a19d77b..021d2437c79e4f7f1e9b44cc74f7de1ff628e77a 100644
(file)
--- a/
bertos/drv/pwm.c
+++ b/
bertos/drv/pwm.c
@@
-38,14
+38,15
@@
* \author Daniele Basile <asterix@develer.com>
*/
* \author Daniele Basile <asterix@develer.com>
*/
-#include <c
pu/type
s.h>
-#include <c
pu/irq
.h>
+#include <c
fg/macro
s.h>
+#include <c
fg/debug
.h>
#include <drv/pwm.h>
#include <drv/pwm.h>
-#include <drv/pwm_at91.h>
-#include <cfg/macros.h>
-#include <cfg/debug.h>
+#include CPU_HEADER(pwm)
+
+#include <cpu/types.h>
+#include <cpu/irq.h>
/**
/**
@@
-56,13
+57,13
@@
void pwm_setDuty(PwmDev dev, pwm_duty_t duty)
pwm_period_t period = 0;
pwm_duty_t real_duty = 0;
pwm_period_t period = 0;
pwm_duty_t real_duty = 0;
- duty = MIN(duty,
(pwm_duty_t)
PWM_MAX_DUTY);
+ duty = MIN(duty, PWM_MAX_DUTY);
period = pwm_hw_getPeriod(dev);
real_duty = (uint64_t)(duty * period) >> (uint64_t)PWM_MAX_PERIOD_LOG2;
period = pwm_hw_getPeriod(dev);
real_duty = (uint64_t)(duty * period) >> (uint64_t)PWM_MAX_PERIOD_LOG2;
-//
kprintf("real_duty[%d] duty[%d], period[%d]\n
", real_duty, duty, period);
+//
TRACEMSG("real_duty[%d] duty[%d], period[%d]
", real_duty, duty, period);
pwm_hw_setDutyUnlock(dev, real_duty);
}
pwm_hw_setDutyUnlock(dev, real_duty);
}
@@
-95,12
+96,12
@@
void pwm_init(void)
IRQ_SAVE_DISABLE(flags);
IRQ_SAVE_DISABLE(flags);
+ pwm_hw_init();
+
/* set all pwm to 0 */
for (dev = 0; dev < PWM_CNT; dev++)
pwm_setDuty(dev, 0);
/* set all pwm to 0 */
for (dev = 0; dev < PWM_CNT; dev++)
pwm_setDuty(dev, 0);
- pwm_hw_init();
-
IRQ_RESTORE(flags);
}
IRQ_RESTORE(flags);
}