timeout.c
来自「这是英贝德公司测9200rom的uhp程序」· C语言 代码 · 共 41 行
C
41 行
//*----------------------------------------------------------------------------
//* ATMEL Microcontroller Software Support - ROUSSET -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name : timeout.h
//* Object : 2 simple routines to handle timeout using AT91C_ST_CRTR register
//* Creation : ODi 01/06/2003
//*
//*----------------------------------------------------------------------------
#include "AT91RM9200.h"
#include "lib_AT91RM9200.h"
#include "timeout.h"
//*----------------------------------------------------------------------------
//* \fn AT91F_InitTimeout
//* \brief Start a timeout
//*----------------------------------------------------------------------------
void AT91F_InitTimeout(AT91PS_TIMEOUT pTimeout, unsigned int second)
{
pTimeout->tick = *(AT91C_ST_CRTR);
pTimeout->second = second;
}
//*----------------------------------------------------------------------------
//* \fn AT91F_TestTimeout
//* \brief Test a timeout, return 0 if the timeout is not reached
//*----------------------------------------------------------------------------
int AT91F_TestTimeout(AT91PS_TIMEOUT pTimeout)
{
if ((pTimeout->tick != *(AT91C_ST_CRTR)) && (pTimeout->second != 0)) {
pTimeout->tick = *(AT91C_ST_CRTR);
--(pTimeout->second);
}
return pTimeout->second;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?