STM32F3348-Discovery BSP User Manual: stm32f3348_discovery.h Source File

STM32F3348-Discovery BSP Drivers

stm32f3348_discovery.h
Go to the documentation of this file.
00001 /** 
00002   ******************************************************************************
00003   * @file    stm32f3348_discovery.h
00004   * @author  MCD Application Team
00005   * @brief   This file contains definitions for STM32F3348-DISCO Kit's Leds and
00006   *          push-button hardware resources.
00007   ******************************************************************************
00008   * @attention
00009   *
00010   * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
00011   *
00012   * Redistribution and use in source and binary forms, with or without modification,
00013   * are permitted provided that the following conditions are met:
00014   *   1. Redistributions of source code must retain the above copyright notice,
00015   *      this list of conditions and the following disclaimer.
00016   *   2. Redistributions in binary form must reproduce the above copyright notice,
00017   *      this list of conditions and the following disclaimer in the documentation
00018   *      and/or other materials provided with the distribution.
00019   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00020   *      may be used to endorse or promote products derived from this software
00021   *      without specific prior written permission.
00022   *
00023   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00026   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00027   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00028   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00029   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00031   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00032   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033   *
00034   ******************************************************************************
00035   */
00036   
00037 /* Define to prevent recursive inclusion -------------------------------------*/
00038 #ifndef __STM32F3348_DISCOVERY_H
00039 #define __STM32F3348_DISCOVERY_H
00040 
00041 #ifdef __cplusplus
00042  extern "C" {
00043 #endif
00044                                               
00045 /** @addtogroup BSP
00046   * @{
00047   */
00048 
00049 /** @defgroup STM32F3348_DISCOVERY STM32F3348-DISCOVERY
00050   * @{
00051   */ 
00052  
00053 /* Includes ------------------------------------------------------------------*/
00054 #include "stm32f3xx_hal.h"
00055    
00056 /** @defgroup STM32F3348_DISCOVERY_Common STM32F3348-DISCOVERY Common
00057   * @{
00058   */
00059   
00060 /** @defgroup STM32F3348_DISCOVERY_Private_Constants Private Constants
00061   * @{
00062   */
00063 /**
00064 * @}
00065 */        
00066       
00067 /** @defgroup STM32F3348_DISCOVERY_Private_Variables Private Variables
00068   * @{
00069   */ 
00070 /**
00071 * @}
00072   */ 
00073 
00074 /** @defgroup STM32F3348_DISCOVERY_Exported_Types Exported Types
00075   * @{
00076   */
00077 
00078 /**
00079  * @brief LED Types Definition
00080  */
00081 typedef enum
00082 {
00083   LED3 = 0,
00084   LED4 = 1,
00085   LED5 = 2,
00086   LED6 = 3,
00087 
00088   LED_GREEN  = LED5,
00089   LED_ORANGE = LED4, 
00090   LED_RED    = LED3, 
00091   LED_BLUE   = LED6
00092 }Led_TypeDef;
00093 
00094 /**
00095  * @brief BUTTON Types Definition
00096  */
00097 typedef enum 
00098 {
00099   BUTTON_USER = 0,
00100 }Button_TypeDef;
00101 
00102 typedef enum 
00103 {  
00104   BUTTON_MODE_GPIO = 0,
00105   BUTTON_MODE_EXTI = 1
00106 
00107 }ButtonMode_TypeDef;
00108 
00109 
00110 /**
00111   * @}
00112   */ 
00113 
00114 /** @defgroup STM32F3348_DISCOVERY_Exported_Constants Exported Constants
00115   * @{ 
00116   */ 
00117 
00118 /** 
00119 * @brief  Define for STM32F3348_DISCOVERY board  
00120 */ 
00121 #if !defined (USE_STM32F3348_DISCO)
00122  #define USE_STM32F3348_DISCO
00123 #endif
00124 
00125 /** @defgroup STM32F3348_DISCOVERY_LED STM32F3348-DISCOVERY LED
00126   * @{
00127   */
00128 
00129 #define LEDn                             4
00130 
00131 #define LED3_PIN                         GPIO_PIN_6
00132 #define LED3_GPIO_PORT                   GPIOB
00133 #define LED3_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOB_CLK_ENABLE()  
00134 #define LED3_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOB_CLK_DISABLE()  
00135 
00136 #define LED4_PIN                         GPIO_PIN_8
00137 #define LED4_GPIO_PORT                   GPIOB
00138 #define LED4_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOB_CLK_ENABLE()  
00139 #define LED4_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOB_CLK_DISABLE()  
00140 
00141 #define LED5_PIN                         GPIO_PIN_9
00142 #define LED5_GPIO_PORT                   GPIOB
00143 #define LED5_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOB_CLK_ENABLE()  
00144 #define LED5_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOB_CLK_DISABLE()  
00145 
00146 #define LED6_PIN                         GPIO_PIN_7
00147 #define LED6_GPIO_PORT                   GPIOB
00148 #define LED6_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOB_CLK_ENABLE()  
00149 #define LED6_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOB_CLK_DISABLE()  
00150 
00151 
00152 
00153 #define LEDx_GPIO_CLK_ENABLE(__LED__)   do { if ((__LED__) == LED3) LED3_GPIO_CLK_ENABLE(); else\
00154                                              if ((__LED__) == LED4) LED4_GPIO_CLK_ENABLE(); else\
00155                                              if ((__LED__) == LED5) LED5_GPIO_CLK_ENABLE(); else\
00156                                              if ((__LED__) == LED6) LED6_GPIO_CLK_ENABLE();} while(0)
00157 
00158 #define LEDx_GPIO_CLK_DISABLE(__LED__)  (((__LED__) == LED3) ? LED3_GPIO_CLK_DISABLE() :\
00159                                          ((__LED__) == LED4) ? LED4_GPIO_CLK_DISABLE() :\
00160                                          ((__LED__) == LED5) ? LED5_GPIO_CLK_DISABLE() :\
00161                                          ((__LED__) == LED6) ? LED6_GPIO_CLK_DISABLE() : 0 )
00162 /**
00163   * @}
00164   */ 
00165   
00166 /** @defgroup STM32F3348_DISCOVERY_BUTTON STM32F3348-DISCOVERY BUTTON
00167   * @{
00168   */  
00169 #define BUTTONn                          1  
00170 
00171 /**
00172  * @brief push-button
00173  */
00174 #define USER_BUTTON_PIN                  GPIO_PIN_0
00175 #define USER_BUTTON_GPIO_PORT            GPIOA
00176 #define USER_BUTTON_GPIO_CLK_ENABLE()    __HAL_RCC_GPIOA_CLK_ENABLE()
00177 #define USER_BUTTON_GPIO_CLK_DISABLE()   __HAL_RCC_GPIOA_CLK_DISABLE()
00178 #define USER_BUTTON_EXTI_IRQn            EXTI0_IRQn 
00179 
00180 #define BUTTONx_GPIO_CLK_ENABLE(__BUTTON__)  do { if ((__BUTTON__) == BUTTON_USER) USER_BUTTON_GPIO_CLK_ENABLE();} while(0)
00181 
00182 #define BUTTONx_GPIO_CLK_DISABLE(__BUTTON__) (((__BUTTON__) == BUTTON_USER) ? USER_BUTTON_GPIO_CLK_DISABLE() : 0 )
00183 
00184 /**
00185   * @}
00186   */
00187 
00188 /**
00189   * @}
00190   */ 
00191 
00192 /** @defgroup STM32F3348_DISCOVERY_Exported_Functions Exported Functions
00193   * @{
00194   */
00195 uint32_t  BSP_GetVersion(void);
00196 void      BSP_LED_Init(Led_TypeDef Led);
00197 void      BSP_LED_On(Led_TypeDef Led);
00198 void      BSP_LED_Off(Led_TypeDef Led);
00199 void      BSP_LED_Toggle(Led_TypeDef Led);
00200 void      BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
00201 uint32_t  BSP_PB_GetState(Button_TypeDef Button);
00202 
00203  
00204 /**
00205   * @}
00206   */
00207   
00208 /**
00209   * @}
00210   */ 
00211 
00212 /**
00213   * @}
00214   */ 
00215 
00216 /**
00217   * @}
00218   */
00219 
00220 #ifdef __cplusplus
00221 }
00222 #endif
00223 
00224 #endif /* __STM32F3348_DISCOVERY_H */
00225 
00226 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Wed May 31 2017 10:51:50 for STM32F3348-Discovery BSP User Manual by   doxygen 1.7.6.1