?? timer.c
字號:
#include "timer.h"
#include "cortexm3.h"
#include "nvic.h"
#define MAGIC_VALUE 299999
#include <stdio.h>
void SysTick_init(void)
{
int onems = ((NVIC.SysTick.Calibration) & 0x00ffffff);
int reload = 999; /* Supposed to be once a second (999+1 ms)*/
/* If the calibration value is non 0 then we can use it as a more accurate value for 1ms */
if(onems != 0)
{
reload = ((onems+1) * 1000)-1;
}
/* *SysTickLoad = reload; */
*SysTickLoad = MAGIC_VALUE; /* Found to be more realistic on ISSM */
#if defined SYSTICK_INTERRUPT
*SysTickCtrl = SysTickEnable | SysTickInterrupt; /* Start, with interrupts enabled */
#else
*SysTickCtrl = SysTickEnable; /* Start, with interrupts enabled */
#endif
}
void SysTickHandler(void)
{
printf("SysTick interrupt.\n\r");
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -