FY
millis.cpp@0:f2303a6884e4, 2018-05-16 (annotated)
- Committer:
- ckalintra
- Date:
- Wed May 16 10:26:07 2018 +0000
- Revision:
- 0:f2303a6884e4
FY
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ckalintra | 0:f2303a6884e4 | 1 | #include "mbed.h" |
ckalintra | 0:f2303a6884e4 | 2 | #include "millis.h" |
ckalintra | 0:f2303a6884e4 | 3 | |
ckalintra | 0:f2303a6884e4 | 4 | volatile unsigned long _millis; |
ckalintra | 0:f2303a6884e4 | 5 | |
ckalintra | 0:f2303a6884e4 | 6 | void millisStart(void) { |
ckalintra | 0:f2303a6884e4 | 7 | SysTick_Config(SystemCoreClock / 1000);//read the time in second |
ckalintra | 0:f2303a6884e4 | 8 | } |
ckalintra | 0:f2303a6884e4 | 9 | |
ckalintra | 0:f2303a6884e4 | 10 | extern "C" void SysTick_Handler(void) { |
ckalintra | 0:f2303a6884e4 | 11 | _millis++; |
ckalintra | 0:f2303a6884e4 | 12 | } |
ckalintra | 0:f2303a6884e4 | 13 | |
ckalintra | 0:f2303a6884e4 | 14 | unsigned long millis(void) { |
ckalintra | 0:f2303a6884e4 | 15 | return _millis; |
ckalintra | 0:f2303a6884e4 | 16 | } |