Subversion Repositories DashDisplay

Rev

Rev 56 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 56 Rev 61
Line 324... Line 324...
324
    hrtc->Instance->PRER = (uint32_t)(hrtc->Init.SynchPrediv);
324
    hrtc->Instance->PRER = (uint32_t)(hrtc->Init.SynchPrediv);
325
    hrtc->Instance->PRER |= (uint32_t)(hrtc->Init.AsynchPrediv << 16U);
325
    hrtc->Instance->PRER |= (uint32_t)(hrtc->Init.AsynchPrediv << 16U);
326
 
326
 
327
    /* Exit Initialization mode */
327
    /* Exit Initialization mode */
328
    hrtc->Instance->ISR &= (uint32_t)~RTC_ISR_INIT;
328
    hrtc->Instance->ISR &= (uint32_t)~RTC_ISR_INIT;
-
 
329
#if defined (RTC_CR_BYPSHAD)
-
 
330
    /* If  CR_BYPSHAD bit = 0, wait for synchro else this check is not needed */
-
 
331
    if((hrtc->Instance->CR & RTC_CR_BYPSHAD) == RESET)
-
 
332
#endif /* RTC_CR_BYPSHAD */
-
 
333
    {
-
 
334
      if(HAL_RTC_WaitForSynchro(hrtc) != HAL_OK)
-
 
335
      {
-
 
336
        /* Enable the write protection for RTC registers */
-
 
337
        __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc);
-
 
338
 
-
 
339
        hrtc->State = HAL_RTC_STATE_ERROR;
329
 
340
 
-
 
341
        return HAL_ERROR;
-
 
342
      }
-
 
343
    }
330
    hrtc->Instance->TAFCR &= (uint32_t)~RTC_TAFCR_ALARMOUTTYPE;
344
    hrtc->Instance->TAFCR &= (uint32_t)~RTC_TAFCR_ALARMOUTTYPE;
331
    hrtc->Instance->TAFCR |= (uint32_t)(hrtc->Init.OutPutType);
345
    hrtc->Instance->TAFCR |= (uint32_t)(hrtc->Init.OutPutType);
332
 
346
 
333
    /* Enable the write protection for RTC registers */
347
    /* Enable the write protection for RTC registers */
334
    __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc);
348
    __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc);
Line 794... Line 808...
794
  else
808
  else
795
  {
809
  {
796
    /* Set the RTC_TR register */
810
    /* Set the RTC_TR register */
797
    hrtc->Instance->TR = (uint32_t)(tmpreg & RTC_TR_RESERVED_MASK);
811
    hrtc->Instance->TR = (uint32_t)(tmpreg & RTC_TR_RESERVED_MASK);
798
 
812
 
799
    /* Clear the bits to be configured */
813
    /* Clear the bits to be configured (Deprecated. Use HAL_RTC_DST_xxx functions instead) */
800
    hrtc->Instance->CR &= ((uint32_t)~RTC_CR_BKP);
814
    hrtc->Instance->CR &= ((uint32_t)~RTC_CR_BKP);
801
 
815
 
802
    /* Configure the RTC_CR register */
816
    /* Configure the RTC_CR register (Deprecated. Use HAL_RTC_DST_xxx functions instead) */
803
    hrtc->Instance->CR |= (uint32_t)(sTime->DayLightSaving | sTime->StoreOperation);
817
    hrtc->Instance->CR |= (uint32_t)(sTime->DayLightSaving | sTime->StoreOperation);
804
 
818
 
805
    /* Exit Initialization mode */
819
    /* Exit Initialization mode */
806
    hrtc->Instance->ISR &= ((uint32_t)~RTC_ISR_INIT);
820
    hrtc->Instance->ISR &= ((uint32_t)~RTC_ISR_INIT);
807
 
821
 
Line 1029... Line 1043...
1029
  }
1043
  }
1030
  return HAL_OK;
1044
  return HAL_OK;
1031
}
1045
}
1032
 
1046
 
1033
/**
1047
/**
-
 
1048
  * @brief  Daylight Saving Time, adda one hour to the calendar in one
-
 
1049
  *         single operation without going through the initialization procedure.
-
 
1050
  * @param  hrtc pointer to a RTC_HandleTypeDef structure that contains
-
 
1051
  *                the configuration information for RTC.
-
 
1052
  * @retval None
-
 
1053
  */
-
 
1054
void HAL_RTC_DST_Add1Hour(RTC_HandleTypeDef *hrtc)
-
 
1055
{
-
 
1056
  __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc);
-
 
1057
  SET_BIT(hrtc->Instance->CR, RTC_CR_ADD1H);
-
 
1058
  __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc);
-
 
1059
}
-
 
1060
 
-
 
1061
/**
-
 
1062
  * @brief  Daylight Saving Time, subtracts one hour from the calendar in one
-
 
1063
  *         single operation without going through the initialization procedure.
-
 
1064
  * @param  hrtc pointer to a RTC_HandleTypeDef structure that contains
-
 
1065
  *                the configuration information for RTC.
-
 
1066
  * @retval None
-
 
1067
  */
-
 
1068
void HAL_RTC_DST_Sub1Hour(RTC_HandleTypeDef *hrtc)
-
 
1069
{
-
 
1070
  __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc);
-
 
1071
  SET_BIT(hrtc->Instance->CR, RTC_CR_SUB1H);
-
 
1072
  __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc);
-
 
1073
}
-
 
1074
 
-
 
1075
/**
-
 
1076
  * @brief  Daylight Saving Time, sets the store operation bit.
-
 
1077
  * @note   It can be used by the software in order to memorize the DST status.
-
 
1078
  * @param  hrtc pointer to a RTC_HandleTypeDef structure that contains
-
 
1079
  *                the configuration information for RTC.
-
 
1080
  * @retval None
-
 
1081
  */
-
 
1082
void HAL_RTC_DST_SetStoreOperation(RTC_HandleTypeDef *hrtc)
-
 
1083
{
-
 
1084
  __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc);
-
 
1085
  SET_BIT(hrtc->Instance->CR, RTC_CR_BKP);
-
 
1086
  __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc);
-
 
1087
}
-
 
1088
 
-
 
1089
/**
-
 
1090
  * @brief  Daylight Saving Time, clears the store operation bit.
-
 
1091
  * @param  hrtc pointer to a RTC_HandleTypeDef structure that contains
-
 
1092
  *                the configuration information for RTC.
-
 
1093
  * @retval None
-
 
1094
  */
-
 
1095
void HAL_RTC_DST_ClearStoreOperation(RTC_HandleTypeDef *hrtc)
-
 
1096
{
-
 
1097
  __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc);
-
 
1098
  CLEAR_BIT(hrtc->Instance->CR, RTC_CR_BKP);
-
 
1099
  __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc);
-
 
1100
}
-
 
1101
 
-
 
1102
/**
-
 
1103
  * @brief  Daylight Saving Time, reads the store operation bit.
-
 
1104
  * @param  hrtc RTC handle
-
 
1105
  * @retval operation see RTC_StoreOperation_Definitions
-
 
1106
  */
-
 
1107
uint32_t HAL_RTC_DST_ReadStoreOperation(RTC_HandleTypeDef *hrtc)
-
 
1108
{
-
 
1109
  return READ_BIT(hrtc->Instance->CR, RTC_CR_BKP);
-
 
1110
}
-
 
1111
 
-
 
1112
/**
1034
  * @}
1113
  * @}
1035
  */
1114
  */
1036
 
1115
 
1037
/** @addtogroup RTC_Exported_Functions_Group3
1116
/** @addtogroup RTC_Exported_Functions_Group3
1038
 *  @brief   RTC Alarm functions
1117
 *  @brief   RTC Alarm functions
Line 1722... Line 1801...
1722
  */
1801
  */
1723
HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef *hrtc)
1802
HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef *hrtc)
1724
{
1803
{
1725
  uint32_t tickstart;
1804
  uint32_t tickstart;
1726
 
1805
 
1727
#if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) || defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX)
1806
#if defined (RTC_CR_BYPSHAD)
1728
  /* If RTC_CR_BYPSHAD bit = 0, wait for synchro else this check is not needed */
1807
  /* If RTC_CR_BYPSHAD bit = 0, wait for synchro else this check is not needed */
1729
  if ((hrtc->Instance->CR & RTC_CR_BYPSHAD) == RESET)
1808
  if ((hrtc->Instance->CR & RTC_CR_BYPSHAD) == RESET)
1730
#endif /* STM32L100xBA || STM32L151xBA || STM32L152xBA || STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC || STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */
1809
#endif /* RTC_CR_BYPSHAD */
1731
  {
1810
  {
1732
    /* Clear RSF flag */
1811
    /* Clear RSF flag */
1733
    hrtc->Instance->ISR &= (uint32_t)RTC_RSF_MASK;
1812
    hrtc->Instance->ISR &= (uint32_t)RTC_RSF_MASK;
1734
 
1813
 
1735
    tickstart = HAL_GetTick();
1814
    tickstart = HAL_GetTick();