rd117

Dependencies:   mbed

Committer:
zinnetyazicii53
Date:
Wed Sep 11 12:17:28 2019 +0000
Revision:
1:b5f2016c1ede
Parent:
0:18182a1ac833
commit to pass repo to another account

Who changed what in which revision?

UserRevisionLine numberNew contents of line
zinnetyazicii53 0:18182a1ac833 1 #include "mbed.h"
zinnetyazicii53 0:18182a1ac833 2 #include "millis.h"
zinnetyazicii53 0:18182a1ac833 3 /*
zinnetyazicii53 0:18182a1ac833 4 millis.cpp
zinnetyazicii53 0:18182a1ac833 5 Copyright (c) 2016 Zoltan Hudak <hudakz@inbox.com>
zinnetyazicii53 0:18182a1ac833 6 All rights reserved.
zinnetyazicii53 0:18182a1ac833 7
zinnetyazicii53 0:18182a1ac833 8 This program is free software: you can redistribute it and/or modify
zinnetyazicii53 0:18182a1ac833 9 it under the terms of the GNU General Public License as published by
zinnetyazicii53 0:18182a1ac833 10 the Free Software Foundation, either version 3 of the License, or
zinnetyazicii53 0:18182a1ac833 11 (at your option) any later version.
zinnetyazicii53 0:18182a1ac833 12
zinnetyazicii53 0:18182a1ac833 13 This program is distributed in the hope that it will be useful,
zinnetyazicii53 0:18182a1ac833 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
zinnetyazicii53 0:18182a1ac833 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
zinnetyazicii53 0:18182a1ac833 16 GNU General Public License for more details.
zinnetyazicii53 0:18182a1ac833 17
zinnetyazicii53 0:18182a1ac833 18 You should have received a copy of the GNU General Public License
zinnetyazicii53 0:18182a1ac833 19 along with this program. If not, see <http://www.gnu.org/licenses/>.
zinnetyazicii53 1:b5f2016c1ede 20 */
zinnetyazicii53 0:18182a1ac833 21
zinnetyazicii53 0:18182a1ac833 22 volatile unsigned long _millis;
zinnetyazicii53 0:18182a1ac833 23
zinnetyazicii53 0:18182a1ac833 24 void millisStart(void) {
zinnetyazicii53 0:18182a1ac833 25 SysTick_Config(SystemCoreClock / 1000);
zinnetyazicii53 0:18182a1ac833 26 }
zinnetyazicii53 0:18182a1ac833 27
zinnetyazicii53 0:18182a1ac833 28 extern "C" void SysTick_Handler(void) {
zinnetyazicii53 0:18182a1ac833 29 _millis++;
zinnetyazicii53 0:18182a1ac833 30 }
zinnetyazicii53 0:18182a1ac833 31
zinnetyazicii53 0:18182a1ac833 32 unsigned long millis(void) {
zinnetyazicii53 0:18182a1ac833 33 return _millis;
zinnetyazicii53 0:18182a1ac833 34 }
zinnetyazicii53 0:18182a1ac833 35
zinnetyazicii53 0:18182a1ac833 36