Skip to content

Commit 22b111a

Browse files
committed
add description for hw_systick config
1 parent dead887 commit 22b111a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

libraries/Bluefruit52Lib/examples/Hardware/hw_systick/hw_systick.ino

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
*********************************************************************/
1414
#include <Arduino.h>
1515

16+
// Interval between systick event
17+
#define TICK_INTERVAL_MS 50
18+
1619
// Note: Extern "C" is required since all the IRQ hardware handler is
1720
// declared as "C function" within the startup (assembly) file.
1821
// Without it, our SysTick_Handler will be declared as "C++ function"
@@ -37,8 +40,15 @@ void SysTick_Handler(void)
3740

3841
void setup()
3942
{
40-
// Set up systick to fire 10 times per second
41-
SysTick_Config(F_CPU/10);
43+
/* Input parameter is number of ticks between interrupts handler i.e SysTick_Handler
44+
* 1000 ms --> F_CPU ticks
45+
* T ms --> (F_CPU/1000)*T ticks
46+
*
47+
* Note: Since systick is 24-bit timer, the max tick value is 0xFFFFFF, F_CPU = 64 Mhz
48+
* --> our Tmax = 0xFFFFFF/64000 ~ 262 ms
49+
*/
50+
51+
SysTick_Config( (F_CPU/1000)*TICK_INTERVAL_MS );
4252
}
4353

4454
void loop()

0 commit comments

Comments
 (0)