00001 /* 00002 * Copyright Droids Corporation, Microb Technology, Eirbot (2005) 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Revision : $Id: time.h,v 1.4 2007-05-24 13:08:46 zer0 Exp $ 00019 * 00020 */ 00021 00022 /* Droids-corp, Eirbot, Microb Technology 2005 - Zer0 00023 * Interface of the time module 00024 */ 00025 00034 #ifndef _TIME_H_ 00035 #define _TIME_H_ 00036 00037 #include <aversive.h> 00038 00039 /* a 16 bit variable cannot cover one day */ 00040 typedef int32_t seconds; 00041 typedef int32_t microseconds; 00042 00043 00045 typedef struct 00046 { 00047 microseconds us; 00048 seconds s; 00049 } time_h; 00050 00051 00052 00053 /**********************************************************/ 00054 00056 void time_init(uint8_t priority); 00057 00058 /**********************************************************/ 00059 00061 seconds time_get_s(void); 00062 00063 /**********************************************************/ 00064 00066 microseconds time_get_us(void); 00067 00068 /**********************************************************/ 00069 00071 time_h time_get_time(void); 00072 00073 /**********************************************************/ 00074 00076 void time_reset(void); 00077 00078 /**********************************************************/ 00079 00081 void time_set(seconds s, microseconds us); 00082 00083 /**********************************************************/ 00084 00089 void time_wait_ms(uint16_t ms); 00090 00091 /**********************************************************/ 00092 00094 microseconds time_get_us2(void); 00095 00096 #endif