示例#1
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
void main(void)
{
  /* Enable LSE */
  CLK_LSEConfig(CLK_LSE_ON);
  /* Wait for LSE clock to be ready */
  while (CLK_GetFlagStatus(CLK_FLAG_LSERDY) == RESET);

  /* wait for 1 second for the LSE Stabilisation */
  LSE_StabTime();

  /* Select LSE (32.768 KHz) as RTC clock source */
  CLK_RTCClockConfig(CLK_RTCCLKSource_LSE, CLK_RTCCLKDiv_1);

  CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);

  /* Calendar Configuration */
  Calendar_Init();

  /*RTC Tamper Configuration*/
  Tamper_Init();

  /* EvalBoard Configuration */
  EvalBoard_Init();

  Tamper_DelayShow(TampFilterIndex);

  while (1)
  {
    EnterSafeCode();
    Time_Show(LCD_LINE2, SHOW_POINT2);
    ExitSafeCode();
  }
}
示例#2
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
void main(void)
{
  /* Enable LSE */
  CLK_LSEConfig(CLK_LSE_ON);
  /* Wait for LSE clock to be ready */
  while (CLK_GetFlagStatus(CLK_FLAG_LSERDY) == RESET);
  
  /* wait for 1 second for the LSE Stabilisation */
  Delay_Seconds(1);

  /* Select LSE (32.768 KHz) as RTC clock source */
  CLK_RTCClockConfig(CLK_RTCCLKSource_LSE, CLK_RTCCLKDiv_1);
  CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);

  /*RTC Tamper Configuration*/
  Tamper_Init();

  /* Calendar Configuration */
  Calendar_Init();

  /* EvalBoard Configuration */
  EvalBoard_Init();

  /* RTC Time fields reset*/
  Time_Reset();

  /* RTC Time pause waiting for a press on SEL Key */
  Time_Pause();

  while (1)
  {
    EnterSafeCode();
    Time_Show(LCD_LINE2);
    ExitSafeCode();
  }
}