Evan Brown
/
APpart3_E_start
11/18
Diff: millis.cpp
- Revision:
- 0:f43994f44684
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/millis.cpp Thu Nov 08 20:48:47 2018 +0000 @@ -0,0 +1,21 @@ +/* + * @author: Natasha Sarkar, 2018 + */ + +#include "mbed.h" +#include "millis.h" + +volatile unsigned long _millis; + +void millis_begin(void) { + SysTick_Config(SystemCoreClock / 1000); +} + +extern "C" void SysTick_Handler(void) { + _millis++; +} + +unsigned long millis(void) { + return _millis; +} +