Skip to content

Commit a448bc4

Browse files
committed
add hw_systick example
1 parent f2f0c6e commit a448bc4

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*********************************************************************
2+
This is an example for our nRF52 based Bluefruit LE modules
3+
4+
Pick one up today in the adafruit shop!
5+
6+
Adafruit invests time and resources providing this open source code,
7+
please support Adafruit and open-source hardware by purchasing
8+
products from Adafruit!
9+
10+
MIT license, check LICENSE for more information
11+
All text above, and the splash screen below must be included in
12+
any redistribution
13+
*********************************************************************/
14+
#include <Arduino.h>
15+
16+
// Note: Extern "C" is required since all the IRQ hardware handler is
17+
// declared as "C function" within the startup (assembly) file.
18+
// Without it, our SysTick_Handler will be declared as "C++ function"
19+
// which is not the same as the "C function" in startup even it has
20+
// the same name.
21+
extern "C"
22+
{
23+
24+
/* This is hardware interupt service function exectuing in non-RTOS thread
25+
* Function implementation should be quick and short if possible.
26+
*
27+
* WARNING: This function MUST NOT call any blocking FreeRTOS API
28+
* such as delay(), xSemaphoreTake() etc ... for more information
29+
* http://www.freertos.org/a00016.html
30+
*/
31+
void SysTick_Handler(void)
32+
{
33+
ledToggle(LED_BLUE);
34+
}
35+
36+
} // extern C
37+
38+
void setup()
39+
{
40+
// Set up systick to fire 10 times per second
41+
SysTick_Config(F_CPU/10);
42+
}
43+
44+
void loop()
45+
{
46+
// do nothing here
47+
}

0 commit comments

Comments
 (0)