FY
Revision 0:f2303a6884e4, committed 2018-05-16
- Comitter:
- ckalintra
- Date:
- Wed May 16 10:26:07 2018 +0000
- Commit message:
- FY
Changed in this revision
millis.cpp | Show annotated file Show diff for this revision Revisions of this file |
millis.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r f2303a6884e4 millis.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/millis.cpp Wed May 16 10:26:07 2018 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" +#include "millis.h" + +volatile unsigned long _millis; + +void millisStart(void) { + SysTick_Config(SystemCoreClock / 1000);//read the time in second +} + +extern "C" void SysTick_Handler(void) { + _millis++; +} + +unsigned long millis(void) { + return _millis; +} \ No newline at end of file
diff -r 000000000000 -r f2303a6884e4 millis.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/millis.h Wed May 16 10:26:07 2018 +0000 @@ -0,0 +1,7 @@ +#ifndef MILLIS_H +#define MILLIS_H + +void millisStart(void); +unsigned long millis(void); + +#endif \ No newline at end of file