📄 timerctrl.c
字号:
/*H*****************************************************************************
*
* $Archive:: $
* $Revision:: $
* $Date:: $
* $Author:: $
*
* DESCRIPTION: Timer delay code
*
* GLOBALS
*
* PUBLIC FUNCTIONS:
*
* PRIVATE FUNCTIONS:
*
* USAGE/LIMITATIONS:
*
* NOTES: Assumptions:
*
* COMPILE SWITCHES:
*
*H***************************************************************************/
#define timer_c
#define CHIP_6713
/*---- compilation control switches ----------------------------------------*/
/*****************************************************************************
* INCLUDE FILES
*****************************************************************************/
/*---- system and platform files -------------------------------------------*/
#include <stdlib.h>
#include <stdio.h>
#include <c6x.h>
/*---- program files -------------------------------------------------------*/
#include "csl.h"
#include "csl_timer.h"
/*****************************************************************************
* EXTERNAL REFERENCE
*****************************************************************************/
/*---- data declarations ---------------------------------------------------*/
/*---- function prototypes -------------------------------------------------*/
/*****************************************************************************
* PUBLIC DECLARATIONS
*****************************************************************************/
/*---- data declarations ---------------------------------------------------*/
TIMER_Handle hTimer = NULL;
/*****************************************************************************
* PRIVATE DECLARATIONS
*****************************************************************************/
/*---- context -------------------------------------------------------------*/
/*---- data declarations ---------------------------------------------------*/
/*---- function prototypes -------------------------------------------------*/
/*---- macros --------------------------------------------------------------*/
/*****************************************************************************
* PUBLIC FUNCTION DEFINITIONS
*****************************************************************************/
/*F***************************************************************************
* NAME: TIMER_Init()
*
* DESCRIPTION: Setup our timer that is used for all TEB examples.
*
* NOTES:
*
*F***************************************************************************/
void TIMER_Init(void)
{
TIMER_Config myTimerConfig;
hTimer = TIMER_open(TIMER_DEV0, TIMER_OPEN_RESET);
TIMER_getConfig( hTimer, &myTimerConfig);
myTimerConfig.ctl &= 0xff3f;
myTimerConfig.ctl |= 0x3c0;
myTimerConfig.prd = 0x200;
myTimerConfig.cnt = 0x00000000;
TIMER_config(hTimer, &myTimerConfig);
IRQ_enable(TIMER_getEventId(hTimer));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -