stm8l15x_wfe.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /**
  2. ******************************************************************************
  3. * @file stm8l15x_wfe.h
  4. * @author MCD Application Team
  5. * @version V1.6.1
  6. * @date 30-September-2014
  7. * @brief This file contains all the functions prototypes for the WFE firmware
  8. * library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
  13. *
  14. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  15. * You may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at:
  17. *
  18. * http://www.st.com/software_license_agreement_liberty_v2
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an "AS IS" BASIS,
  22. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. *
  26. ******************************************************************************
  27. */
  28. /* Define to prevent recursive inclusion -------------------------------------*/
  29. #ifndef __STM8L15x_WFE_H
  30. #define __STM8L15x_WFE_H
  31. /* Includes ------------------------------------------------------------------*/
  32. #include "stm8l15x.h"
  33. /** @addtogroup STM8L15x_StdPeriph_Driver
  34. * @{
  35. */
  36. /** @addtogroup WFE
  37. * @{
  38. */
  39. /* Exported types ------------------------------------------------------------*/
  40. /** @defgroup WFE_Exported_Types
  41. * @{
  42. */
  43. /** @defgroup WFE_Sources
  44. * @brief Signal Sources to generate wake_up events
  45. @verbatim
  46. Elements values convention: 0xXXYY
  47. X = SRx registers index
  48. XX = 01 : CR1
  49. XX = 02 : CR2
  50. XX = 03 : CR3
  51. XX = 04 : CR4
  52. YY = flag mask in the dedicated register(XX register)
  53. @endverbatim
  54. * @{
  55. */
  56. typedef enum {
  57. WFE_Source_TIM2_EV0 = (uint16_t)0x0101, /*!< TIM2 Update/Trigger and Break interrupt */
  58. WFE_Source_TIM2_EV1 = (uint16_t)0x0102, /*!< TIM2 Capture/Compare interrupt */
  59. WFE_Source_TIM1_EV0 = (uint16_t)0x0104, /*!< TIM1 Update/Trigger and Break interrupt */
  60. WFE_Source_TIM1_EV1 = (uint16_t)0x0108, /*!< TIM1 Capture/Compare interrupt */
  61. WFE_Source_EXTI_EV0 = (uint16_t)0x0110, /*!< I/O port interrupt from Pins 0 */
  62. WFE_Source_EXTI_EV1 = (uint16_t)0x0120, /*!< I/O port interrupt from Pins 1 */
  63. WFE_Source_EXTI_EV2 = (uint16_t)0x0140, /*!< I/O port interrupt from Pins 2 */
  64. WFE_Source_EXTI_EV3 = (uint16_t)0x0180, /*!< I/O port interrupt from Pins 3 */
  65. WFE_Source_EXTI_EV4 = (uint16_t)0x0201, /*!< I/O port interrupt from Pins 4 */
  66. WFE_Source_EXTI_EV5 = (uint16_t)0x0202, /*!< I/O port interrupt from Pins 5 */
  67. WFE_Source_EXTI_EV6 = (uint16_t)0x0204, /*!< I/O port interrupt from Pins 6 */
  68. WFE_Source_EXTI_EV7 = (uint16_t)0x0208, /*!< I/O port interrupt from Pins 7 */
  69. WFE_Source_EXTI_EVB_G = (uint16_t)0x0210, /*!< I/O port interrupt from port B and G */
  70. WFE_Source_EXTI_EVD_H = (uint16_t)0x0220, /*!< I/O port interrupt from Port D and H */
  71. WFE_Source_EXTI_EVE_F = (uint16_t)0x0240, /*!< I/O port interrupt from Port E and F */
  72. WFE_Source_ADC1_COMP_EV = (uint16_t)0x0280, /*!< ADC1, COMP1 and COMP2 interrupts */
  73. WFE_Source_TIM3_EV0 = (uint16_t)0x0301, /*!< TIM3 Update/Trigger and Break interrupt */
  74. WFE_Source_TIM3_EV1 = (uint16_t)0x0302, /*!< TIM3 Capture/Compare interrupt */
  75. WFE_Source_TIM4_EV = (uint16_t)0x0304, /*!< TIM4 Update and Trigger interrupt */
  76. WFE_Source_SPI1_EV = (uint16_t)0x0308, /*!< SPI1 Rx and Tx interrupt */
  77. WFE_Source_I2C1_EV = (uint16_t)0x0310, /*!< I2C1 Rx and Tx interrupt */
  78. WFE_Source_USART1_EV = (uint16_t)0x0320, /*!< USART1 Rx and Tx interrupt */
  79. WFE_Source_DMA1CH01_EV = (uint16_t)0x0340, /*!< DMA1 channel 0 and 1 interrupt */
  80. WFE_Source_DMA1CH23_EV = (uint16_t)0x0380, /*!< DMA1 channel 2 and 3 interrupt */
  81. WFE_Source_RTC_CSS_EV = (uint16_t)0x0401, /*!< RTC or CSS on LSE event */
  82. WFE_Source_SPI2_EV = (uint16_t)0x0402, /*!< SPI2 Rx and Tx interrupt */
  83. WFE_Source_USART2_EV = (uint16_t)0x0404, /*!< USART2 Rx and Tx interrupt */
  84. WFE_Source_USART3_EV = (uint16_t)0x0408, /*!< USART3 Rx and Tx interrupt */
  85. WFE_Source_TIM5_EV0 = (uint16_t)0x0410, /*!< TIM5 Update/Trigger and Break interrupt */
  86. WFE_Source_TIM5_EV1 = (uint16_t)0x0420, /*!< TIM5 Capture/Compare interrupt */
  87. WFE_Source_AES_EV = (uint16_t)0x0440 /*!< AES interrupt */
  88. } WFE_Source_TypeDef;
  89. #define IS_WFE_SOURCE(Source) (((Source) == WFE_Source_TIM2_EV0) || \
  90. ((Source) == WFE_Source_TIM2_EV1) || \
  91. ((Source) == WFE_Source_TIM1_EV0) || \
  92. ((Source) == WFE_Source_TIM1_EV1) || \
  93. ((Source) == WFE_Source_EXTI_EV0) || \
  94. ((Source) == WFE_Source_EXTI_EV1) || \
  95. ((Source) == WFE_Source_EXTI_EV2) || \
  96. ((Source) == WFE_Source_EXTI_EV3) || \
  97. ((Source) == WFE_Source_EXTI_EV4) || \
  98. ((Source) == WFE_Source_EXTI_EV5) || \
  99. ((Source) == WFE_Source_EXTI_EV6) || \
  100. ((Source) == WFE_Source_EXTI_EV7) || \
  101. ((Source) == WFE_Source_EXTI_EVB_G) || \
  102. ((Source) == WFE_Source_EXTI_EVD_H) || \
  103. ((Source) == WFE_Source_EXTI_EVE_F) || \
  104. ((Source) == WFE_Source_ADC1_COMP_EV) || \
  105. ((Source) == WFE_Source_TIM3_EV0) || \
  106. ((Source) == WFE_Source_TIM3_EV1) || \
  107. ((Source) == WFE_Source_TIM4_EV) || \
  108. ((Source) == WFE_Source_SPI1_EV) || \
  109. ((Source) == WFE_Source_I2C1_EV) || \
  110. ((Source) == WFE_Source_USART1_EV) || \
  111. ((Source) == WFE_Source_DMA1CH01_EV) || \
  112. ((Source) == WFE_Source_AES_EV) || \
  113. ((Source) == WFE_Source_TIM5_EV1) || \
  114. ((Source) == WFE_Source_TIM5_EV0) || \
  115. ((Source) == WFE_Source_USART3_EV) || \
  116. ((Source) == WFE_Source_USART2_EV) || \
  117. ((Source) == WFE_Source_SPI2_EV) || \
  118. ((Source) == WFE_Source_RTC_CSS_EV) || \
  119. ((Source) == WFE_Source_DMA1CH23_EV))
  120. /**
  121. * @}
  122. */
  123. /**
  124. * @}
  125. */
  126. /* Exported constants --------------------------------------------------------*/
  127. /* Exported macros -----------------------------------------------------------*/
  128. /* Exported functions ------------------------------------------------------- */
  129. /* Function used to set the WFE configuration to the default reset state ******/
  130. void WFE_DeInit(void);
  131. /* WFE Source configuration and management functions **************************/
  132. void WFE_WakeUpSourceEventCmd(WFE_Source_TypeDef WFE_Source, FunctionalState NewState);
  133. FunctionalState WFE_GetWakeUpSourceEventStatus(WFE_Source_TypeDef WFE_Source);
  134. #endif /* __STM8L15x_WFE_H */
  135. /**
  136. * @}
  137. */
  138. /**
  139. * @}
  140. */
  141. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/