stm8s_rst.c 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /**
  2. ******************************************************************************
  3. * @file stm8s_rst.c
  4. * @author MCD Application Team
  5. * @version V2.2.0
  6. * @date 30-September-2014
  7. * @brief This file contains all the functions for the RST peripheral.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
  12. *
  13. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  14. * You may not use this file except in compliance with the License.
  15. * You may obtain a copy of the License at:
  16. *
  17. * http://www.st.com/software_license_agreement_liberty_v2
  18. *
  19. * Unless required by applicable law or agreed to in writing, software
  20. * distributed under the License is distributed on an "AS IS" BASIS,
  21. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the License for the specific language governing permissions and
  23. * limitations under the License.
  24. *
  25. ******************************************************************************
  26. */
  27. /* Includes ------------------------------------------------------------------*/
  28. #include "stm8s_rst.h"
  29. /** @addtogroup STM8S_StdPeriph_Driver
  30. * @{
  31. */
  32. /* Private typedef -----------------------------------------------------------*/
  33. /* Private define ------------------------------------------------------------*/
  34. /* Private macro -------------------------------------------------------------*/
  35. /* Private variables ---------------------------------------------------------*/
  36. /* Private function prototypes -----------------------------------------------*/
  37. /* Private Constants ---------------------------------------------------------*/
  38. /* Public functions ----------------------------------------------------------*/
  39. /**
  40. * @addtogroup RST_Public_Functions
  41. * @{
  42. */
  43. /**
  44. * @brief Checks whether the specified RST flag is set or not.
  45. * @param RST_Flag : specify the reset flag to check.
  46. * This parameter can be a value of @ref RST_FLAG_TypeDef.
  47. * @retval FlagStatus: status of the given RST flag.
  48. */
  49. FlagStatus RST_GetFlagStatus(RST_Flag_TypeDef RST_Flag)
  50. {
  51. /* Check the parameters */
  52. assert_param(IS_RST_FLAG_OK(RST_Flag));
  53. /* Get flag status */
  54. return((FlagStatus)(((uint8_t)(RST->SR & RST_Flag) == (uint8_t)0x00) ? RESET : SET));
  55. }
  56. /**
  57. * @brief Clears the specified RST flag.
  58. * @param RST_Flag : specify the reset flag to clear.
  59. * This parameter can be a value of @ref RST_FLAG_TypeDef.
  60. * @retval None
  61. */
  62. void RST_ClearFlag(RST_Flag_TypeDef RST_Flag)
  63. {
  64. /* Check the parameters */
  65. assert_param(IS_RST_FLAG_OK(RST_Flag));
  66. RST->SR = (uint8_t)RST_Flag;
  67. }
  68. /**
  69. * @}
  70. */
  71. /**
  72. * @}
  73. */
  74. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/