コード例 #1
0
ファイル: TimeViewer.cpp プロジェクト: yongxiu/sudoku
void CTimeViewer::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: Add your message handler code here and/or call default

	m_sTime ++;
	if(m_sTime == 60)
	{
		m_sTime = 0;
		m_mTime ++;
		if(m_mTime == 60)
		{
			m_hTime ++;
			SetSecond();
			SetHour();
			SetMinute();
		}
		else
		{
			SetMinute();
			SetSecond();
		}
	}
	else
	{
		SetSecond();
	}
	CWnd::OnTimer(nIDEvent);
}
コード例 #2
0
ファイル: rtc.c プロジェクト: SCUT-Mida/Airpurifier
void SetCalenderTime(CalenderTime *ct)
{
	SetYear(ct->year);
	SetMonth(ct->month);
	SetDate(ct->date);
	SetHour(ct->hour);
	SetMinute(ct->minute);
	SetSecond(ct->second);
//	RtcDisableWrite();
}
コード例 #3
0
ファイル: cevtime.hpp プロジェクト: medusade/mxde
 ///////////////////////////////////////////////////////////////////////
 // Function: SetTime
 //
 //   Author: $author$
 //     Date: 6/21/2009
 ///////////////////////////////////////////////////////////////////////
 virtual EvError SetTime
 (const EvTime& time,
  bool is12=false,
  bool isPM=false,
  bool isLocal=false,
  const EvTimezone* timezone=0) 
 {
     EvError error = EV_ERROR_NONE;
     SetHour(time.GetHour(isPM));
     SetMinute(time.GetMinute());
     SetSecond(time.GetSecond());
     SetMillisecond(time.GetMillisecond());
     return error;
 }
コード例 #4
0
void CDate_std::SetToTime(const CTime& time, CDate::EPrecision prec)
{
    switch (prec) {
    case CDate::ePrecision_second:
        SetSecond(time.Second());
        SetMinute(time.Minute());
        SetHour  (time.Hour());
        // fall through
    case CDate::ePrecision_day:
        SetDay   (time.Day());
        SetMonth (time.Month());
        SetYear  (time.Year());
        break;
    default:
        break;
    }
}
コード例 #5
0
ファイル: lgui.c プロジェクト: unregistered/lg-activate
void SettingsSetTimeScreen::loop()
{
    return;
    int x = getTouchX();
    int y = getTouchY();

    // TODO
    if (x>54 && x<88) {
        //-
        if (y>6 && y<27) {
            // month
            uint8_t month = GetMonth();
            uint8_t next_month = month - 1;
            if(month == 0)
                next_month = 12;

            SetMonth(next_month);
            renderMonth();
        }
        if (y>40 && y<61) {
            // day
            uint8_t day = GetDate();
            uint8_t next_day = day - 1;
            if(day == 0)
                next_day = 31;

            SetMonth(next_day);
            renderDay();
        }
        if (y>73 && y<94) {
            // yr
            uint8_t year = GetYear();
            uint8_t next_year = year - 1;
            SetYear(next_year);
            renderYear();
        }
        if (y>106 && y<127) {
            // hr
            uint8_t hour = GetHour();
            uint8_t next_hour = hour - 1;
            SetHour(next_hour);
            renderHour();
        }
        if (y>140 && y<161) {
            // min
            uint8_t minute = GetMinute();
            uint8_t next_minute = minute - 1;
            SetMinute(next_minute);
            renderMinute();
        }
        if (y>173 && y<194) {
            // am/pm
            uint8_t ampm = GetAmPm();
            SetAmPm(~ampm);
        }

    }
    if (x>104 && x<138) {
        //+
        if (y>6 && y<27) {
            // month
        }
        if (y>40 && y<61) {
            // day
        }
        if (y>73 && y<94) {
            // yr
        }
        if (y>106 && y<127) {
            // hr
        }
        if (y>140 && y<161) {
            // min
        }
        if (y>173 && y<194) {
            // am/pm
        }
    }
}
コード例 #6
0
ファイル: CTaskSure.c プロジェクト: yjduoduo/LPC1768_V1.3
//################################################################################################################################
//--------------------------------------------------------------------------------------------------------------------------------
//函数名称:CLevel21_Sure()
//--------------------------------------------------------------------------------------------------------------------------------
//函数功能:确认键的第二层第一个任务
//--------------------------------------------------------------------------------------------------------------------------------
//输入参数:	tmp为第几个按键的值
//--------------------------------------------------------------------------------------------------------------------------------
//输出参数:	null
//--------------------------------------------------------------------------------------------------------------------------------
//说   明:
//--------------------------------------------------------------------------------------------------------------------------------
//################################################################################################################################
void CLevel21_Sure(uint8 tmp)
{
// 	uint8 j;
	PCF8563_DATE    timeAndDate;
	switch(tmp)
	{
		case 1:
			ClearScreen(0);		
			SetLocalAddr(0,(GetSendToF(0)/100));
			SetLocalAddr(1,(GetSendToF(0)%100/10));
			SetLocalAddr(2,(GetSendToF(0)%10));
			SetLocalDepSum(GetSendToF(1));
			if((100*GetLocalAddr(0)+10*GetLocalAddr(1)+GetLocalAddr(2))>CIRCOUNT)
			{
				SetLocalAddr(0,0);
				SetLocalAddr(1,0);
				SetLocalAddr(2,0);
			}
		if(GetLocalDepSum()>DEPART)
			SetLocalDepSum(0);
			Local_Menu(GetLocalAddr(0),GetLocalAddr(1),GetLocalAddr(2),GetLocalDepSum(),1,0);
			break;
		case 2:
			ClearScreen(0);
// 			SetCompRegDep(SSP1_Read_1Byte(2));
// 			SetCompRegAddr(SSP1_Read_1Byte(13));
// 			GetRegNum(GetCompRegDep());
			if(GetCompRegDep()>DEPART)
				SetCompRegDep(0);
			if(GetCompRegNum()>DEPARTCOM)
				SetCompRegDep(0);
			if(GetCompRegAddr()>CIRADDRESS)
				SetCompRegAddr(0);
			CompReg_menu(GetCompRegDep(),GetCompRegNum(),0,GetCompRegAddr(),1,0);
// 			CompReg_menu(GetCompRegDep(),GetCompRegNum(),0,GetCompRegDep(),1,0);
			SetComRegFlag(1);
			NVIC_DisableIRQ(EINT3_IRQn); 
			break;
		case 3:
			ClearScreen(0);
			CompSet_Menu(GetCompSetDep(),GetCompSetNum(),GetComSetSelSet(),1,0);
			break;
		case 4:
			PCF8563_Read(&timeAndDate);    
			SetYear(timeAndDate.year);
			SetMonth(timeAndDate.month);
			SetDay(timeAndDate.day);
			SetHour(timeAndDate.hour);
			SetMintue(timeAndDate.minute);
			SetSecond(timeAndDate.second);
			ClearScreen(0);
			DateMod_Menu(GetYear(),GetMonth(),GetDay(),GetHour(),GetMintue(),GetSecond(),1,0);
			break;
// 		case 5:
// 			ClearScreen(0);
// 			Annotate_Menu(GetAnnDep(),GetAnnCompNum(),1);
// 			SetAnnUartFlag(1);
// 			break;
		case 5:
			ClearScreen(0);
			Waiting_menu();
			EndInt(); 
			SendDataToFlash();
			CSendPSNToFlash();
			SaveMaskPSN();
			CSaveAnn();
			StartInt();		
			ClearScreen(0);		
			CSaveInfo();
			break;
// 		case 7:
// 			
// 			break;
		default:break;
	}
}
コード例 #7
0
// This runs once during program startup
void Controller::setup()
{
	// Setup code here
    LGSerial::init();
    LGSerial::put("Hello World!");

	DDRC |= 1 << DDC2;//trigger
	DDRC |= 1 << DDC3;//pc3 pin 26 for output
	DDRC |= 1 << DDC4;
	DDRC |= 1 << DDC5;
	DDRD |= 1 << DDD0;

	PORTD &= ~(1 << PD0);
	PORTC &= ~(1 << PC2);
	PORTC &= ~(1 << PC3);
	_delay_ms(500);

	ClockInit();


	SetSecond(1);
	SetMinute(33);
	SetHour(8);
	SetAmPm(1);///0 for AM, 1 for PM
	SetDay(3);
	SetDate(23);
	SetMonth(4);
	SetYear(13);

	char Time[12];	//hh:mm:ss AM/PM

	while(0)
	{
		//Get the Current Time as a String
		if(!GetTimeString(Time))//modifies time
		{
			/*
			 If return value is false then some error has occured

			 Check
			 ->DS1307 Installed Properly
			 ->DIP Switch 1,2 are in on position
			 */
			while(1);//halt
		}
		_delay_ms(500);
	}

	uint8_t second = GetSecond();
	uint8_t minute = GetMinute();
	uint8_t hour = GetHour();
	uint8_t AmPm = GetAmPm();
	uint8_t day = GetDate();
	uint8_t date = GetDate();
	uint8_t month = GetMonth();
	uint8_t year = GetYear();


	LGSerial::print(second);
	LGSerial::print(minute);
	LGSerial::print(hour);
	LGSerial::print(AmPm);
	LGSerial::print(day);
	LGSerial::print(date);
	LGSerial::print(month);
	LGSerial::print(year);

	_delay_ms(20000);
	second = GetSecond();
	minute = GetMinute();
	LGSerial::print(second);
	LGSerial::print(minute);

	_delay_ms(20000);
	second = GetSecond();
	minute = GetMinute();
	LGSerial::print(second);
	LGSerial::print(minute);



	//uint8_t minute = GetMinute();
//uint8_t minute = 0xAA;
//	bool min[8];
/*
	min[0] = minute & 0x01;
	min[1] = minute & 0x02;
	min[2] = minute & 0x04;
	min[3] = minute & 0x08;
	min[4] = minute & 0x10;
	min[5] = minute & 0x20;
	min[6] = minute & 0x40;
	min[7] = minute & 0x80;
*/

	/*
	 min[0] = 0;
	 min[1] = 1;
	 min[2] = 0;
	 min[3] = 1;
	 min[4] = 0;
	 min[5] = 1;
	 min[6] = 0;
	 min[7] = 1;
	 */

	/*

	int i = 0;

	while(1){
		//make pc2 trigger
		PORTC |= 1 << PC2;
		PORTC &= ~(1 << PC2);

		PORTC |= 1 << PC3;
		PORTC &= ~(1 << PC3);
		PORTC |= 1 << PC3;
		PORTC &= ~(1 << PC3);
		PORTC |= 1 << PC3;
		PORTC &= ~(1 << PC3);

		for (i=0;i<8;i++){
			if (min[i] == 1){	//if that bit of min is 1
				PORTD |= 1 << PD0;
				PORTD &= ~(1 << PD0);
				PORTD |= 1 << PD0;
				PORTD &= ~(1 << PD0);

				PORTC &= ~(1 << PC3);
				PORTC |= 1 << PC3;
				PORTC &= ~(1 << PC3);


			}
			else {//if (min[i] == 0){	//if that bit of min is 0
				PORTD |= 1 << PD0;
				PORTD &= ~(1 << PD0);

				PORTC |= 1 << PC3;
				PORTC &= ~(1 << PC3);
				PORTC |= 1 << PC3;

			}
		}

	}
	*/
}
コード例 #8
0
void CTime::SetTime(int hour, int minute, int second)
{
	SetHour(hour);
	SetMinute(minute);
	SetSecond(second);
}
コード例 #9
0
CTime::CTime(int hour, int minute, int second) : m_hour(0), m_minute(0), m_second(0)
{
	SetHour(hour);
	SetMinute(minute);
	SetSecond(second);
}