Esempio n. 1
0
/* ===================================================================*/
static void realdate2str(char* str) {
	char s[20];

	LDD_RTC_TTime timePtr;

	RTC1_GetTime(NULL, &timePtr);

	strcpy(str, "");
	if (imperialUnits) {
		// imperial units
		itoa2(timePtr.Month, s);
		strcat(str, s);
		strcat(str, "/");
		itoa2(timePtr.Day, s);
		strcat(str, s);
		strcat(str, "/");
		ltoa(timePtr.Year, s);
		strcat(str, s);
	} else {
		// metric units
		itoa2(timePtr.Day, s);
		strcat(str, s);
		strcat(str, ".");
		itoa2(timePtr.Month, s);
		strcat(str, s);
		strcat(str, ".");
		ltoa(timePtr.Year, s);
		strcat(str, s);
	}
}
Esempio n. 2
0
/* ===================================================================*/
static void realtime2str(char* str) {
	char s[20];
	char ampm[4] = "";

	LDD_RTC_TTime timePtr;

	RTC1_GetTime(NULL, &timePtr);

	strcpy(str, "");
	if (imperialUnits) {
		// imperial units
		if (timePtr.Hour > 12) {
			itoa2(timePtr.Hour - 12, s);
			strcpy(ampm, " pm");
		} else {
			itoa2(timePtr.Hour, s);
			strcpy(ampm, " am");			
		}
		strcat(str, s);
	} else {
		// metric units
		itoa2(timePtr.Hour, s);
		strcat(str, s);
	}
	
	strcat(str, ":");
	itoa2(timePtr.Minute, s);
	strcat(str, s);
	strcat(str, ":");
	itoa2(timePtr.Second, s);
	strcat(str, s);

	strcat(str, ampm);	
}
Esempio n. 3
0
/*
** ===================================================================
**     Event       :  TmDt1_OnDateGet (module Events)
**
**     Component   :  TmDt1 [GenericTimeDate]
**     Description :
**         called in the event of a date get
**     Parameters  :
**         NAME            - DESCRIPTION
**       * day             - Pointer to the day, can be written in the
**                           event routine.
**       * month           - Pointer to the month, can be written
**                           in the event routine.
**       * year            - Pointer to the year, can be written in
**                           the event routine.
**     Returns     : Nothing
** ===================================================================
*/
void TmDt1_OnDateGet(uint8_t *day, uint8_t *month, uint16_t *year)
{
#if PL_USE_HW_RTC
  LDD_RTC_TTime timeDate;

  RTC1_GetTime(RTC1_DeviceData, &timeDate); /* get existing data */
  *day = timeDate.Day;
  *month = timeDate.Month;
  *year = timeDate.Year;
#endif
}
Esempio n. 4
0
/*
** ===================================================================
**     Event       :  TmDt1_OnTimeGet (module Events)
**
**     Component   :  TmDt1 [GenericTimeDate]
**     Description :
**         Called in the event of a new time get
**     Parameters  :
**         NAME            - DESCRIPTION
**       * hour            - Pointer to the hour, can be overwritten
**                           in the event routine.
**       * minute          - Pointer to the minute, can be
**                           overwritten in the event routine.
**       * second          - Pointer to the second, can be
**                           overwritten in the event routine.
**       * hSecond         - Pointer to the 0.01 second, can be
**                           overwritten in the event routine.
**     Returns     : Nothing
** ===================================================================
*/
void TmDt1_OnTimeGet(uint8_t *hour, uint8_t *minute, uint8_t *second, uint8_t *hSecond)
{
#if PL_USE_HW_RTC
  LDD_RTC_TTime timeDate;

  RTC1_GetTime(RTC1_DeviceData, &timeDate); /* get existing data */
  *hour = timeDate.Hour;
  *minute = timeDate.Minute;
  *second = timeDate.Second;
  *hSecond = 0; /* not used */
#endif
}
Esempio n. 5
0
/*
** ===================================================================
**     Event       :  TmDt1_OnDateSet (module Events)
**
**     Component   :  TmDt1 [GenericTimeDate]
**     Description :
**         called in the event of a date set
**     Parameters  :
**         NAME            - DESCRIPTION
**         day             - the new day
**         month           - the new month
**         year            - the new year
**     Returns     : Nothing
** ===================================================================
*/
void TmDt1_OnDateSet(uint8_t day, uint8_t month, uint16_t year)
{
#if PL_USE_HW_RTC
  LDD_RTC_TTime timeDate;

  RTC1_GetTime(RTC1_DeviceData, &timeDate); /* get existing data */
  timeDate.Day = day;
  timeDate.Month = month;
  timeDate.Year = year;
  RTC1_SetTime(RTC1_DeviceData, &timeDate); /* store back information */
#endif
}
Esempio n. 6
0
/*
** ===================================================================
**     Event       :  TmDt1_OnTimeSet (module Events)
**
**     Component   :  TmDt1 [GenericTimeDate]
**     Description :
**         Called in the event of a new time set
**     Parameters  :
**         NAME            - DESCRIPTION
**         hour            - The new hour
**         minute          - The new minute
**         second          - The new second
**         hSecond         - The new 0.01 second part
**     Returns     : Nothing
** ===================================================================
*/
void TmDt1_OnTimeSet(uint8_t hour, uint8_t minute, uint8_t second, uint8_t hSecond)
{
#if PL_USE_HW_RTC
  LDD_RTC_TTime timeDate;

  (void)hSecond; /* not used */
  RTC1_GetTime(RTC1_DeviceData, &timeDate); /* get existing data */
  timeDate.Hour = hour;
  timeDate.Minute = minute;
  timeDate.Second = second;
  RTC1_SetTime(RTC1_DeviceData, &timeDate); /* store back information */
#endif
}