Implement a secure ICS protocol targeting LoRa Node151 microcontroller for controlling irrigation.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

206 lines
8.7 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32l1xx_hal_gpio_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of GPIO HAL Extension module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef __STM32L1xx_HAL_GPIO_EX_H
  21. #define __STM32L1xx_HAL_GPIO_EX_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32l1xx_hal_def.h"
  27. /** @addtogroup STM32L1xx_HAL_Driver
  28. * @{
  29. */
  30. /** @defgroup GPIOEx GPIOEx
  31. * @{
  32. */
  33. /* Exported types ------------------------------------------------------------*/
  34. /* Exported constants --------------------------------------------------------*/
  35. /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants
  36. * @{
  37. */
  38. /** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection
  39. * @{
  40. */
  41. /* AF 0 selection */
  42. #define GPIO_AF0_MCO ((uint8_t)0x00) /*!< MCO Alternate Function mapping */
  43. #define GPIO_AF0_TAMPER ((uint8_t)0x00) /*!< TAMPER Alternate Function mapping */
  44. #define GPIO_AF0_SWJ ((uint8_t)0x00) /*!< SWJ (SWD and JTAG) Alternate Function mapping */
  45. #define GPIO_AF0_TRACE ((uint8_t)0x00) /*!< TRACE Alternate Function mapping */
  46. #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /*!< RTC_OUT Alternate Function mapping */
  47. /* AF 1 selection */
  48. #define GPIO_AF1_TIM2 ((uint8_t)0x01) /*!< TIM2 Alternate Function mapping */
  49. /* AF 2 selection */
  50. #define GPIO_AF2_TIM3 ((uint8_t)0x02) /*!< TIM3 Alternate Function mapping */
  51. #define GPIO_AF2_TIM4 ((uint8_t)0x02) /*!< TIM4 Alternate Function mapping */
  52. #if defined (STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L151xE) || defined (STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) || defined (STM32L162xC) || defined (STM32L152xC) || defined (STM32L151xC)
  53. #define GPIO_AF2_TIM5 ((uint8_t)0x02) /*!< TIM5 Alternate Function mapping */
  54. #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD ...STM32L151xC */
  55. /* AF 3 selection */
  56. #define GPIO_AF3_TIM9 ((uint8_t)0x03) /*!< TIM9 Alternate Function mapping */
  57. #define GPIO_AF3_TIM10 ((uint8_t)0x03) /*!< TIM10 Alternate Function mapping */
  58. #define GPIO_AF3_TIM11 ((uint8_t)0x03) /*!< TIM11 Alternate Function mapping */
  59. /* AF 4 selection */
  60. #define GPIO_AF4_I2C1 ((uint8_t)0x04) /*!< I2C1 Alternate Function mapping */
  61. #define GPIO_AF4_I2C2 ((uint8_t)0x04) /*!< I2C2 Alternate Function mapping */
  62. /* AF 5 selection */
  63. #define GPIO_AF5_SPI1 ((uint8_t)0x05) /*!< SPI1/I2S1 Alternate Function mapping */
  64. #define GPIO_AF5_SPI2 ((uint8_t)0x05) /*!< SPI2/I2S2 Alternate Function mapping */
  65. /* AF 6 selection */
  66. #if defined (STM32L100xC) || defined (STM32L151xC) || defined (STM32L151xCA) || defined (STM32L151xD) || defined (STM32L151xE) || defined (STM32L151xDX) ||\
  67. defined (STM32L152xC) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L152xE) || defined (STM32L152xDX) ||\
  68. defined (STM32L162xC) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L162xE) || defined (STM32L162xDX)
  69. #define GPIO_AF6_SPI3 ((uint8_t)0x06) /*!< SPI3/I2S3 Alternate Function mapping */
  70. #endif /* STM32L100xC || STM32L151xC || (...) || STM32L162xD || STM32L162xE || STM32L162xDX */
  71. /* AF 7 selection */
  72. #define GPIO_AF7_USART1 ((uint8_t)0x07) /*!< USART1 Alternate Function mapping */
  73. #define GPIO_AF7_USART2 ((uint8_t)0x07) /*!< USART2 Alternate Function mapping */
  74. #define GPIO_AF7_USART3 ((uint8_t)0x07) /*!< USART3 Alternate Function mapping */
  75. /* AF 8 selection */
  76. #if defined (STM32L151xD) || defined (STM32L151xE) || defined (STM32L151xDX) ||\
  77. defined (STM32L152xD) || defined (STM32L152xE) || defined (STM32L152xDX) ||\
  78. defined (STM32L162xD) || defined (STM32L162xE) || defined (STM32L162xDX)
  79. #define GPIO_AF8_UART4 ((uint8_t)0x08) /*!< UART4 Alternate Function mapping */
  80. #define GPIO_AF8_UART5 ((uint8_t)0x08) /*!< UART5 Alternate Function mapping */
  81. #endif /* STM32L151xD || STM32L151xE || STM32L151xDX || STM32L152xD || STM32L 152xE || STM32L162xD || STM32L162xE || STM32L162xDX */
  82. /* AF 9 selection */
  83. /* AF 10 selection */
  84. /* AF 11 selection */
  85. #if defined (STM32L100xB) || defined (STM32L100xBA) || defined (STM32L100xC) ||\
  86. defined (STM32L152xB) || defined (STM32L152xBA) || defined (STM32L152xC) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L152xE) || defined (STM32L152xDX) ||\
  87. defined (STM32L162xC) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L162xE) || defined (STM32L162xDX)
  88. #define GPIO_AF11_LCD ((uint8_t)0x0B) /*!< LCD Alternate Function mapping */
  89. #endif /* STM32L100xB || STM32L100xBA || STM32L100xC || (...) || STM32L162xCA || STM32L162xD || STM32L162xE || STM32L162xDX */
  90. /* AF 12 selection */
  91. #if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD)
  92. #define GPIO_AF12_FSMC ((uint8_t)0x0C) /*!< FSMC Alternate Function mapping */
  93. #define GPIO_AF12_SDIO ((uint8_t)0x0C) /*!< SDIO Alternate Function mapping */
  94. #endif /* STM32L151xD || STM32L152xD || STM32L162xD */
  95. /* AF 13 selection */
  96. /* AF 14 selection */
  97. #define GPIO_AF14_TIM_IC1 ((uint8_t)0x0E) /*!< TIMER INPUT CAPTURE Alternate Function mapping */
  98. #define GPIO_AF14_TIM_IC2 ((uint8_t)0x0E) /*!< TIMER INPUT CAPTURE Alternate Function mapping */
  99. #define GPIO_AF14_TIM_IC3 ((uint8_t)0x0E) /*!< TIMER INPUT CAPTURE Alternate Function mapping */
  100. #define GPIO_AF14_TIM_IC4 ((uint8_t)0x0E) /*!< TIMER INPUT CAPTURE Alternate Function mapping */
  101. /* AF 15 selection */
  102. #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /*!< EVENTOUT Alternate Function mapping */
  103. /**
  104. * @}
  105. */
  106. /**
  107. * @}
  108. */
  109. /** @defgroup GPIOEx_Private_Macros GPIOEx Private Macros
  110. * @{
  111. */
  112. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x0F)
  113. #if defined (STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L151xE) || defined (STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX)
  114. #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
  115. ((__GPIOx__) == (GPIOB))? 1U :\
  116. ((__GPIOx__) == (GPIOC))? 2U :\
  117. ((__GPIOx__) == (GPIOD))? 3U :\
  118. ((__GPIOx__) == (GPIOE))? 4U :\
  119. ((__GPIOx__) == (GPIOH))? 5U :\
  120. ((__GPIOx__) == (GPIOF))? 6U : 7U)
  121. #endif
  122. #if defined (STM32L151xB) || defined (STM32L151xBA) || defined (STM32L151xC) || defined (STM32L152xB) || defined (STM32L152xBA) || defined (STM32L152xC) || defined (STM32L162xC)
  123. #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
  124. ((__GPIOx__) == (GPIOB))? 1U :\
  125. ((__GPIOx__) == (GPIOC))? 2U :\
  126. ((__GPIOx__) == (GPIOD))? 3U :\
  127. ((__GPIOx__) == (GPIOE))? 4U : 5U)
  128. #endif
  129. #if defined (STM32L100xB) || defined (STM32L100xBA) || defined (STM32L100xC)
  130. #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
  131. ((__GPIOx__) == (GPIOB))? 1U :\
  132. ((__GPIOx__) == (GPIOC))? 2U :\
  133. ((__GPIOx__) == (GPIOD))? 3U : 5U)
  134. #endif
  135. /**
  136. * @}
  137. */
  138. /* Exported macro ------------------------------------------------------------*/
  139. /* Exported functions --------------------------------------------------------*/
  140. /**
  141. * @}
  142. */
  143. /**
  144. * @}
  145. */
  146. #ifdef __cplusplus
  147. }
  148. #endif
  149. #endif /* __STM32L1xx_HAL_GPIO_EX_H */
  150. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/