From 440b83dff29895a3cf5657f9a7d13796a11ea07f Mon Sep 17 00:00:00 2001 From: Jake Carter Date: Thu, 22 Aug 2024 19:12:57 -0600 Subject: [PATCH] Fix DUTY_CYCLE for MAX32660 TMR example --- Examples/MAX32660/TMR/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Examples/MAX32660/TMR/main.c b/Examples/MAX32660/TMR/main.c index 4d320b5c2e6..02480cfe46c 100644 --- a/Examples/MAX32660/TMR/main.c +++ b/Examples/MAX32660/TMR/main.c @@ -38,7 +38,8 @@ #include "led.h" /***** Definitions *****/ -#define MAX_TICKS pow(2, 32) +#define MAX_TICKS 4294967296 +// 2^32 // Parameters for PWM output #define FREQ 1000 // (Hz) @@ -77,7 +78,7 @@ void PWMTimer(void) // Declare variables mxc_tmr_cfg_t tmr; // to configure timer unsigned int periodTicks = MXC_TMR_GetPeriod(PWM_TIMER, 1, FREQ); - unsigned int dutyTicks = periodTicks / 100 * 50; + unsigned int dutyTicks = periodTicks * (DUTY_CYCLE / 100.0f); //Configure PWM GPIO Pin mxc_gpio_cfg_t pwmOut;