update

Committer:
hudakz
Date:
Thu Jun 02 16:51:36 2016 +0000
Revision:
2:ac7586424119
Parent:
1:69c49c2be760
rev. 02

Who changed what in which revision?

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