root / trunk / cardbox / timer.h @ 213
History | View | Annotate | Download (1.8 KB)
| 1 | /********
|
|---|---|
| 2 | * This file is part of Tooltron. |
| 3 | * |
| 4 | * Tooltron is free software: you can redistribute it and/or modify |
| 5 | * it under the terms of the Lesser GNU General Public License as published by |
| 6 | * the Free Software Foundation, either version 3 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * Tooltron is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * Lesser GNU General Public License for more details. |
| 13 | * You should have received a copy of the Lesser GNU General Public License |
| 14 | * along with Tooltron. If not, see <http://www.gnu.org/licenses/>. |
| 15 | * |
| 16 | * Copyright 2009 Kevin Woo <kwoo@2ndt.com> |
| 17 | * |
| 18 | ********/ |
| 19 | /** @file timer.h
|
| 20 | * |
| 21 | * @breif Timer functions |
| 22 | * |
| 23 | * @author Kevin Woo (kwoo) |
| 24 | */ |
| 25 | |
| 26 | #ifndef TIMER_H
|
| 27 | #define TIMER_H
|
| 28 | |
| 29 | /** @brief Max time that we can wait for a full packet from the server before we timeout */
|
| 30 | #define TIME_OUT 5 |
| 31 | |
| 32 | /** Globals **/
|
| 33 | volatile char seconds; //Seconds elapsed |
| 34 | volatile char minutes; //Minutes exlapsed |
| 35 | |
| 36 | /** @brief Seconds that have elapsed since the timer started */
|
| 37 | //extern volatile char seconds;
|
| 38 | /** @brief Minutes that have elapsed since the timer started */
|
| 39 | //extern volatile char minutes;
|
| 40 | //extern char timeout_flag;
|
| 41 | |
| 42 | /** @brief Sets the registers to use the timer for couting in real time */
|
| 43 | void init_timer(void); |
| 44 | /** @brief Starts the timer from last position*/
|
| 45 | void start_timer(void); |
| 46 | /** @brief Stops the timer from counting*/
|
| 47 | void stop_timer(void); |
| 48 | /** @brief Resets the values of the timer to 0*/
|
| 49 | void reset_timer(void); |
| 50 | /** @brief Resets the timeout flag to 0 */
|
| 51 | void reset_timeout_flag(void); |
| 52 | /** @brief Sets the timeout flag to 1 */
|
| 53 | void set_timeout_flag(void); |
| 54 | /** @brief Gets the timeout flag (nonzero means set) */
|
| 55 | char get_timeout_flag(void); |
| 56 | |
| 57 | #endif
|