#include "pwm_at91.h"
#include "hw/pwm_map.h"
#include "hw/hw_cpu.h"
+#include "cfg/cfg_pwm.h"
+
+// Define logging setting (for cfg/log.h module).
+#define LOG_LEVEL PWM_LOG_LEVEL
+#define LOG_VERBOSITY PWM_LOG_VERBOSITY
+#include <cfg/log.h>
#include <cfg/macros.h>
#include <cfg/debug.h>
for(int i = 0; i <= PWM_HW_MAX_PRESCALER_STEP; i++)
{
period = CLOCK_FREQ / (BV(i) * freq);
-// TRACEMSG("period[%ld], prescale[%d]", period, i);
+// LOG_INFO("period[%ld], prescale[%d]\n", period, i);
if ((period < PWM_HW_MAX_PERIOD) && (period != 0))
{
//Clean previous channel prescaler, and set new
}
}
- TRACEMSG("PWM ch[%d] period[%ld]", dev, period);
+ LOG_INFO("PWM ch[%d] period[%ld]\n", dev, period);
}
/**
*/
if (pwm_map[dev].pol)
{
- duty = (uint16_t)*pwm_map[dev].period_reg - duty;
-// TRACEMSG("Inverted duty[%d], pol[%d]", duty, pwm_map[dev].pol);
+ duty = (uint16_t)*pwm_map[dev].period_reg - duty;
+ LOG_INFO("Inverted duty[%d], pol[%d]\n", duty, pwm_map[dev].pol);
}
PWM_PIO_PDR = pwm_map[dev].pwm_pin;
PWM_ENA = BV(dev);
-// TRACEMSG("PWM ch[%d] duty[%d], period[%ld]", dev, duty, *pwm_map[dev].period_reg);
+ LOG_INFO("PWM ch[%d] duty[%d], period[%ld]\n", dev, duty, *pwm_map[dev].period_reg);
}
*/
void pwm_hw_setPolarity(PwmDev dev, bool pol)
{
- pwm_map[dev].pol = pol;
-// TRACEMSG("Set pol[%d]", pwm_map[dev].pol);
+ pwm_map[dev].pol = pol;
+ LOG_INFO("Set pol[%d]\n", pwm_map[dev].pol);
}
/**