Skip to content

Commit

Permalink
Fix DUTY_CYCLE for MAX32660 TMR example
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Carter committed Aug 23, 2024
1 parent 71724ae commit 440b83d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Examples/MAX32660/TMR/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 440b83d

Please sign in to comment.