Evan Brown
/
APpart3_E_start
11/18
millis.cpp@3:461a9012682d, 2018-11-19 (annotated)
- Committer:
- evenbrownie
- Date:
- Mon Nov 19 01:28:14 2018 +0000
- Revision:
- 3:461a9012682d
- Parent:
- 0:f43994f44684
part E
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
evenbrownie | 0:f43994f44684 | 1 | /* |
evenbrownie | 0:f43994f44684 | 2 | * @author: Natasha Sarkar, 2018 |
evenbrownie | 0:f43994f44684 | 3 | */ |
evenbrownie | 0:f43994f44684 | 4 | |
evenbrownie | 0:f43994f44684 | 5 | #include "mbed.h" |
evenbrownie | 0:f43994f44684 | 6 | #include "millis.h" |
evenbrownie | 0:f43994f44684 | 7 | |
evenbrownie | 0:f43994f44684 | 8 | volatile unsigned long _millis; |
evenbrownie | 0:f43994f44684 | 9 | |
evenbrownie | 0:f43994f44684 | 10 | void millis_begin(void) { |
evenbrownie | 0:f43994f44684 | 11 | SysTick_Config(SystemCoreClock / 1000); |
evenbrownie | 0:f43994f44684 | 12 | } |
evenbrownie | 0:f43994f44684 | 13 | |
evenbrownie | 0:f43994f44684 | 14 | extern "C" void SysTick_Handler(void) { |
evenbrownie | 0:f43994f44684 | 15 | _millis++; |
evenbrownie | 0:f43994f44684 | 16 | } |
evenbrownie | 0:f43994f44684 | 17 | |
evenbrownie | 0:f43994f44684 | 18 | unsigned long millis(void) { |
evenbrownie | 0:f43994f44684 | 19 | return _millis; |
evenbrownie | 0:f43994f44684 | 20 | } |
evenbrownie | 0:f43994f44684 | 21 |