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

refactor(PeriphDrivers)!: Update WUT API naming schemes for MAX32655, MAX32657, MAX32665, MAX32690, MAX78000, and MAX78002. Offer WUT selection on MAX32690 #1291

Merged
merged 10 commits into from
Dec 16, 2024
2 changes: 1 addition & 1 deletion Examples/MAX32655/FreeRTOSDemo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ int freertos_permit_tickless(void)
*/
void WUT_IRQHandler(void)
{
MXC_WUT_IntClear(MXC_WUT0);
MXC_WUT_ClearFlags(MXC_WUT0);
NVIC_ClearPendingIRQ(WUT_IRQn);
}

Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32655/WUT/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

void WUT_IRQHandler(void)
{
MXC_WUT_IntClear(MXC_WUT0);
MXC_WUT_ClearFlags(MXC_WUT0);
}

// *****************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32665/Bluetooth/BLE_FreeRTOS/stack_dats.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static void mainWsfInit(void)
/*************************************************************************************************/
void WUT_IRQHandler(void)
{
MXC_WUT_IntClear();
MXC_WUT_ClearFlags();
NVIC_ClearPendingIRQ(WUT_IRQn);
MXC_WUT_Handler();
PalTimerIRQCallBack();
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32665/FreeRTOSDemo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ void turnOffUnused(void)
*/
void WUT_IRQHandler(void)
{
MXC_WUT_IntClear();
MXC_WUT_ClearFlags();
NVIC_ClearPendingIRQ(WUT_IRQn);
}

Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32665/WUT/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
/***** Functions *****/
void WUT_IRQHandler(void)
{
MXC_WUT_IntClear();
MXC_WUT_ClearFlags();
}

// *****************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32680/FreeRTOSDemo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ int freertos_permit_tickless(void)
*/
void WUT_IRQHandler(void)
{
MXC_WUT_IntClear(MXC_WUT);
MXC_WUT_ClearFlags(MXC_WUT);
NVIC_ClearPendingIRQ(WUT_IRQn);
}

Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32680/WUT/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void setTrigger(int waitForTrigger)

void WUT_IRQHandler(void)
{
MXC_WUT_IntClear(MXC_WUT);
MXC_WUT_ClearFlags(MXC_WUT);
}

// *****************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32690/Bluetooth/BLE_FreeRTOS/dats_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ static void trimStart(void)
extern void wutTrimCb(int err);

/* Start the 32 kHz crystal trim procedure */
err = MXC_WUT_TrimCrystalAsync(wutTrimCb);
err = MXC_WUT_TrimCrystalAsync(MXC_WUT0, wutTrimCb);
if (err != E_NO_ERROR) {
APP_TRACE_INFO1("Error starting 32kHz crystal trim %d", err);
}
Expand Down
16 changes: 8 additions & 8 deletions Examples/MAX32690/Bluetooth/BLE_FreeRTOS/freertos_tickless.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
int freertos_permit_tickless(void)
{
/* Can not disable BLE DBB and 32 MHz clock while trim procedure is ongoing */
if (MXC_WUT_TrimPending() != E_NO_ERROR) {
if (MXC_WUT_TrimPending(MXC_WUT0) != E_NO_ERROR) {
return E_BUSY;
}

Expand Down Expand Up @@ -160,8 +160,8 @@ void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime)
/* Determine if we need to snapshot the PalBb clock */
if (schTimerActive) {
/* Snapshot the current WUT value with the PalBb clock */
MXC_WUT_Store();
preCapture = MXC_WUT_GetCount();
MXC_WUT_Store(MXC_WUT0);
preCapture = MXC_WUT_GetCount(MXC_WUT0);
schUsec = PalTimerGetExpTime();

/* Adjust idleTicks for the time it takes to restart the BLE hardware */
Expand All @@ -176,8 +176,8 @@ void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime)
}
} else {
/* Snapshot the current WUT value */
MXC_WUT_Edge();
preCapture = MXC_WUT_GetCount();
MXC_WUT_Edge(MXC_WUT0);
preCapture = MXC_WUT_GetCount(MXC_WUT0);
bleSleepTicks = 0;
schUsec = 0;
}
Expand Down Expand Up @@ -221,7 +221,7 @@ void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime)

if (schTimerActive) {
/* Restore the BB counter */
MXC_WUT_RestoreBBClock(BB_CLK_RATE_HZ);
MXC_WUT_RestoreBBClock(MXC_WUT0, BB_CLK_RATE_HZ);

/* Restart the BLE scheduler timer */
dsWutTicks = MXC_WUT->cnt - preCapture;
Expand All @@ -237,8 +237,8 @@ void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime)
}

/* Recalculate dsWutTicks for the FreeRTOS tick counter update */
MXC_WUT_Edge();
postCapture = MXC_WUT_GetCount();
MXC_WUT_Edge(MXC_WUT0);
postCapture = MXC_WUT_GetCount(MXC_WUT0);
dsWutTicks = postCapture - preCapture;

/*
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32690/Bluetooth/BLE_FreeRTOS/stack_dats.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void trim32k(void)

/* Execute the trim procedure */
wutTrimComplete = 0;
if (MXC_WUT_TrimCrystalAsync(wutTrimCb) != E_NO_ERROR) {
if (MXC_WUT_TrimCrystalAsync(MXC_WUT0, wutTrimCb) != E_NO_ERROR) {
APP_TRACE_INFO0("Error with 32k trim");
} else {
while (!wutTrimComplete) {}
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32690/Bluetooth/BLE_datc/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ int main(void)

/* Execute the trim procedure */
wutTrimComplete = 0;
MXC_WUT_TrimCrystalAsync(wutTrimCb);
MXC_WUT_TrimCrystalAsync(MXC_WUT0, wutTrimCb);
while (!wutTrimComplete) {}

/* Shutdown the 32 MHz crystal and the BLE DBB */
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32690/Bluetooth/BLE_dats/dats_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ static void trimStart(void)
extern void wutTrimCb(int err);

/* Start the 32 kHz crystal trim procedure */
err = MXC_WUT_TrimCrystalAsync(wutTrimCb);
err = MXC_WUT_TrimCrystalAsync(MXC_WUT0, wutTrimCb);
if (err != E_NO_ERROR) {
APP_TRACE_INFO1("Error starting 32kHz crystal trim %d", err);
}
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32690/Bluetooth/BLE_dats/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ int main(void)

/* Execute the trim procedure */
wutTrimComplete = 0;
MXC_WUT_TrimCrystalAsync(wutTrimCb);
MXC_WUT_TrimCrystalAsync(MXC_WUT0, wutTrimCb);
while (!wutTrimComplete) {}

/* Shutdown the 32 MHz crystal and the BLE DBB */
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32690/Bluetooth/BLE_fit/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ int main(void)

/* Execute the trim procedure */
wutTrimComplete = 0;
MXC_WUT_TrimCrystalAsync(wutTrimCb);
MXC_WUT_TrimCrystalAsync(MXC_WUT0, wutTrimCb);
while (!wutTrimComplete) {}

/* Shutdown the 32 MHz crystal and the BLE DBB */
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32690/Bluetooth/BLE_otac/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ int main(void)

/* Execute the trim procedure */
wutTrimComplete = 0;
MXC_WUT_TrimCrystalAsync(wutTrimCb);
MXC_WUT_TrimCrystalAsync(MXC_WUT0, wutTrimCb);
while (!wutTrimComplete) {}

/* Shutdown the 32 MHz crystal and the BLE DBB */
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32690/Bluetooth/BLE_otas/dats_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ static void trimStart(void)
extern void wutTrimCb(int err);

/* Start the 32 kHz crystal trim procedure */
err = MXC_WUT_TrimCrystalAsync(wutTrimCb);
err = MXC_WUT_TrimCrystalAsync(MXC_WUT0, wutTrimCb);
if (err != E_NO_ERROR) {
APP_TRACE_INFO1("Error starting 32kHz crystal trim %d", err);
}
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX32690/Bluetooth/BLE_otas/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ int main(void)

/* Execute the trim procedure */
wutTrimComplete = 0;
MXC_WUT_TrimCrystalAsync(wutTrimCb);
MXC_WUT_TrimCrystalAsync(MXC_WUT0, wutTrimCb);
while (!wutTrimComplete) {}

/* Stop here to measure the 32 kHz clock */
Expand Down
16 changes: 8 additions & 8 deletions Examples/MAX32690/Bluetooth/RF_Test/freertos_tickless.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
int freertos_permit_tickless(void)
{
/* Can not disable BLE DBB and 32 MHz clock while trim procedure is ongoing */
if (MXC_WUT_TrimPending() != E_NO_ERROR) {
if (MXC_WUT_TrimPending(MXC_WUT0) != E_NO_ERROR) {
return E_BUSY;
}

Expand Down Expand Up @@ -160,8 +160,8 @@ void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime)
/* Determine if we need to snapshot the PalBb clock */
if (schTimerActive) {
/* Snapshot the current WUT value with the PalBb clock */
MXC_WUT_Store();
preCapture = MXC_WUT_GetCount();
MXC_WUT_Store(MXC_WUT0);
preCapture = MXC_WUT_GetCount(MXC_WUT0);
schUsec = PalTimerGetExpTime();

/* Adjust idleTicks for the time it takes to restart the BLE hardware */
Expand All @@ -176,8 +176,8 @@ void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime)
}
} else {
/* Snapshot the current WUT value */
MXC_WUT_Edge();
preCapture = MXC_WUT_GetCount();
MXC_WUT_Edge(MXC_WUT0);
preCapture = MXC_WUT_GetCount(MXC_WUT0);
bleSleepTicks = 0;
schUsec = 0;
}
Expand Down Expand Up @@ -222,7 +222,7 @@ void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime)
PalBbRestore();

/* Restore the BB counter */
MXC_WUT_RestoreBBClock(BB_CLK_RATE_HZ);
MXC_WUT_RestoreBBClock(MXC_WUT0, BB_CLK_RATE_HZ);

/* Restart the BLE scheduler timer */
dsWutTicks = MXC_WUT->cnt - preCapture;
Expand All @@ -238,8 +238,8 @@ void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime)
}

/* Recalculate dsWutTicks for the FreeRTOS tick counter update */
MXC_WUT_Edge();
postCapture = MXC_WUT_GetCount();
MXC_WUT_Edge(MXC_WUT0);
postCapture = MXC_WUT_GetCount(MXC_WUT0);
dsWutTicks = postCapture - preCapture;

/*
Expand Down
14 changes: 7 additions & 7 deletions Examples/MAX32690/FreeRTOSDemo/freertos_tickless.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ __attribute__((weak)) int freertos_permit_tickless(void)
*/
void wutHitSnooze(void)
{
wutSnooze = MXC_WUT_GetCount() + MAX_WUT_SNOOZE;
wutSnooze = MXC_WUT_GetCount(MXC_WUT0) + MAX_WUT_SNOOZE;
wutSnoozeValid = 1;
}

Expand Down Expand Up @@ -108,7 +108,7 @@ void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime)
}

/* Check the WUT snooze */
if (wutSnoozeValid && (MXC_WUT_GetCount() < wutSnooze)) {
if (wutSnoozeValid && (MXC_WUT_GetCount(MXC_WUT0) < wutSnooze)) {
/* Finish out the rest of this tick with normal sleep */
MXC_LP_EnterSleepMode();
return;
Expand All @@ -134,16 +134,16 @@ void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime)
MXC_GPIO_OutSet(uart_rts.port, uart_rts.mask);

/* Snapshot the current WUT value */
MXC_WUT_Edge();
pre_capture = MXC_WUT_GetCount();
MXC_WUT_SetCompare(pre_capture + wut_ticks);
MXC_WUT_Edge();
MXC_WUT_Edge(MXC_WUT0);
pre_capture = MXC_WUT_GetCount(MXC_WUT0);
MXC_WUT_SetCompare(MXC_WUT0, pre_capture + wut_ticks);
MXC_WUT_Edge(MXC_WUT0);

LED_Off(1);

MXC_LP_EnterStandbyMode();

post_capture = MXC_WUT_GetCount();
post_capture = MXC_WUT_GetCount(MXC_WUT0);
actual_ticks = post_capture - pre_capture;

LED_On(1);
Expand Down
8 changes: 4 additions & 4 deletions Examples/MAX32690/FreeRTOSDemo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ int freertos_permit_tickless(void)
*/
void WUT_IRQHandler(void)
{
MXC_WUT_IntClear();
MXC_WUT_ClearFlags(MXC_WUT0);
NVIC_ClearPendingIRQ(WUT0_IRQn);
}

Expand Down Expand Up @@ -374,7 +374,7 @@ int main(void)
#if configUSE_TICKLESS_IDLE

/* Initialize Wakeup timer */
MXC_WUT_Init(MXC_WUT_PRES_1);
MXC_WUT_Init(MXC_WUT0, MXC_WUT_PRES_1);
mxc_wut_cfg_t wut_cfg;
wut_cfg.mode = MXC_WUT_MODE_COMPARE;
wut_cfg.cmp_cnt = 0xFFFFFFFF;
Expand All @@ -386,8 +386,8 @@ int main(void)
NVIC_EnableIRQ(WUT_IRQn);

/* Configure and start the WUT */
MXC_WUT_Config(&wut_cfg);
MXC_WUT_Enable();
MXC_WUT_Config(MXC_WUT0, &wut_cfg);
MXC_WUT_Enable(MXC_WUT0);

/* Setup CTS interrupt */
MXC_GPIO_IntConfig(&uart_cts, MXC_GPIO_INT_FALLING);
Expand Down
10 changes: 5 additions & 5 deletions Examples/MAX32690/WUT/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void setTrigger(int waitForTrigger)

void WUT0_IRQHandler(void)
{
MXC_WUT_IntClear();
MXC_WUT_ClearFlags(MXC_WUT0);
}

int main(void)
Expand All @@ -75,15 +75,15 @@ int main(void)
printf("wakeup timer to wake the device in %d Miliseconds.\n\n", MILLISECONDS_WUT);

// Initialize WUT
MXC_WUT_Init(MXC_WUT_PRES_1);
MXC_WUT_Init(MXC_WUT0, MXC_WUT_PRES_1);

// Get ticks based off of milliseconds
MXC_WUT_GetTicks(MILLISECONDS_WUT, MXC_WUT_UNIT_MILLISEC, &ticks);
MXC_WUT_GetTicks(MXC_WUT0, MILLISECONDS_WUT, MXC_WUT_UNIT_MILLISEC, &ticks);

// Config WUT
cfg.mode = MXC_WUT_MODE_ONESHOT;
cfg.cmp_cnt = ticks;
MXC_WUT_Config(&cfg);
MXC_WUT_Config(MXC_WUT0, &cfg);
NVIC_EnableIRQ(WUT0_IRQn);

// Enable WUT wakeup event
Expand All @@ -95,7 +95,7 @@ int main(void)

// Start WUT
printf("Entering SLEEP mode.\n");
MXC_WUT_Enable();
MXC_WUT_Enable(MXC_WUT0);

// Put the chip to sleep
MXC_LP_EnterSleepMode();
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX78000/CNN/kws20_demo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ int32_t tot_usec = -100000;
void WUT_IRQHandler(void)
{
i2s_flag = 1;
MXC_WUT_IntClear();
MXC_WUT_ClearFlags();

tot_usec += WUT_USEC;
//LED_On(LED2);
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX78000/FreeRTOSDemo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ int freertos_permit_tickless(void)
*/
void WUT_IRQHandler(void)
{
MXC_WUT_IntClear();
MXC_WUT_ClearFlags();
NVIC_ClearPendingIRQ(WUT_IRQn);
}

Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX78000/WUT/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void setTrigger(int waitForTrigger)

void WUT_IRQHandler(void)
{
MXC_WUT_IntClear();
MXC_WUT_ClearFlags();
}

// *****************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX78002/CNN/facial_recognition/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ area_t area_2 = { 0, 260, 80, 30 };

void WUT_IRQHandler(void)
{
MXC_WUT_IntClear();
MXC_WUT_ClearFlags();
}

uint32_t ticks_1;
Expand Down
2 changes: 1 addition & 1 deletion Examples/MAX78002/CNN/kws20_demo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ int32_t tot_usec = -100000;
void WUT_IRQHandler(void)
{
i2s_flag = 1;
MXC_WUT_IntClear();
MXC_WUT_ClearFlags();

tot_usec += WUT_USEC;
}
Expand Down
Loading
Loading