mbed OS5
Fork of UIPEthernet by
Embed:
(wiki syntax)
Show/hide line numbers
millis.cpp
00001 /* 00002 uip_millis.cpp 00003 Copyright (c) 2015 Zoltan Hudak <hudakz@inbox.com> 00004 All rights reserved. 00005 00006 This program is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 #include "millis.h" 00020 #include "mbed.h" 00021 00022 volatile unsigned long _millis; 00023 00024 Ticker millisTicker; 00025 00026 00027 /** 00028 * @brief 00029 * @note 00030 * @param 00031 * @retval 00032 */ 00033 extern "C" void tick(void) { 00034 _millis++; 00035 } 00036 00037 /** 00038 * @brief 00039 * @note 00040 * @param 00041 * @retval 00042 */ 00043 extern "C" void millis_start(void) { 00044 _millis = 0; 00045 millisTicker.attach_us(&tick, 1000); 00046 } 00047 00048 /** 00049 * @brief 00050 * @note 00051 * @param 00052 * @retval 00053 */ 00054 extern "C" unsigned long millis(void) { 00055 return _millis; 00056 }
Generated on Tue Jul 12 2022 18:10:58 by 1.7.2