Skip to content

Commit

Permalink
fix(Examples): Fix DUTY_CYCLE Functionality for MAX32660 TMR Example (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Carter authored Aug 27, 2024
1 parent 428abd6 commit 9d4af24
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 9d4af24

Please sign in to comment.