From 9d4af247a0e1150f4adb52e3db203275dcb5e2a6 Mon Sep 17 00:00:00 2001 From: Jake Carter Date: Mon, 26 Aug 2024 18:11:43 -0600 Subject: [PATCH] fix(Examples): Fix DUTY_CYCLE Functionality for MAX32660 TMR Example (#1131) --- 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;