mbed OS5

Fork of UIPEthernet by Zoltan Hudak

Committer:
pilotak
Date:
Sun Aug 06 16:01:26 2017 +0000
Revision:
9:e55652bed36c
Parent:
8:4acb22344932
mBed OS5

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hudakz 8:4acb22344932 1 /*
hudakz 8:4acb22344932 2 uip_millis.cpp
hudakz 8:4acb22344932 3 Copyright (c) 2015 Zoltan Hudak <hudakz@inbox.com>
hudakz 8:4acb22344932 4 All rights reserved.
hudakz 8:4acb22344932 5
hudakz 8:4acb22344932 6 This program is free software: you can redistribute it and/or modify
hudakz 8:4acb22344932 7 it under the terms of the GNU General Public License as published by
hudakz 8:4acb22344932 8 the Free Software Foundation, either version 3 of the License, or
hudakz 8:4acb22344932 9 (at your option) any later version.
hudakz 8:4acb22344932 10
hudakz 8:4acb22344932 11 This program is distributed in the hope that it will be useful,
hudakz 8:4acb22344932 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
hudakz 8:4acb22344932 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
hudakz 8:4acb22344932 14 GNU General Public License for more details.
hudakz 8:4acb22344932 15
hudakz 8:4acb22344932 16 You should have received a copy of the GNU General Public License
hudakz 8:4acb22344932 17 along with this program. If not, see <http://www.gnu.org/licenses/>.
hudakz 8:4acb22344932 18 */
hudakz 8:4acb22344932 19 #include "millis.h"
hudakz 8:4acb22344932 20 #include "mbed.h"
hudakz 8:4acb22344932 21
hudakz 8:4acb22344932 22 volatile unsigned long _millis;
hudakz 6:10e42359e217 23
pilotak 9:e55652bed36c 24 Ticker millisTicker;
pilotak 9:e55652bed36c 25
pilotak 9:e55652bed36c 26
hudakz 8:4acb22344932 27 /**
hudakz 8:4acb22344932 28 * @brief
hudakz 8:4acb22344932 29 * @note
hudakz 8:4acb22344932 30 * @param
hudakz 8:4acb22344932 31 * @retval
hudakz 8:4acb22344932 32 */
pilotak 9:e55652bed36c 33 extern "C" void tick(void) {
pilotak 9:e55652bed36c 34 _millis++;
hudakz 8:4acb22344932 35 }
hudakz 8:4acb22344932 36
hudakz 8:4acb22344932 37 /**
hudakz 8:4acb22344932 38 * @brief
hudakz 8:4acb22344932 39 * @note
hudakz 8:4acb22344932 40 * @param
hudakz 8:4acb22344932 41 * @retval
hudakz 8:4acb22344932 42 */
pilotak 9:e55652bed36c 43 extern "C" void millis_start(void) {
pilotak 9:e55652bed36c 44 _millis = 0;
pilotak 9:e55652bed36c 45 millisTicker.attach_us(&tick, 1000);
hudakz 8:4acb22344932 46 }
hudakz 8:4acb22344932 47
hudakz 8:4acb22344932 48 /**
hudakz 8:4acb22344932 49 * @brief
hudakz 8:4acb22344932 50 * @note
hudakz 8:4acb22344932 51 * @param
hudakz 8:4acb22344932 52 * @retval
hudakz 8:4acb22344932 53 */
hudakz 8:4acb22344932 54 extern "C" unsigned long millis(void) {
hudakz 8:4acb22344932 55 return _millis;
hudakz 8:4acb22344932 56 }