예제 #1
0
int f_mngDatetimeDone(unsigned *pMsg)
{
	//func_t func;
	
    switch(((msg_t *)pMsg)->msgType) 
	{
	case CMSG_INIT:
		g_tick = 0;
		SetTimer_irq(&g_timer[0], TIMER_1SEC, CMSG_TMR);
        
        All_Screen(0);	
		MDATETIME_READ("读出时间,存入到g_u8password[]中");	
        //g_u8menuNO = CDATETIME_MIN;			//数值索引   
    	//MDATETIME_GET(g_u8menuNO, g_u8pswordSel);
        //g_u8pswordSel = MBCD2HEX(g_u8pswordSel);
        
		DISP_GetOrSetDateTime(1);
		//DISP_line3rd_menu_select();				//第三行
		OLED_cleanPages(6, 7);	
		break;
			
	case CMSG_TMR:
		if(g_tick++ > 3) {
    		promptInit();
    		goto CGOTO_DATETIME_DONE;
		}
		break;
				
	case CMSG_DKEY:							/** 检测到按键按下 **/		
		switch(((msg_t *)pMsg)->msgValue)
		{	
		case CKEY_asterisk:
    		ledPrompt(10, TIMER_100MS);
    		promptInit();
    		beep();
    		goto CGOTO_DATETIME_DONE;
			break;
		
    	case CKEY_pound:	
    		ledPrompt(12, TIMER_100MS);
    		promptInit();
    		beep();
    	CGOTO_DATETIME_DONE:
    		g_tick = 0;
    		SetTimer_irq(&g_timer[0], TIMER_100MS, CMSG_INIT);
    		fstack_pop(&g_fstack);
    		fstack_pop(&g_fstack);
			break;	
            
		default:					/** 可能的错误 **/
			break;
		}
	default:						/** 可能的错误 **/
		break;
	}
	return	0;
#undef	CDATETIME_MIN
#undef	CDATETIME_MAX
}
예제 #2
0
/*******************************************************************************
 * Description: 开锁操作完成后,是否要查低电压报警
 * 低电报警
 *******************************************************************************/
int f_LowPowerAlarm(unsigned *pMsg)
{
//	msg_t msg;
    func_t func;

    switch(((msg_t *)pMsg)->msgType)
	{
	case CMSG_TMR:		/** 低电报警提示计时 **/
		g_tick++;
		if(g_tick >= 10)
		{
		GOTO_ALLOFF:
    		promptInit();
    		
			fstack_init(&g_fstack);
			func.func = f_idle;
    		fstack_push(&g_fstack, &func);
    		
    		g_tick = 0;
			SetTimer_irq(&g_timer[0], TIMER_1SEC, CMSG_TMR);
			//SetTimer_irq(&g_timer[0], TIMER_1SEC, CMSG_INIT);
			
    		All_Screen(0);
        	DISP_idle();
			/*******************************************************************/
		}
		break;
		
	case CMSG_INIT:
    	promptInit();
		g_tick = 0;
    	SetTimer_irq(&g_timer[0], TIMER_1SEC, CMSG_TMR);
    	
    	if(g_flag & (1 << 9)){		/** 查低电报警 **/
    		/** 报警提示 **/
    		vp_stor(CVOPID_POWERLOW);
    		promptDelay(TIMER_500MS);
    		
    		DISP_lowPower();
    	} else {
    		goto GOTO_ALLOFF;				/** 无报警动作,直接结束 **/
    	}
		break;

	case CPMT_OVER:							/** 锁体操作过程结束 **/
    	promptInit();
    	bbbeep();
    	promptDelay(TIMER_500MS);
		break;
			
	default:
		break;
	}
    return  0;
}
예제 #3
0
파일: oled.c 프로젝트: CorBiNO/Atomwear
void oled_test(void)
{
   //Reset_IC();                    
	Init_IC();                      
	Clear_Screen();
	All_Screen();					 
	

	OLED_Clear();
	OLED_ShowNum(0, 0, 2567890134, 10, 12);
	OLED_ShowString(0, 12, "abcdefghijk");
	
	while(1)
	{       
		OLED_Refresh_Gram();
		nrf_delay_ms(1500);
		Clear_Screen();
	}
}
예제 #4
0
/*******************************************************************************
 * 设置时间日期
 *******************************************************************************/
int f_mngDatetime(unsigned *pMsg)
{
#define	CDATETIME_MIN	0
#define	CDATETIME_MAX	(MTABSIZE(boundary_datetime) - 1)
	func_t func;
	
    switch(((msg_t *)pMsg)->msgType) 
	{
	case CMSG_INIT:
		g_tick = 0;
		SetTimer_irq(&g_timer[0], TIMER_1SEC, CMSG_TMR);
        
        All_Screen(0);
		//OLED_cleanPages(5, 5);		
		MDATETIME_READ("读出时间,存入到g_u8password[]中");	
        g_u8menuNO = CDATETIME_MIN;			//数值索引   
            
    	MDATETIME_COOKED(g_u8menuNO);
    	MDATETIME_GET(g_u8menuNO, g_u8pswordSel);
        g_u8pswordSel = MBCD2HEX(g_u8pswordSel);
        
		DISP_GetOrSetDateTime(1);
		DISP_line3rd_menu_select();				//第三行
		break;
			
	case CMSG_TMR:
		//SetTimer_irq(&g_timer[0], TIMER_1SEC, CMSG_TMR);
        DISP_SetDateTime_Blink(g_u8menuNO, (g_tick & 0x01), MHEX2BCD(g_u8pswordSel));
        
		g_tick++;
		if(g_tick > 10) {
			promptInit();
    		
    		g_tick = 0;
    		SetTimer_irq(&g_timer[0], TIMER_100MS, CMSG_INIT);
    		fstack_pop(&g_fstack);
		}
		break;
				
	case CMSG_DKEY:							/** 检测到按键按下 **/		
		switch(((msg_t *)pMsg)->msgValue)
		{	
    	case CKEY_2:
    		ledPrompt(2, TIMER_100MS);
    		promptInit();
    		beep();
    		
    		g_tick = 0;
			SetTimer_irq(&g_timer[0], TIMER_1SEC, CMSG_TMR);
			
    		g_u8pswordSel = value_dec(g_u8pswordSel, boundary_datetime[g_u8menuNO][1], boundary_datetime[g_u8menuNO][0]);
    		DISP_SetDateTime_Blink(g_u8menuNO, 0, MHEX2BCD(g_u8pswordSel));
			break;
			
    	case CKEY_8:
    		ledPrompt(8, TIMER_100MS);
    		promptInit();
    		beep();
    		
    		g_tick = 0;
			SetTimer_irq(&g_timer[0], TIMER_1SEC, CMSG_TMR);
			
    		g_u8pswordSel = value_inc(g_u8pswordSel, boundary_datetime[g_u8menuNO][1], boundary_datetime[g_u8menuNO][0]);
    		DISP_SetDateTime_Blink(g_u8menuNO, 0, MHEX2BCD(g_u8pswordSel));
			break;
			
		case CKEY_asterisk:
    		ledPrompt(10, TIMER_100MS);
    		promptInit();
    		beep();
    		
    		g_tick = 0;
    		SetTimer_irq(&g_timer[0], TIMER_100MS, CMSG_INIT);
    		fstack_pop(&g_fstack);
			break;
			
    	case CKEY_pound:
    		ledPrompt(12, TIMER_100MS);
    		promptInit();
    		beep();
    		
    		g_tick = 0;
			SetTimer_irq(&g_timer[0], TIMER_1SEC, CMSG_TMR);
			
    		MDATETIME_STORE(g_u8menuNO, MHEX2BCD(g_u8pswordSel));
    		DISP_SetDateTime_Blink(g_u8menuNO, 0, MHEX2BCD(g_u8pswordSel));
    		datetime_ByteWrite(boundary_datetime[g_u8menuNO][3], MHEX2BCD(g_u8pswordSel));
    		
    		g_u8menuNO++;
    		if(g_u8menuNO < CDATETIME_MAX) {
    			MDATETIME_COOKED(g_u8menuNO);
				MDATETIME_GET(g_u8menuNO, g_u8pswordSel);
        		g_u8pswordSel = MBCD2HEX(g_u8pswordSel);
        		DISP_SetDateTime_Blink(g_u8menuNO, 0, MHEX2BCD(g_u8pswordSel));			
    		} else {
    			MDATETIME_WRITE("写入到芯片");
    			
    			g_tick = 0;
    			SetTimer_irq(&g_timer[0], TIMER_100MS, CMSG_INIT);
    			
    			func.func = f_mngDatetimeDone;
    			fstack_push(&g_fstack, &func);
    		}
			break;	
            
		default:					/** 可能的错误 **/
			break;
		}
	default:						/** 可能的错误 **/
		break;
	}
	return	0;
#undef	CDATETIME_MIN
#undef	CDATETIME_MAX
}
예제 #5
0
/*******************************************************************************
 * 开锁方式
 *******************************************************************************/
int f_mngOpenMode(unsigned *pMsg)
{
#define	COPENMODE_MIN	0
#define	COPENMODE_MAX	2
	func_t func;
	
    switch(((msg_t *)pMsg)->msgType) 
	{
	case CMSG_INIT:
		g_tick = 0;
		SetTimer_irq(&g_timer[0], TIMER_1SEC, CMSG_TMR);
        
        g_u8menuNO = COPENMODE_MIN;
        
        All_Screen(0);
		DISP_menu_MNGSYS_line1st_OpenMode();	//第一行
		DISP_L2_menu_OpenModemng(g_u8menuNO);	//第二行
		OLED_cleanPages(5, 5);
		DISP_line3rd_menu_select();				//第三行
		break;
				
	case CMSG_DKEY:							/** 检测到按键按下 **/		
		switch(((msg_t *)pMsg)->msgValue)
		{	
    	case CKEY_2:
    		ledPrompt(2, TIMER_100MS);
    		promptInit();
    		beep();
    		g_u8menuNO = value_dec(g_u8menuNO, COPENMODE_MAX, COPENMODE_MIN);
    		DISP_L2_menu_OpenModemng(g_u8menuNO);
			break;
    	case CKEY_8:
    		ledPrompt(8, TIMER_100MS);
    		promptInit();
    		beep();
    		g_u8menuNO = value_inc(g_u8menuNO, COPENMODE_MAX, COPENMODE_MIN);
    		DISP_L2_menu_OpenModemng(g_u8menuNO);
			break;
			
		case CKEY_asterisk:
    		ledPrompt(10, TIMER_100MS);
    		promptInit();
    		beep();
    		
    		g_tick = 0;
    		SetTimer_irq(&g_timer[0], TIMER_100MS, CMSG_INIT);
    		fstack_pop(&g_fstack);
			break;
			
    	case CKEY_pound:
    		ledPrompt(12, TIMER_100MS);
    		promptInit();
    		beep();
    		
    		OpenMode_setValue(g_u8menuNO);
    		g_tick = 0;
    		SetTimer_irq(&g_timer[0], TIMER_100MS, CMSG_INIT);
    		func.func = f_mngOpenModeDone;
    		fstack_push(&g_fstack, &func);
			break;	
            
		default:					/** 可能的错误 **/
			break;
		}
	default:					/** 可能的错误 **/
		break;
	}
	return	0;
#undef	COPENMODE_MIN
#undef	COPENMODE_MAX
}