63 lines
2.2 KiB
C
63 lines
2.2 KiB
C
#ifndef _STOP_IDLE_C_
|
|
#define _STOP_IDLE_C_
|
|
/*********************************************************************************************************************/
|
|
#include "ca51f5_config.h"
|
|
#include "../../includes/ca51f5sfr.h"
|
|
#include "../../includes/ca51f5xsfr.h"
|
|
#include "../../includes/gpiodef_f5.h"
|
|
|
|
#include "../../includes/system.h"
|
|
#include "../../Library/includes/stop_idle.h"
|
|
#include <intrins.h>
|
|
/*********************************************************************************************************************/
|
|
/******************************************************************************************
|
|
函数名:StopEnter
|
|
功能说明:进入STOP模式
|
|
输入参数:无
|
|
返回值: 无
|
|
******************************************************************************************/
|
|
void StopEnter(void)
|
|
{
|
|
PCON |= STOP;
|
|
_nop_();
|
|
_nop_();
|
|
}
|
|
|
|
/******************************************************************************************
|
|
函数名:CheckStopCondition
|
|
功能说明:检查进入STOP模式的条件(注:如果STPSTH、STPSTL不为0,即使执行STOP指令,芯片也不会进入STOP)
|
|
输入参数:无
|
|
返回值: 0:不能进入STOP; 1: 可以进入STOP
|
|
******************************************************************************************/
|
|
unsigned char CheckStopCondition(void)
|
|
{
|
|
if(STPST) return 0;
|
|
else return 1;
|
|
}
|
|
|
|
/******************************************************************************************
|
|
函数名: IdleEnter
|
|
功能说明:进入IDLE模式
|
|
输入参数:无
|
|
返回值: 无
|
|
******************************************************************************************/
|
|
void IdleEnter(void)
|
|
{
|
|
PCON |= IDLE;
|
|
_nop_();
|
|
_nop_();
|
|
}
|
|
|
|
/******************************************************************************************
|
|
函数名:CheckIdleCondition
|
|
功能说明:检查进入IDLE模式的条件(注:如果IDLSTH、IDLSTL不为0,即使执行IDLE指令,芯片也不会进入IDLE)
|
|
输入参数:无
|
|
返回值: 0:不能进入IDLE; 1: 可以进入IDLE
|
|
******************************************************************************************/
|
|
unsigned char CheckIdleCondition(void)
|
|
{
|
|
if(IDLST) return 0;
|
|
else return 1;
|
|
}
|
|
/*********************************************************************************************************************/
|
|
#endif |