⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timer.h

📁 This library is Copyright (c) Raphael Zulliger <zulli@gmx.net>. It is licensed under the GNU L
💻 H
字号:
/***************************************************************************
                         timer.h  -  description
                             -------------------
    begin                : Fri May 17 2002
    copyright            : (C) 2002 by Raphael Zulliger
    email                : zulli@hsr.ch
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This library is Copyright (c) Raphael Zulliger <zulli@gmx.net>.       *
 *   It is licensed under the GNU Library General Public License (LGPL).   *
 *                                                                         *
 ***************************************************************************/


/***************************************************************************
 *                                                                         *
 *                                                                         *
 ***************************************************************************/

#ifndef __timer_h__
#define __timer_h__

#include <general.h>

/** Initialises the timer. This includes setting up the timer-interrupt,
 *  calculating the timer-interrupt registers, so every millisecond an 
 *  interrupt occures.
 */
void initTimer( void );

/** Resets the timer: In the ISR of the timer interrupt we have to set
 *  the timer interrupt registers to the correct value, so the next interrupt
 *  occures after another millisecond. This function sets this registers 
 *  to the correct values (calculated by initTimer)
 */
void resetTimer( void );

/** This function returns the correct value of the actual time. If the time
 *  would be read without this function, its possible to get the wrong time, 
 *  because the interrupt service routine could be executed during reading 
 *  this value, and the LSB of the time value is incremented, so an overflow 
 *  of the LSB occrues, and the program read the wrong value.\n
 *  This function calls itself (recursive) if it seams that the ISR was called
 *  during reading the time. 
 *  \param time The pointer to the variable thats points to the time that 
 *              should be used in the program
 */
WORD getTime( WORD* time );

/** This function sets the correct value of the actual time. If the time
 *  would be written without this function, its possible to set the wrong time, 
 *  because the interrupt service routine could be executed during writing 
 *  this value.\n
 *  This function calls itself (recursive) if it seams that the ISR was called
 *  during setting the time. 
 *  \param time The pointer to the variable thats points to the time that 
 *              should be set in the program
 *  \param value The time that should be set.
 */
void setTime( WORD* time, WORD value );

#endif // #define __timer_h__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -