X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fpwm.c;h=cb5a45fb0e7293b7f5c292ff2fad620dc9f09a3b;hb=2156a825ba83da6e71a78237285a5558956da549;hp=dd1f13491412b1c5c6eee179f1938f2e5995aaf9;hpb=48606ccf318afe90b928fb43e0bd48586ff8d632;p=bertos.git diff --git a/bertos/drv/pwm.c b/bertos/drv/pwm.c index dd1f1349..cb5a45fb 100644 --- a/bertos/drv/pwm.c +++ b/bertos/drv/pwm.c @@ -38,15 +38,24 @@ * \author Daniele Basile */ -#include -#include - -#include -#include +#include "cfg/cfg_pwm.h" #include + +// Define logging setting (for cfg/log.h module). +#define LOG_LEVEL PWM_LOG_LEVEL +#define LOG_VERBOSITY PWM_LOG_FORMAT + +#include #include +#include + +#include CPU_HEADER(pwm) + +#include +#include + /** * Set duty of pwm channel \p dev. @@ -56,13 +65,13 @@ void pwm_setDuty(PwmDev dev, pwm_duty_t duty) 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; -// TRACEMSG("real_duty[%d] duty[%d], period[%d]", real_duty, duty, period); + LOG_INFO("real_duty[%d] duty[%d], period[%d]", real_duty, duty, period); pwm_hw_setDutyUnlock(dev, real_duty); } @@ -90,7 +99,7 @@ void pwm_enable(PwmDev dev, bool state) */ void pwm_init(void) { - cpuflags_t flags; + cpu_flags_t flags; PwmDev dev; IRQ_SAVE_DISABLE(flags);