Skip to content

Commit 0f4cba9

Browse files
committed
Moved msTicks variable and systick handler in #if check
1 parent cac258b commit 0f4cba9

File tree

1 file changed

+9
-2
lines changed
  • software/EFM32HG-Embedded2-project/src

1 file changed

+9
-2
lines changed

software/EFM32HG-Embedded2-project/src/delay.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/***************************************************************************//**
22
* @file delay.c
33
* @brief Delay functionality.
4-
* @version 3.1
4+
* @version 3.2
55
* @author Brecht Van Eeckhoudt
66
*
77
* ******************************************************************************
@@ -28,6 +28,7 @@
2828
* @li v3.0: Disabled peripheral clock before entering an `error` function, added
2929
* functionality to exit methods after `error` call and updated version number.
3030
* @li v3.1: Removed `static` before some local variables (not necessary).
31+
* @li v3.2: Moved `msTicks` variable and systick handler in `#if` check.
3132
*
3233
* ******************************************************************************
3334
*
@@ -91,9 +92,13 @@
9192
/* Local variables */
9293
/* -> Volatile because it's modified by an interrupt service routine (@RAM)
9394
* -> Static so it's always kept in memory (@data segment, space provided during compile time) */
94-
static volatile uint32_t msTicks;
9595
static volatile bool RTC_sleep_wakeup = false;
9696

97+
#if SYSTICKDELAY == 1 /* SysTick delay selected */
98+
static volatile uint32_t msTicks;
99+
#endif /* SysTick/RTC selection */
100+
101+
97102
bool sleeping = false;
98103
bool RTC_initialized = false;
99104

@@ -502,6 +507,7 @@ static void initRTC (void)
502507
}
503508

504509

510+
#if SYSTICKDELAY == 1 /* SysTick delay selected */
505511
/**************************************************************************//**
506512
* @brief
507513
* Interrupt Service Routine for system tick counter.
@@ -510,6 +516,7 @@ void SysTick_Handler (void)
510516
{
511517
msTicks++; /* Increment counter necessary by SysTick delay functionality */
512518
}
519+
#endif /* SysTick/RTC selection */
513520

514521

515522
/**************************************************************************//**

0 commit comments

Comments
 (0)