📄 calender.c
字号:
// str[1] = 0;
// }
// else
// {
// str[0] = ClkDay / 10 + '0';
// str[1] = ClkDay % 10 + '0';
// str[2] = 0;
// }
// strcat(s, str);
// strcat(s, ", ");
// sprintf(str,"%d",ClkYear);
// strcat(s, str);
// break;
//
// case 3:
// strcpy(s, "YYYY-MM-DD"); /* Create the template for the selected format */
// s[0] = year / 1000 + '0';
// year = year % 1000;
// s[1] = year / 100 + '0';
// year = year % 100;
// s[2] = year / 10 + '0';
// s[3] = year % 10 + '0';
// s[5] = ClkMonth / 10 + '0'; /* Convert DATE to ASCII */
// s[6] = ClkMonth % 10 + '0';
// s[8] = ClkDay / 10 + '0';
// s[9] = ClkDay % 10 + '0';
// break;
//
// default:
// strcpy(s, "?");
// break;
// }
//}
//#endif
///*
//*********************************************************************************************************
//* FORMAT CURRENT TIME INTO STRING
//*
//* Description : Formats the current time into an ASCII string.
//* Arguments : mode is the format type:
//* 1 will format the time as "HH:MM:SS" (24 Hour format)
//* (needs at least 9 characters)
//* 2 will format the time as "HH:MM:SS AM" (With AM/PM indication)
//* (needs at least 13 characters)
//* s is a pointer to the destination string. The destination string must be large
//* enough to hold the formatted time.
//* contain
//* Returns : None.
//* Notes : - A 'switch' statement has been used to allow you to add your own time formats.
//* - This function assumes that strcpy() is reentrant.
//*********************************************************************************************************
//*/
//void Clk_format_time (UCHAR mode, char *s)
//{
// UCHAR hr;
// switch (mode)
// {
// case 1:
// strcpy(s, "HH:MM:SS"); /* Create the template for the selected format */
// s[0] = ClkHr / 10 + '0'; /* Convert TIME to ASCII */
// s[1] = ClkHr % 10 + '0';
// s[3] = ClkMin / 10 + '0';
// s[4] = ClkMin % 10 + '0';
// s[6] = ClkSec / 10 + '0';
// s[7] = ClkSec % 10 + '0';
// break;
//
// case 2:
// strcpy(s, "HH:MM:SS AM"); /* Create the template for the selected format */
// s[9] = (ClkHr >= 12) ? 'P' : 'A'; /* Set AM or PM indicator */
// if (ClkHr > 12)
// { /* Adjust time to be displayed */
// hr = ClkHr - 12;
// }
// else
// {
// hr = ClkHr;
// }
// s[0] = hr / 10 + '0'; /* Convert TIME to ASCII */
// s[1] = hr % 10 + '0';
// s[3] = ClkMin / 10 + '0';
// s[4] = ClkMin % 10 + '0';
// s[6] = ClkSec / 10 + '0';
// s[7] = ClkSec % 10 + '0';
// break;
//
// default:
// strcpy(s, "?");
// break;
// }
//}
///*
//*********************************************************************************************************
//* UPDATE THE TIME
//*
//* Description : This function is called to update the time (i.e. hours, minutes and seconds)
//* Arguments : None.
//* Returns : TRUE if we have completed one day.
//* FALSE otherwise
//* Notes : This function updates ClkSec, ClkMin and ClkHr.
//*********************************************************************************************************
//*/
//static BOOL ClkUpdateTime (void)
//{
// BOOL newday;
//
// newday = FALSE; /* Assume that we haven't completed one whole day yet */
// ombro_nlasting --;
// if(ombro_nlasting <= 0)
// {
// //停止传送
// ombro_reset();
// ombro_continue = 0;
// ombro_sending = FALSE;
// }
// if (ClkSec >= 59)
// {
//
// /* See if we have completed one minute yet */
// ClkSec = 0; /* Yes, clear seconds */
// //ombro_save_flag(TRUE);
// if(ombro_continue > 0)
// {
// ombro_save_temp_min(ClkMin);
// ombro_save_temp_hour(ClkHr);
// }
//
// //ombro_save_val();
// if (ClkMin >= 59)
// { /* See if we have completed one hour yet */
// ClkMin = 0; /* Yes, clear minutes */
// if (ClkHr >= 23)
// { /* See if we have completed one day yet */
// ClkHr = 0; /* Yes, clear hours ... */
// newday = TRUE; /* ... change flag to indicate we have a new day */
//
// }
// else
// {
// ClkHr++; /* No, increment hours */
// }
//
// if(ClkHr == my_ombset.nBeginTime)
// {
// if(ombro_day > 0)
// storage_init();
// }
//
// }
// else
// {
// ClkMin++; /* No, increment minutes */
// }
// }
// else
// {
// ClkSec++; /* No, increment seconds */
// }
// return (newday);
//}
///*
//*********************************************************************************************************
//* SET TIME ONLY
//*
//* Description : Set the time-of-day clock
//* Arguments : hr is the desired hour (0..23)
//* min is the desired minutes (0..59)
//* sec is the desired seconds (0..59)
//* Returns : None.
//* Notes : It is assumed that you are specifying a correct time (i.e. there is no range checking
//* done by this function).
//*********************************************************************************************************
//*/
//void Clk_set_time (UCHAR hr, UCHAR min, UCHAR sec)
//{
// //ENTER_CRITICAL(); /* Gain exclusive access to time-of-day clock */
// ClkHr = hr;
// ClkMin = min;
// ClkSec = sec;
// //EXIT_CRITICAL(); /* Release access to time-of-day clock */
//}
///*
//*********************************************************************************************************
//* DETERMINE IF WE HAVE A LEAP YEAR
//*
//* Description : This function determines whether the 'year' passed as an argument is a leap year.
//* Arguments : year is the year to check for leap year.
//* Returns : TRUE if 'year' is a leap year.
//* FALSE if 'year' is NOT a leap year.
//*********************************************************************************************************
//*/
//#if CLK_DATE_EN
//static BOOL ClkIsLeapYear(UINT year)
//{
// if (!(year % 4) && (year % 100) || !(year % 400))
// {
// return TRUE;
// }
// else
// {
// return (FALSE);
// }
//}
//#endif
///*
//*********************************************************************************************************
//* SET DATE ONLY
//*
//* Description : Set the date of the time-of-day clock
//* Arguments : month is the desired month (1..12)
//* day is the desired day (1..31)
//* year is the desired year (CLK_TS_BASE_YEAR .. CLK_TS_BASE_YEAR+63)
//* Returns : None.
//* Notes : It is assumed that you are specifying a correct date (i.e. there is no range checking
//* done by this function).
//*********************************************************************************************************
//*/
//#if CLK_DATE_EN
//void Clk_set_date (UCHAR month, UCHAR day, UINT year)
//{
// //ENTER_CRITICAL();
// ClkMonth = month;
// ClkDay = day;
// ClkYear = year;
// ClkUpdateDOW();
// //EXIT_CRITICAL();
//}
//#endif
///*
//*********************************************************************************************************
//* SET DATE AND TIME
//*
//* Description : Set the date and time of the time-of-day clock
//* Arguments : month is the desired month (1..12)
//* day is the desired day (1..31)
//* year is the desired year (2xxx)
//* hr is the desired hour (0..23)
//* min is the desired minutes (0..59)
//* sec is the desired seconds (0..59)
//* Returns : None.
//* Notes : It is assumed that you are specifying a correct date and time (i.e. there is no range
//* checking done by this function).
//*********************************************************************************************************
//*/
//
//#if CLK_DATE_EN
//void Clk_set_date_time (UCHAR month, UCHAR day, UINT year, UCHAR hr, UCHAR min, UCHAR sec)
//{
// //ENTER_CRITICAL(); /* Gain exclusive access to time-of-day clock */
// ClkMonth = month;
// ClkDay = day;
// ClkYear = year;
// ClkHr = hr;
// ClkMin = min;
// ClkSec = sec;
// ClkUpdateDOW(); /* Compute the day of the week (i.e. Sunday ...) */
// //EXIT_CRITICAL(); /* Release access to time-of-day clock */
//}
//#endif
///*
//*********************************************************************************************************
//* UPDATE THE DATE
//*
//* Description : This function is called to update the date (i.e. month, day and year)
//* Arguments : None.
//* Returns : None.
//* Notes : This function updates ClkDay, ClkMonth, ClkYear and ClkDOW.
//*********************************************************************************************************
//*/
//#if CLK_DATE_EN
//static void ClkUpdateDate (void)
//{
// BOOL newmonth;
//
// newmonth = TRUE;
// if (ClkDay >= ClkMonthTbl[ClkMonth].MonthDays) { /* Last day of the month? */
// if (ClkMonth == 2) { /* Is this February? */
// if (ClkIsLeapYear(ClkYear) == TRUE) { /* Yes, Is this a leap year? */
// if (ClkDay >= 29) { /* Yes, Last day in february? */
// ClkDay = 1; /* Yes, Set to 1st day in March */
// } else {
// ClkDay++;
// newmonth = FALSE;
// }
// } else {
// ClkDay = 1;
// }
// } else {
// ClkDay = 1;
// }
// } else {
// ClkDay++;
// newmonth = FALSE;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -