STM32VL-Discovery BSP User Manual: stm32vl_discovery.h Source File

STM32VL Discovery BSP

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