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

📄 rtc_customer_legend.c

📁 MMI层OBJ不能完全编译
💻 C
字号:
/**************************************************************

         Rtc_driver_i.c file
         
         Designed by zoupeng For Legend Poloview HandSet

         DATA: 2002/4/12

         VERSION: 1.0

         Copyright belong to LEGEND
*****************************************************************/
#include "Rtc_customer_legend.h"

T_RVF_RET Rtc_Customer_Set_Time(T_RTC_DATE_TIME date_time);
T_RVF_RET Rtc_Customer_Get_Time(T_RTC_DATE_TIME* date_time);
T_RVF_RET Rtc_Customer_Set_Alarm_Time(T_RTC_DATE_TIME date_time);
T_RVF_RET Rtc_Customer_Get_Alarm_Time(T_RTC_DATE_TIME* date_time);
T_RVF_RET  Rtc_Customer_Disalbe_Alarm(void);
T_RVF_RET Rtc_Customer_Mode_Select(BOOL Hour_Mode);
BOOL Rtc_Customer_Read_Mode(void);

/***********************************************************************************************
/*typedef struct {	UINT8	second;		// seconds after the minute	- [0,59]  
						UINT8	minute;		// minutes after the hour		- [0,59]  
						UINT8	hour;			// hours after the midnight	- [0,23]  
						UINT8	day;			// day of the month				- [1,31]  
						UINT8	month;		// months							- [01,12] 
						UINT8	year;			// years								- [00,99] 
						UINT8	wday;			// days in a week					- [0,6] 
						BOOL	mode_12_hour;	// TRUE->12 hour mode ; FALSE-> 24 hour mode 
						BOOL	PM_flag;			// if 12 hour flag = TRUE
												TRUE->PM ; FALSE->AM 
					} T_RTC_DATE_TIME;
					

**********************************************************************************************/
/***************************************************************

                SET THE RTC HARDWARE TIME
        
***************************************************************/
T_RVF_RET Rtc_Customer_Set_Time(T_RTC_DATE_TIME date_time)
{
     T_RVF_RET Rtc_Return_Temp;

     Rtc_Return_Temp = RTC_SetDateTime(date_time);

     return Rtc_Return_Temp;      

}


/**********************************************************************

                  Get THE RTC HARDWARE TIME

***********************************************************************/
T_RVF_RET Rtc_Customer_Get_Time(T_RTC_DATE_TIME* date_time)
{
  T_RVF_RET Rtc_Return_Temp;

   Rtc_Return_Temp = RTC_GetDateTime(date_time);

//add by gaoshu 20051107 ,当时间向上越界时恢复至2000年1月1日
   if ( date_time->year > MMI_TIDA_END_YEAR_TWO_BIT) // year>2050
   {
        date_time->year = 00 ;//2000年
        RTC_SetDateTime(*date_time) ; 
   }
//add end 

   return Rtc_Return_Temp;      

}

/*************************************************************************

           Set THE RTC ALARM HARDWARE TIME

**************************************************************************/
T_RVF_RET Rtc_Customer_Set_Alarm_Time(T_RTC_DATE_TIME date_time)
{
     T_RV_RETURN	return_path = {	RVF_INVALID_ADDR_ID, NULL};
     T_RVF_RET Rtc_Return_Temp;
      
      Rtc_Return_Temp = RTC_SetAlarm(date_time,return_path);

     return Rtc_Return_Temp;

}

/*************************************************************************

         GET THE RTC ALARM HARDWARE TIME

*************************************************************************/
T_RVF_RET Rtc_Customer_Get_Alarm_Time(T_RTC_DATE_TIME* date_time)
{
   T_RVF_RET Rtc_Return_Temp;
   UINT8 Rtc_Alarm_Temp;
    
 #if (CHIPSET != 15)
    date_time->second = *(volatile UINT8*) RTC_ALARM_SECONDS_REG;
	date_time->minute = *(volatile UINT8*) RTC_ALARM_MINUTES_REG;
	date_time->hour =  *(volatile UINT8*) RTC_ALARM_HOURS_REG;
	date_time->day = *(volatile UINT8*) RTC_ALARM_DAYS_REG;
	date_time->month = *(volatile UINT8*) RTC_ALARM_MONTHS_REG;
	date_time->year = *(volatile UINT8*) RTC_ALARM_YEARS_REG;
	date_time->wday = * (volatile UINT8 *) RTC_WEEK_REG;

    if ( (*(volatile UINT8 *)RTC_CTRL_REG & RTC_MODE_12_24 ) == 0)
	{
		/* 24 hour mode */
		date_time->mode_12_hour = FALSE;
		date_time->PM_flag = FALSE;
	}
	else
	{
		/* 12 hour mode */
		date_time->mode_12_hour = TRUE;
		if ((*(volatile UINT8 *)RTC_HOURS_REG & 0x80) == 0)
			date_time->PM_flag = FALSE;
		else
			date_time->PM_flag = TRUE;
	}

    Rtc_Alarm_Temp = date_time->hour;
    Rtc_Alarm_Temp &=0x7f;
    date_time->hour = 10*(Rtc_Alarm_Temp>>4) + ( Rtc_Alarm_Temp & 0x0f);/*change the BCD CODE TO INT*/

    Rtc_Alarm_Temp = date_time->year;
    date_time->year = 10*(Rtc_Alarm_Temp>>4) + ( Rtc_Alarm_Temp & 0x0f);/*change the BCD code to int*/
#endif

    return RVF_OK;
}

/******************************************************************

                DISABLE THE RTC  ALARM

*******************************************************************/   
T_RVF_RET  Rtc_Customer_Disalbe_Alarm(void)
{
  T_RVF_RET Rtc_Return_Temp;
  
  Rtc_Return_Temp = RTC_UnsetAlarm();

  return Rtc_Return_Temp;  
}

/*******************************************************************

                   SET HOUR 12 OR 24 MODE
                   TRUE 12 MODE;
                   FALSE 24 MODE;

*********************************************************************/
T_RVF_RET Rtc_Customer_Mode_Select(BOOL Hour_Mode)
{
     RTC_Set12HourMode(Hour_Mode);

   return RVF_OK;
}

/*********************************************************************

                  READ RTC HOUR MODE
                  TRUE 12 MODE;
                  FALSE 24 MODE;

**********************************************************************/
BOOL Rtc_Customer_Read_Mode(void)
{
   BOOL Rtc_Hour_Mode;

  Rtc_Hour_Mode = RTC_Is12HourMode();

   return Rtc_Hour_Mode;

}  
   

⌨️ 快捷键说明

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