]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/Core/src/Ref_Systick.txt
Adapted and prepared structure to add Cortex-A and CMSIS-Zone documentation
[cmsis] / CMSIS / DoxyGen / Core / src / Ref_Systick.txt
1 /* ##################################    SysTick function  ###################################### */
2 /** 
3 \defgroup    SysTick_gr Systick Timer (SYSTICK)
4 \brief       Initialize and start the SysTick timer.
5 \details
6     The System Tick Time (SysTick) generates interrupt requests on a regular basis.
7     This allows an OS to carry out context switching to support multiple tasking. For applications
8     that do not require an OS, the SysTick can be used for time keeping, time measurement, or as an 
9     interrupt source for tasks that need to be executed regularly.
10     
11
12 \section SysTick_code_ex_sec Code Example     
13     The code below shows the usage of the function SysTick_Config() with an LPC1700.
14     
15 \code
16 #include "LPC17xx.h"
17
18 uint32_t msTicks = 0;                                       /* Variable to store millisecond ticks */
19
20                                             
21 void SysTick_Handler(void)  {                               /* SysTick interrupt Handler.
22   msTicks++;                                                   See startup file startup_LPC17xx.s for SysTick vector */ 
23 }
24
25
26 int main (void)  {
27   uint32_t returnCode;
28
29   returnCode = SysTick_Config(SystemCoreClock / 1000);      /* Configure SysTick to generate an interrupt every millisecond */
30
31   if (returnCode != 0)  {                                   /* Check return code for errors */
32     // Error Handling 
33   }
34
35   while(1);
36 }
37 \endcode    
38     
39 @{
40 */
41
42
43 /**************************************************************************************************/
44 /** \brief  System Tick Timer Configuration
45     \details
46     Initialises and starts the System Tick Timer and its interrupt.
47     After this call, the SysTick timer creates interrupts with the specified time interval. 
48     Counter is in free running mode to generate periodical interrupts.   
49
50     \param [in]  ticks  Number of ticks between two interrupts
51
52     \returns          0  - success
53     \returns          1  - failure
54     
55     \note
56     When <b>\#define __Vendor_SysTickConfig</b> is set to 1, the standard function <b>SysTick_Config</b>
57     is excluded. In this case, the file <b><i>device</i>.h</b> must contain a 
58     vendor specific implementation of this function. 
59 */
60 uint32_t SysTick_Config(uint32_t ticks);
61
62 /** @} */