📄 tmr1.h
字号:
/***************************************************************************
* This code and information is provided "as is" without warranty of any *
* kind, either expressed or implied, including but not limited to the *
* implied warranties of merchantability and/or fitness for a particular *
* purpose. *
* *
* Copyright (C) 2005 Teridian Semiconductor Corp. All Rights Reserved. *
***************************************************************************/
//**************************************************************************
//
// DESCRIPTION: 71M651x POWER METER - Timer Routines.
// NOTE: timer 1 is not available on the 6520 models
//
// AUTHOR: RGV
//
// HISTORY: See end of file
//
//**************************************************************************
//
// File: tmr1.h
//
#ifndef TMR1_H
#define TMR1_H 1
/*** Public functions declared within this module ***/
// fixed point math that can't overflow, and is more accurate
// at higher clock rates. A reasonable compiler will do the
// math at compile time, leaving a constant.
#undef milliseconds2tmr_reg
#define milliseconds2tmr_reg(_v_) \
(UINT16_MAX - (uint16_t)((((uint32_t)_v_ * (CLK_FREQ/75)) + 80L)/160L))
#undef microseconds2tmr_reg
// assumes a 4.9MHz clock
#define microseconds2tmr_reg(_v_) \
(UINT16_MAX - (uint16_t)((((uint32_t)_v_ * 290L) + 145L)/59L))
// start timer 1; this is used in stm.c
// reload_reg is the value for the reload register. The macro above
// will calculate it from milliseconds
// restart s/b TRUE if the routine pfn should run repeatedly, FALSE for once
// pfn is a routine that the interrupt will run. It should be reentrant.
void tmr1_start (uint16_t reload_reg, uint8_t restart, void (*pfn) (void)) small reentrant;
#undef tmr_start
#define tmr_start(_r_, _b_, _pfn_) tmr1_start(_r_, _b_, _pfn_)
#define tmr1_stop() TR1 = FALSE
#undef tmr_stop
#define tmr_stop() TR1 = FALSE
#define tmr1_running() TR1
#undef tmr_running
#define tmr_running() TR1
#define tmr1_enable() ET1 = TRUE
#undef tmr_enable
#define tmr_enable() ET1 = TRUE
#define tmr1_disable() ET1 = FALSE
#undef tmr_disable
#define tmr_disable() ET1 = FALSE
/***************************************************************************
* History:
* $Log: tmr1.h,v $
* Revision 1.11 2006/09/09 01:10:15 gmikef
* *** empty log message ***
*
* Revision 1.10 2006/08/09 00:56:37 tvander
* *** empty log message ***
*
* Revision 1.8 2005/09/22 23:45:09 tvander
* Clean build all models and unit tests, updated copyright to be fore Teridian
*
* Revision 1.7 2005/08/28 02:17:09 gmikef
* *** empty log message ***
*
* Revision 1.6 2005/08/10 21:40:49 tvander
* *** empty log message ***
*
* Revision 1.5 2005/05/13 00:34:41 tvander
* 6511/32k works
* Integrated and debugged self-calibration.
* The build has one unused segment, and no other errors or warnings.
* default LCD and pulse displays appear OK.
* EEPROM, software timers and hardware timers are all integrated.
*
* Revision 1.4 2005/05/03 00:39:45 tvander
* Incorporated event reporting in tmr0,tmr1 and unit tests.
* Retested stm, trm0, tmr1.
* Incorporated untested changes in io651x.h
*
* Revision 1.3 2005/04/25 19:15:32 tvander
* tested hardware timer code
*
* Revision 1.2 2005/04/21 02:01:57 gmikef
* *** empty log message ***
*
* Revision 1.4 2005/04/09 02:04:27 gmikef
* *** empty log message ***
*
* Revision 1.1 2005/03/23 19:19:33 tvander
* Added untested timer functions.
* Updated iicdio and iiceep to reflect improvements in 6510 code.
* ser0 and ser1 updated to provide features for flag.
*
* Revision 1.4 2005/03/08 19:06:53 tvander
* Self calibration in all software models
*
* Revision 1.2 2005/02/17 18:32:40 tvander
* Added automatic check-in logging to all source code.
*
* Copyright (C) 2005 Teridian Semiconductor Corp. All Rights Reserved. *
* this program is fully protected by the United States copyright *
* laws and is the property of Teridian Semiconductor Corporation. *
***************************************************************************/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -