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

📄 task_time.c

📁 CC1000 Rf modem C codes for philips sLpc213X ARM MCU.
💻 C
字号:

#include "config_GD61.h"
#include "include_GD61.h"
#include <stdio.h>

//////////////////////////////////////////////////////////////////////////////
TIMEACTION ActionTime[MAX_CONTROL_TABLE_NUM];

uint8 AutoLightCntMode;

uint8  MaxInputIICnt;
extern uint16 MaxInputLimitII;

extern CALENDAR CurrentTime;
extern uint16 TransferKKK;
extern uint16 ControlTime;

extern volatile char   TimerActSecTick;		// for timer_control function
extern volatile uint16 enTimerLightCnt;		// enable timer automatic function 
extern volatile uint16 CC1000ResetTimer;
extern volatile uint16 SysReadyTimer;
extern volatile uint16 MP_FailedmSecondCnt;	// for main power failed detector

extern uint16 ModuleAddress;				//module address
extern uint16 Pkg_SerialNum;				//serial number of package.
extern uint16 ActionValue;			//action value corresponding to action code.

//extern int32 CurInput_UU;
//extern int32 CurOutput_U;

//////////////////////////////////////////////////////////////////////////////

void CommandLightControl(uint16 ActValue);
void AutomaticLightControl(void);
void InitActTimer(void);
void TimerLigthScheduler(void);
void TimerReset(void);				////reset the system every day at HOUR:MIN

//////////////////////////////////////////////////////////////////////////////
// (Line_Num==PowerLine_ID)&&(DestinationAddr==ModuleAddress)
//////////////////////////////////////////////////////////////////////////////
//#define Light_toON	(0x20-1)				//0x1f
//#define Light_toOFF	(Light_toON-1)		//0x1e
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////
void TimerReset(void)		////reset the system every day at HOUR:MIN
{
char i;

//// CC1000 reset timer action
	if(CC1000ResetTimer == 0){
		CC1000ResetTimer = CC1000_TIMER_RESET_TIME;
		Uart0SendEnter();
		Uart0SendString("WatchDog re_initialize CC1000");
		RF_StartCC1000();
	}

////
	if(enTimerLightCnt==0){
		enTimerLightCnt = EN_TIMER_SCHEDULER_TIME;	// reset the timer_control time		
		Uart0SendString("WatchDog enable TimerLigthScheduler");
		for(i=0;i<MAX_CONTROL_TABLE_NUM;i++){		// maximum sub_line is 3
			ActionTime[i].ActionFlag=ENABLE_FLAG;
		}
	}

//// system reset timer action 	
	if(CurrentTime.xHOUR==WATCHDOG_RESET_SYS_HOUR){
		if(CurrentTime.xMIN==WATCHDOG_RESET_SYS_MIN){
//		    if((CurrentTime.xSEC & 0xfe) == 0x00){
		 	if( CurrentTime.xSEC         == 0x00){
				Uart0SendString("WatchDog  Reset System");
				RF_SendingOver();	Uart0SendingOver();
				WatchDogStart(20);	//20 ms Watchdog reset time
				while(1);			//wait for watchdog reset							
			}

		}
	}
}

////////////////////////////////////////////////////////////////////
//End Of File
////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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