Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Examples): Fix DUTY_CYCLE Functionality for MAX32660 TMR Example #1131

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading