• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ RTC_Init函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中RTC_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ RTC_Init函数的具体用法?C++ RTC_Init怎么用?C++ RTC_Init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了RTC_Init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: RTC_Start

void RTC_Start(){
	if(RTC_SR == RTC_SR_TCE_MASK){ // If RTC clock is already running
		RTC = RTC_Init(NULL, true); // Initialise the RTC softly
	}else{
		RTC = RTC_Init(NULL, false); // Initialise the RTC hard (reset time/date etc.)
		for(uint8 i = 0; i < 4; i++){
			LED_Red_On();
			DelayMs(500);
			LED_Red_Off();
			DelayMs(500);
		}
	}
}
开发者ID:SeismicPi,项目名称:SeismicPi,代码行数:13,代码来源:HAL_RTC.cpp


示例2: RTC_Configuration

/**
* @brief  Configures the RTC peripheral.
* @param  None
* @retval None
*/
int8_t RTC_Configuration(void)
{

  RTC_Error = 0;
  /* Enable the PWR clock */
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);

  /* Allow access to RTC */
  PWR_BackupAccessCmd(ENABLE);

/* LSI used as RTC source clock */
/* The RTC Clock may varies due to LSI frequency dispersion. */   
  /* Enable the LSI OSC */ 
 // RCC_LSICmd(ENABLE);
	RCC_LSEConfig(RCC_LSE_ON);

  /* Wait till LSI is ready */  
  //while(RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET)
	while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
  {
  }

  /* Select the RTC Clock Source */
  //RCC_RTCCLKConfig(RCC_RTCCLKSource_LSI);
	RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
   
  /* Enable the RTC Clock */
  RCC_RTCCLKCmd(ENABLE);
  
    /* Wait for RTC APB registers synchronisation */
  RTC_WaitForSynchro();
	
	//RTC_WaitForLastTask();
  
  /* Calendar Configuration with LSI supposed at 32KHz */
  RTC_InitStructure.RTC_AsynchPrediv = 0x7F;
  RTC_InitStructure.RTC_SynchPrediv	=  0xFF; /* (32KHz / 128) - 1 = 0xFF*/
  RTC_InitStructure.RTC_HourFormat = RTC_HourFormat_24;
  RTC_Init(&RTC_InitStructure);  

  /* Get the LSI frequency:  TIM5 is used to measure the LSI frequency */
  //LsiFreq = GetLSIFrequency();
   
  /* Adjust LSI Configuration */
  RTC_InitStructure.RTC_AsynchPrediv = 0x7F;
  //RTC_InitStructure.RTC_SynchPrediv	=  (LsiFreq/128) - 1;
	RTC_InitStructure.RTC_SynchPrediv	= (32767/128) - 1;
  RTC_InitStructure.RTC_HourFormat = RTC_HourFormat_24;
  RTC_Init(&RTC_InitStructure);
  return RTC_Error;
}
开发者ID:ShaohuiZhu,项目名称:Haier-1,代码行数:56,代码来源:rtc.c


示例3: rtcSetup

void rtcSetup(){
	RTC_Init_TypeDef rtcInit = RTC_INIT_DEFAULT;

	/* Enabling clock to LE configuration register */
	CMU_ClockEnable(cmuClock_CORELE, true);

	/* Selecting crystal oscillator to drive LF clock */
	CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);

	/* 32 clock division to save energy */
	CMU_ClockDivSet(cmuClock_RTC, cmuClkDiv_32768);

	/* Providing clock to RTC */
	CMU_ClockEnable(cmuClock_RTC, true);

	/* Initialize RTC */
	rtcInit.enable   = false;  /* Do not start RTC after initialization is complete. */
	rtcInit.debugRun = false;  /* Halt RTC when debugging. */
	rtcInit.comp0Top = true;   /* Wrap around on COMP0 match. */
	RTC_Init(&rtcInit);

	/* Interrupt every minute */
	RTC_CompareSet(0, ((RTC_FREQ / CLOCK_DIVISION) * 10 ) - 1 );

	/* Enable interrupt */
	NVIC_EnableIRQ(RTC_IRQn);
	RTC_IntEnable(RTC_IEN_COMP0);

	/* Start Counter */
	RTC_Enable(true);

}
开发者ID:kairobert,项目名称:forget-me-not,代码行数:32,代码来源:rtc.cpp


示例4: RTC_Setup

/***************************************************************************//**
 * @brief Enables LFACLK and selects osc as clock source for RTC
 ******************************************************************************/
void RTC_Setup(CMU_Select_TypeDef osc)
{
  RTC_Init_TypeDef init;

  /* Ensure LE modules are accessible */
  CMU_ClockEnable(cmuClock_CORELE, true);

  /* Enable osc as LFACLK in CMU (will also enable oscillator if not enabled) */
  CMU_ClockSelectSet(cmuClock_LFA, osc);

  /* No division prescaler to increase accuracy. */
  CMU_ClockDivSet(cmuClock_RTC, cmuClkDiv_1);

  /* Enable clock to RTC module */
  CMU_ClockEnable(cmuClock_RTC, true);

  init.enable   = false;
  init.debugRun = false;
  init.comp0Top = true; /* Count only to top before wrapping */
  RTC_Init(&init);
  
  RTC_CompareSet(0, ((LFRCOFREQ * WAKEUP_US) / 1000000));
    
  /* Disable interrupt generation from RTC0, is enabled before each sample-run. */
  RTC_IntDisable(_RTC_IF_MASK);
  
  /* Enable interrupts in NVIC */
  NVIC_ClearPendingIRQ(RTC_IRQn);
  NVIC_EnableIRQ(RTC_IRQn);  
}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:33,代码来源:main_adc_em2_interrupt.c


示例5: lp_ticker_init

void lp_ticker_init()
{
    core_util_critical_section_enter();
    if (!rtc_inited) {
        CMU_ClockEnable(cmuClock_RTC, true);

        /* Initialize RTC */
        RTC_Init_TypeDef init = RTC_INIT_DEFAULT;
        init.enable = 1;
        /* Don't use compare register 0 as top value */
        init.comp0Top = 0;

        /* Initialize */
        RTC_Init(&init);
        RTC_CounterSet(20);

        /* Enable Interrupt from RTC */
        RTC_IntDisable(RTC_IF_COMP0);
        RTC_IntClear(RTC_IF_COMP0);
        NVIC_SetVector(RTC_IRQn, (uint32_t)RTC_IRQHandler);
        NVIC_EnableIRQ(RTC_IRQn);

        rtc_inited = true;
    } else {
        /* Cancel current interrupt by virtue of calling init again */
        RTC_IntDisable(RTC_IF_COMP0);
        RTC_IntClear(RTC_IF_COMP0);
    }
    core_util_critical_section_exit();
}
开发者ID:sg-,项目名称:mbed-os,代码行数:30,代码来源:lp_ticker.c


示例6: Init

void Init() {
    PWR_Init();
    CLOCK_Init();
    UART_Initialize();
    printf("Start\n");
    Initialize_ButtonMatrix();
    SPIFlash_Init(); //This must come before LCD_Init() for 7e

    LCD_Init();
    CHAN_Init();

    SPITouch_Init();
    SOUND_Init();
    BACKLIGHT_Init();
    BACKLIGHT_Brightness(1);
    AUTODIMMER_Init();
    SPI_FlashBlockWriteEnable(1); //Enable writing to all banks of SPIFlash

    PPMin_TIM_Init();
#ifdef MODULAR
    //Force protocol to none to initialize RAM
    Model.protocol = PROTOCOL_NONE;
    PROTOCOL_Init(1);
#endif
#if HAS_RTC
    RTC_Init();        // Watchdog must be running in case something goes wrong (e.g no crystal)
#endif
}
开发者ID:theseankelly,项目名称:deviation,代码行数:28,代码来源:main.c


示例7: startRTCTick

/******************************************************************************
 * @brief 
 *   Configures and starts RTC from ULFRCO
 *****************************************************************************/
void startRTCTick(void)
{
  /* Set-up RTC init struct */
  RTC_Init_TypeDef rtcInit;
  rtcInit.comp0Top = true;
  rtcInit.debugRun = false;
  rtcInit.enable = true;
  
  /* Enable clock to LF peripherals */
  CMU_ClockEnable(cmuClock_CORELE, true);

  /* Set ULFRCO as clock source for RTC */
  CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_ULFRCO);

  /* Turn on clock for RTC */
  CMU_ClockEnable(cmuClock_RTC, true);

  /* Enable RTC interrupt lines */
  NVIC_EnableIRQ(RTC_IRQn);
  RTC_IntEnable(RTC_IF_COMP0);

  /* Set compare register */
  RTC_CompareSet(0, MS_TO_SLEEP);

  /* Initialize and start RTC */
  RTC_Init(&rtcInit);
}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:31,代码来源:lfxo_startup.c


示例8: main

  int main(void)
 {
	 u8 t=0;	
	 u16 Time=0,dis_pre=0;
	 float V_ave;	//平均速度
	 char code_ave[5],code_v[5],code_vr[5], mileage[5];//信息储存数组
	 
	delay_init(72);	    	 			//延时函数初始化	  
	Stm32_Clock_Init(9);		  //系统时钟设置
	uart_init(72,9600);	 	 		  //串口初始化为9600
	usmart_dev.init(72);			//初始化USMART	
	EXTIX_Init();							//外部中断初始化
	TIM3_Int_Init(5000,7199); //10Khz的计数频率,计数到5000为500ms 
	LCD_Init();				 				//  PE.ALL,PD1~5  
	LCD_Display_Dir(1);				//设置显示方向为横屏显示
	LED_Init();		  					//初始化与LED连接的硬件接口
	KEY_Init();								//初始化按键

		while(RTC_Init())
		{	//等待RTC初始化
			delay_ms(200);
			printf("rtc waiting```\r\n");
		} 
		printf("finish\n");
		display_jing();
		//初始化完成
   while(1)
	{	
		POINT_COLOR=RED;
		if(t!=calendar.sec)		//时间更新后显示新时间
		{
				t=calendar.sec;	
				LCD_ShowNum(200,135,calendar.min,2,32);		
				LCD_ShowString(230,135,200,32,32,":");			
				LCD_ShowNum(248,135,calendar.sec,2,32);
			
				Time = 60*calendar.min+calendar.sec;//比赛用时
				if(dis_pre != quanshu_tenfold)			//有位移变化
				{
					V_ave=(0.154*quanshu_tenfold)/Time;
					dis_pre = quanshu_tenfold;
					sprintf(code_ave,"%.2f",V_ave);	
					LCD_ShowString(100,200,200,32,32,code_ave);//修改一下位置
					
				}
		}
			
		sprintf(code_v,"%.2f",V);					//float 转 字符串  
		LCD_ShowString(365,275,200,32,32,code_v);		//速度
		
		sprintf(code_vr,"%d",V_RPM);					//float 转 字符串  
		LCD_ShowString(365,275,200,32,32,code_vr);		//转速
 
		sprintf(mileage,"%.2f",0.154*quanshu_tenfold);
		LCD_ShowString(250,225,200,24,32,mileage);	//里程
		
	  display_dong(V_RPM,V,50);
		delay_ms(300);
	}
 }
开发者ID:1102530068,项目名称:Nothing,代码行数:60,代码来源:test.c


示例9: RTC_Setup

/***************************************************************************//**
 * @brief Enables LFACLK and selects LFRCO as clock source for RTC
 ******************************************************************************/
static void RTC_Setup(void)
{
  RTC_Init_TypeDef init;

  rtcInitialized = 1;

  /* Ensure LE modules are accessible */
  CMU_ClockEnable(cmuClock_CORELE, true);

  /* Enable LFRCO as LFACLK in CMU (will also enable oscillator if not enabled) */
  CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFRCO);

  /* Enable clock to RTC module */
  CMU_ClockEnable(cmuClock_RTC, true);

  init.enable   = false;
  init.debugRun = false;
  init.comp0Top = false; /* Count to max before wrapping */
  RTC_Init(&init);

  /* Disable interrupt generation from RTC0 */
  RTC_IntDisable(_RTC_IF_MASK);

  /* Enable interrupts */
  NVIC_ClearPendingIRQ(RTC_IRQn);
  NVIC_EnableIRQ(RTC_IRQn);
}
开发者ID:ketrum,项目名称:equine-health-monitor-gdp12,代码行数:30,代码来源:rtc.c


示例10: rtc_crystal_init

/**
 * Initialize RTC Based on Crystal Oscillator
 */
void rtc_crystal_init(void)
{
  RTC_Init_TypeDef init;

  /* Ensure LE modules are accessible */
  CMU_ClockEnable(cmuClock_CORELE, true);

  /* Enable LFACLK in CMU (will also enable oscillator if not enabled) */
  CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);

  /* Use the prescaler to reduce power consumption. */
  CMU_ClockDivSet(cmuClock_RTC, RTC_PRESCALE);

  /* Enable clock to RTC module */
  CMU_ClockEnable(cmuClock_RTC, true);

  init.enable   = false; /* Start disabled to reset counter */
  init.debugRun = false;
  init.comp0Top = false; /* Count to max before wrapping */
  RTC_Init(&init);

  /* Disable interrupt generation from RTC0 */
  RTC_IntDisable(_RTC_IF_MASK);

  /* Enable interrupts */
  NVIC_ClearPendingIRQ(RTC_IRQn);
  NVIC_EnableIRQ(RTC_IRQn);

  /* Start RTC counter */
  RTC_Enable(true);
}
开发者ID:Spike0,项目名称:Contiki_my,代码行数:34,代码来源:rtc.c


示例11: System_Time_Init

static void System_Time_Init(void)
{
	/* RTC Block section ------------------------------------------------------ */
	// Init RTC module
	RTC_Init(LPC_RTC);

    /* Disable RTC interrupt */
    NVIC_DisableIRQ(RTC_IRQn);
    /* preemption = 1, sub-priority = 1 */
    NVIC_SetPriority(RTC_IRQn, ((0x01<<3)|0x01));

	/* Enable rtc (starts increase the tick counter and second counter register) */
	RTC_ResetClockTickCounter(LPC_RTC);
	RTC_Cmd(LPC_RTC, ENABLE);
	RTC_CalibCounterCmd(LPC_RTC, DISABLE);

	/* Set current time for RTC */
	// Current time is 06:45:00PM, 2011-03-25
	RTC_SetTime (LPC_RTC, RTC_TIMETYPE_SECOND, 0);
	RTC_SetTime (LPC_RTC, RTC_TIMETYPE_MINUTE, 45);
	RTC_SetTime (LPC_RTC, RTC_TIMETYPE_HOUR, 15);
	RTC_SetTime (LPC_RTC, RTC_TIMETYPE_MONTH, 3);
	RTC_SetTime (LPC_RTC, RTC_TIMETYPE_YEAR, 2014);
	RTC_SetTime (LPC_RTC, RTC_TIMETYPE_DAYOFMONTH, 30);

	return;
}
开发者ID:waitig,项目名称:GasSub_LPC1788,代码行数:27,代码来源:user_main.c


示例12: main

int main(void)
{
    uint8_t last_sec;
    RTC_CalanderTypeDef RTC_Calander1;
    //初始化系统时钟 使用外部50M晶振 PLL倍频到100M
    SystemClockSetup(ClockSource_EX50M,CoreClock_100M);
    DelayInit();
    LED_Init(LED_PinLookup_CHK60EVB, kNumOfLED);
    UART_DebugPortInit(UART4_RX_C14_TX_C15, 115200);
    UART_printf("RTC TEST\r\n");
    RTC_Init();
	
	  //可以设置时间
    RTC_Calander1.Hour = 10;
    RTC_Calander1.Minute = 57;
    RTC_Calander1.Second = 58;
    RTC_Calander1.Month = 10;
    RTC_Calander1.Date = 10;
    RTC_Calander1.Year = 2013;
    //RTC_SetCalander(&RTC_Calander1);
    NVIC_EnableIRQ(RTC_IRQn);
    while(1) 
		{
        RTC_GetCalander(&RTC_Calander1); //读取时间
        if(last_sec != RTC_Calander1.Second)
				{
            UART_printf("%d-%d-%d %d:%d:%d\r\n", RTC_Calander1.Year, RTC_Calander1.Month, RTC_Calander1.Date, RTC_Calander1.Hour, RTC_Calander1.Minute, RTC_Calander1.Second);
            last_sec = RTC_Calander1.Second;
				}	
		}
 }
开发者ID:Jaly314,项目名称:CH-K-Lib,代码行数:31,代码来源:main.c


示例13: TM_RTC_SetDateTime

void TM_RTC_SetDateTime(TM_RTC_Time_t* data, TM_RTC_Format_t format) {	
	/* Fill time */
	RTC_TimeStruct.RTC_Hours = data->hours;
	RTC_TimeStruct.RTC_Minutes = data->minutes;
	RTC_TimeStruct.RTC_Seconds = data->seconds;
	/* Fill date */
	RTC_DateStruct.RTC_Date = data->date;
	RTC_DateStruct.RTC_Month = data->month;
	RTC_DateStruct.RTC_Year = data->year;
	RTC_DateStruct.RTC_WeekDay = data->day;
	
	/* Set the RTC time base to 1s and hours format to 24h */
	RTC_InitStruct.RTC_HourFormat = RTC_HourFormat_24;
	RTC_InitStruct.RTC_AsynchPrediv = uwAsynchPrediv;
	RTC_InitStruct.RTC_SynchPrediv = uwSynchPrediv;
	RTC_Init(&RTC_InitStruct);

	if (format == TM_RTC_Format_BCD) {
		RTC_SetTime(RTC_Format_BCD, &RTC_TimeStruct);
	} else {
		RTC_SetTime(RTC_Format_BIN, &RTC_TimeStruct);
	}
	
	if (format == TM_RTC_Format_BCD) {
		RTC_SetDate(RTC_Format_BCD, &RTC_DateStruct);
	} else {
		RTC_SetDate(RTC_Format_BIN, &RTC_DateStruct);
	}	
	
	if (TM_RTC_Status != RTC_STATUS_ZERO) {
		/* Write backup registers */
		RTC_WriteBackupRegister(RTC_STATUS_REG, RTC_STATUS_TIME_OK);
	}
}
开发者ID:Mars55,项目名称:stm32f429,代码行数:34,代码来源:tm_stm32f4_rtc.c


示例14: rtimer_arch_init

/*---------------------------------------------------------------------------*/
void
rtimer_arch_init(void)
{
  RTC_Init_TypeDef init = RTC_INIT_DEFAULT;

  /* Ensure LE modules are accessible */
  CMU_ClockEnable(cmuClock_CORELE, true);

  /* Enable LFACLK in CMU (will also enable oscillator if not enabled) */
  CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);

  /* Don't use prescaler to have highest precision */
  CMU_ClockDivSet(cmuClock_RTC, cmuClkDiv_1);

  /* Enable clock to RTC module */
  CMU_ClockEnable(cmuClock_RTC, true);

  init.enable   = false; /* Start disabled to reset counter */
  init.debugRun = false;
  init.comp0Top = false; /* Don't Reset Count on comp0 */
  RTC_Init(&init);

  /* Disable interrupt generation from RTC0 */
  RTC_IntDisable(_RTC_IF_MASK);

  /* Enable interrupts */
  NVIC_ClearPendingIRQ(RTC_IRQn);
  NVIC_EnableIRQ(RTC_IRQn);

  /* Start RTC counter */
  RTC_Enable(true);
}
开发者ID:Spike0,项目名称:Contiki_my,代码行数:33,代码来源:rtimer-arch.c


示例15: main

int main(void)
{
		TIME  time;
		
		 /*时钟初始化*/
		CLK_Config();
			
		/*初始化电源控制*/
		GPIO_DeInit(GPIOD); 
		GPIO_Init(GPIOD,GPIO_PIN_3,GPIO_MODE_OUT_PP_LOW_FAST);
		GPIO_DeInit(GPIOC); 
		GPIO_Init(GPIOC,GPIO_PIN_1,GPIO_MODE_OUT_PP_LOW_FAST);	
	
		/*上电,3.3V/12V*/
		VDD3V3_ON();
		VDD12_ON();
	
		RTC_Init();


		while (1)
		{
			RTC_ReadDate(&time);

		  
		}
			

	


	return 0;
}
开发者ID:chalot,项目名称:360_MBoard,代码行数:33,代码来源:main.c


示例16: main

/* start the main program */
void main() 
{
  
   unsigned char sec,min,hour,day,month,year;

  /* Initialize the lcd before displaying any thing on the lcd */
    LCD_Init(8,2,16);

  /* Initialize the RTC(ds1307) before reading or writing time/date */
    RTC_Init();


   /*##### Set the time and Date only once. Once the Time and Date is set, comment these lines
         and reflash the code. Else the time will be set every time the controller is reset*/
    RTC_SetTime(0x10,0x40,0x00);  //  10:40:20 am
    RTC_SetDate(0x01,0x01,0x15);  //  1st Jan 2015



   /* Display the Time and Date continuously */ 
   while(1)
    {
		LCD_GoToLine(1);
	   /* Read the Time from RTC(ds1307) */ 
        RTC_GetTime(&hour,&min,&sec);    
		
	   /* Read the Date from RTC(ds1307) */ 
       RTC_GetDate(&day,&month,&year);     		 
        
	   LCD_Printf("\n\rtime:%2x:%2x:%2x  \nDate:%2x/%2x/%2x",(uint16_t)hour,(uint16_t)min,(uint16_t)sec,(uint16_t)day,(uint16_t)month,(uint16_t)year);
	}		

  }
开发者ID:Amritach,项目名称:Code-Libraries,代码行数:34,代码来源:main.c


示例17: main

int main(void)
{
	uint8_t i, j, cardType, error;
	
	DDRB = 0xFF;
	PORTB = 0x00;
	SD_Init_hw();	// cs of sd disable!
	SPI_Init();		//only one SPI on BIGAVR... need to change for ATmega328
	cardType = 0;

//	error = SD_Init(2);
	_delay_us(10);
	RTC_Init();
	sei();
	
	while(1)
	{
		if(Status & RTC_UPDATE)
		{
			PORTB |= _BV(PB2);		//sd deassert ako test rtc interruptu
			sei();
			for(j=0; j<8; j++)
			{
				SPI_Send8(0xAA,0);
				_delay_us(10);
			}
			Status &= ~RTC_UPDATE;
		}
		SPI_Send8(0xF0,0);
	}
}
开发者ID:armsvb,项目名称:max-motionlogger,代码行数:31,代码来源:main3.c


示例18: RTC_Setup

/***************************************************************************//**
 * @brief
 *	Enables LFACLK and selects LFXO as clock source for RTC
 *
 * @param osc
 *	Oscillator
 ******************************************************************************/
void RTC_Setup(CMU_Select_TypeDef osc)
{
  RTC_Init_TypeDef init;

  rtcInitialized = 1;

  /* Ensure LE modules are accessible */
  CMU_ClockEnable(cmuClock_CORELE, true);

  /* Enable osc as LFACLK in CMU (will also enable oscillator if not enabled) */
  CMU_ClockSelectSet(cmuClock_LFA, osc);

  /* Use a 32 division prescaler to reduce power consumption. */
  CMU_ClockDivSet(cmuClock_RTC, cmuClkDiv_32);

  rtcFreq = CMU_ClockFreqGet(cmuClock_RTC);

  /* Enable clock to RTC module */
  CMU_ClockEnable(cmuClock_RTC, true);

  init.enable   = false;
  init.debugRun = false;
  init.comp0Top = false; /* Count to max before wrapping */
  RTC_Init(&init);

  /* Disable interrupt generation from RTC0 */
  RTC_IntDisable(_RTC_IF_MASK);

  /* Enable interrupts */
  NVIC_ClearPendingIRQ(RTC_IRQn);
  NVIC_EnableIRQ(RTC_IRQn);
}
开发者ID:ketrum,项目名称:equine-health-monitor-gdp12,代码行数:39,代码来源:rtc.c


示例19: SetupHardware

/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
#if (ARCH == ARCH_AVR8)
	/* Disable watchdog if enabled by bootloader/fuses */
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	/* Disable clock division */
	clock_prescale_set(clock_div_1);
#endif

	/* Hardware Initialization */
	LEDs_Init();
	ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_128);
	Temperature_Init();
	Dataflash_Init();
	USB_Init();
	TWI_Init(TWI_BIT_PRESCALE_4, TWI_BITLENGTH_FROM_FREQ(4, 50000));
	RTC_Init();

	/* 500ms logging interval timer configuration */
	OCR1A   = (((F_CPU / 256) / 2) - 1);
	TCCR1B  = (1 << WGM12) | (1 << CS12);
	TIMSK1  = (1 << OCIE1A);

	/* Check if the Dataflash is working, abort if not */
	if (!(DataflashManager_CheckDataflashOperation()))
	{
		LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
		for(;;);
	}

	/* Clear Dataflash sector protections, if enabled */
	DataflashManager_ResetDataflashProtections();
}
开发者ID:UltimateHackingKeyboard,项目名称:bootloader-right,代码行数:36,代码来源:TempDataLogger.c


示例20: rtt_init

void rtt_init(void)
{
    /* prescaler of 32768 = 1 s of resolution and overflow each 194 days */
    CMU_ClockDivSet(cmuClock_RTC, cmuClkDiv_32768);

    /* enable clocks */
    CMU_ClockEnable(cmuClock_CORELE, true);
    CMU_ClockEnable(cmuClock_RTC, true);

    /* reset and initialize peripheral */
    EFM32_CREATE_INIT(init, RTC_Init_TypeDef, RTC_INIT_DEFAULT,
        .conf.enable = false,
        .conf.comp0Top = false
    );

    RTC_Reset();
    RTC_Init(&init.conf);

    /* enable interrupts */
    RTC_IntEnable(RTC_IEN_OF);

    NVIC_ClearPendingIRQ(RTC_IRQn);
    NVIC_EnableIRQ(RTC_IRQn);

    /* enable peripheral */
    RTC_Enable(true);
}
开发者ID:basilfx,项目名称:EFM2Riot,代码行数:27,代码来源:rtt.c



注:本文中的RTC_Init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ RTC_PORT函数代码示例发布时间:2022-05-30
下一篇:
C++ RTC_ITConfig函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap