STM32L152C-Discovery BSP User Manual
|
stm32l152c_discovery.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l152c_discovery.h 00004 * @author MCD Application Team 00005 * @brief This file contains definitions for STM32L152C-Discovery Leds, push-buttons 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> 00010 * 00011 * Redistribution and use in source and binary forms, with or without modification, 00012 * are permitted provided that the following conditions are met: 00013 * 1. Redistributions of source code must retain the above copyright notice, 00014 * this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright notice, 00016 * this list of conditions and the following disclaimer in the documentation 00017 * and/or other materials provided with the distribution. 00018 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00019 * may be used to endorse or promote products derived from this software 00020 * without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00023 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00025 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00026 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00027 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00028 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00030 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 * 00033 ****************************************************************************** 00034 */ 00035 00036 /** @addtogroup BSP 00037 * @{ 00038 */ 00039 00040 /** @addtogroup STM32L152C_DISCOVERY 00041 * @{ 00042 */ 00043 00044 /** @addtogroup STM32L152C_Discovery_Common 00045 * @{ 00046 */ 00047 00048 /* Define to prevent recursive inclusion -------------------------------------*/ 00049 #ifndef __STM32L152C_DISCOVERY_H 00050 #define __STM32L152C_DISCOVERY_H 00051 00052 #ifdef __cplusplus 00053 extern "C" { 00054 #endif 00055 00056 /* Includes ------------------------------------------------------------------*/ 00057 #include "stm32l1xx_hal.h" 00058 00059 00060 /** @defgroup STM32L152C_DISCOVERY_Exported_Types Exported Types 00061 * @{ 00062 */ 00063 typedef enum 00064 { 00065 LED3 = 0, 00066 LED4 = 1, 00067 00068 LED_GREEN = LED3, 00069 LED_BLUE = LED4 00070 00071 } Led_TypeDef; 00072 00073 typedef enum 00074 { 00075 BUTTON_USER = 0, 00076 } Button_TypeDef; 00077 00078 typedef enum 00079 { 00080 BUTTON_MODE_GPIO = 0, 00081 BUTTON_MODE_EXTI = 1 00082 } ButtonMode_TypeDef; 00083 /** 00084 * @} 00085 */ 00086 00087 /** @defgroup STM32L152C_DISCOVERY_Exported_Constants Exported Constants 00088 * @{ 00089 */ 00090 00091 /** 00092 * @brief Define for STM32L152C-Discovery board 00093 */ 00094 #if !defined (USE_STM32L152C_DISCO) 00095 #define USE_STM32L152C_DISCO 00096 #endif 00097 00098 /** @addtogroup STM32L152C_DISCOVERY_LED LED Constants 00099 * @{ 00100 */ 00101 #define LEDn 2 00102 00103 #define LED3_PIN GPIO_PIN_7 /* PB.07 */ 00104 #define LED3_GPIO_PORT GPIOB 00105 #define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00106 #define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00107 00108 #define LED4_PIN GPIO_PIN_6 /* PB.06 */ 00109 #define LED4_GPIO_PORT GPIOB 00110 #define LED4_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00111 #define LED4_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00112 00113 #define LEDx_GPIO_CLK_ENABLE(__INDEX__) do { if ((__INDEX__) == 0) LED3_GPIO_CLK_ENABLE(); else LED4_GPIO_CLK_ENABLE();} while(0) 00114 00115 #define LEDx_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? LED3_GPIO_CLK_DISABLE() : LED4_GPIO_CLK_DISABLE()) 00116 /** 00117 * @} 00118 */ 00119 00120 /** @addtogroup STM32L152C_DISCOVERY_BUTTON BUTTON Constants 00121 * @{ 00122 */ 00123 #define BUTTONn 1 00124 /** 00125 * @brief USER push-button 00126 */ 00127 #define USER_BUTTON_PIN GPIO_PIN_0 /* PA.00 */ 00128 #define USER_BUTTON_GPIO_PORT GPIOA 00129 #define USER_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00130 #define USER_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00131 #define USER_BUTTON_EXTI_IRQn EXTI0_IRQn 00132 00133 #define BUTTONx_GPIO_CLK_ENABLE(__INDEX__) do { USER_BUTTON_GPIO_CLK_ENABLE();} while(0) 00134 00135 #define BUTTONx_GPIO_CLK_DISABLE(__INDEX__) (USER_BUTTON_GPIO_CLK_DISABLE()) 00136 00137 /** 00138 * @} 00139 */ 00140 00141 /** 00142 * @} 00143 */ 00144 00145 00146 /** @addtogroup STM32L152C_DISCOVERY_Exported_Functions 00147 * @{ 00148 */ 00149 uint32_t BSP_GetVersion(void); 00150 00151 /** @addtogroup STM32152C_DISCOVERY_LED_Functions 00152 * @{ 00153 */ 00154 void BSP_LED_Init(Led_TypeDef Led); 00155 void BSP_LED_On(Led_TypeDef Led); 00156 void BSP_LED_Off(Led_TypeDef Led); 00157 void BSP_LED_Toggle(Led_TypeDef Led); 00158 00159 /** 00160 * @} 00161 */ 00162 00163 /** @addtogroup STM32152C_DISCOVERY_BUTTON_Functions 00164 * @{ 00165 */ 00166 00167 void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef Mode); 00168 uint32_t BSP_PB_GetState(Button_TypeDef Button); 00169 00170 /** 00171 * @} 00172 */ 00173 00174 /** 00175 * @} 00176 */ 00177 00178 /** 00179 * @} 00180 */ 00181 00182 #ifdef __cplusplus 00183 } 00184 #endif 00185 00186 #endif /* __STM32L152C_DISCOVERY_H */ 00187 00188 /** 00189 * @} 00190 */ 00191 00192 /** 00193 * @} 00194 */ 00195 00196 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Thu Aug 24 2017 17:55:24 for STM32L152C-Discovery BSP User Manual by
![doxygen](doxygen.png)