diff --git a/cpu/cc2538/dev/pwm.c b/cpu/cc2538/dev/pwm.c index 7fb6fc61f..837efcb14 100644 --- a/cpu/cc2538/dev/pwm.c +++ b/cpu/cc2538/dev/pwm.c @@ -135,10 +135,10 @@ pwm_enable(uint32_t freq, uint8_t duty, uint8_t timer, uint8_t ab) } /* Get the peripheral clock and equivalent deassert count */ - interval_load = sys_ctrl_get_io_clock() / freq; + interval_load = sys_ctrl_get_sys_clock() / freq; duty_count = ((interval_load * duty) + 1) / 100; - PRINTF("PWM: IO %luHz: %lu %lu\n", sys_ctrl_get_io_clock(), + PRINTF("PWM: sys %luHz: %lu %lu\n", sys_ctrl_get_sys_clock(), interval_load, duty_count); /* Set the start value (period), count down */ diff --git a/cpu/cc2538/dev/pwm.h b/cpu/cc2538/dev/pwm.h index 7420d3d30..f80402f31 100644 --- a/cpu/cc2538/dev/pwm.h +++ b/cpu/cc2538/dev/pwm.h @@ -78,15 +78,15 @@ /** \name PWM recommended values respect to peripheral clock frequency * @{ */ -/* Roughly 244 Hz with a 16 MHz IO clock, no prescaler */ -#define PWM_SYS_IO_16MHZ_NO_PRES_MIN 0xFFFF -#define PWM_SYS_IO_16MHZ_NO_PRES_MIN_FREQ 244 -/* Roughly 1 Hz with a 16 MHz IO clock, to keep frequency parameter in Hz */ -#define PWM_SYS_IO_16MHZ_PRES_MIN 0x00F42400 -#define PWM_SYS_IO_16MHZ_PRES_MIN_FREQ 1 +/* Roughly 244 Hz with a 16-MHz system clock, no prescaler */ +#define PWM_SYS_16MHZ_NO_PRES_MIN 0xFFFF +#define PWM_SYS_16MHZ_NO_PRES_MIN_FREQ 244 +/* Roughly 1 Hz with a 16-MHz system clock, to keep frequency parameter in Hz */ +#define PWM_SYS_16MHZ_PRES_MIN 0x00F42400 +#define PWM_SYS_16MHZ_PRES_MIN_FREQ 1 /* Yields 160 KHz at 16 MHz and allows down to 1% (integer) duty cycles */ -#define PWM_SYS_IO_16MHZ_NO_PRES_MAX 100 -#define PWM_SYS_IO_16MHZ_NO_PRES_MAX_FREQ 160000 +#define PWM_SYS_16MHZ_NO_PRES_MAX 100 +#define PWM_SYS_16MHZ_NO_PRES_MAX_FREQ 160000 /** @} */ /*---------------------------------------------------------------------------*/ /** \name PWM driver definitions and configuration values @@ -107,8 +107,8 @@ #define PWM_GPTIMER_CFG_SPLIT_MODE 0x04 #define PWM_DUTY_MAX 100 #define PWM_DUTY_MIN 0 -#define PWM_FREQ_MIN PWM_SYS_IO_16MHZ_PRES_MIN_FREQ -#define PWM_FREQ_MAX PWM_SYS_IO_16MHZ_NO_PRES_MAX_FREQ +#define PWM_FREQ_MIN PWM_SYS_16MHZ_PRES_MIN_FREQ +#define PWM_FREQ_MAX PWM_SYS_16MHZ_NO_PRES_MAX_FREQ /** @} */ /*---------------------------------------------------------------------------*/ /** \name PWM functions