STM3210E_EVAL BSP User Manual: stm3210e_eval.h Source File

STM3210E EVAL BSP Drivers

stm3210e_eval.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm3210e_eval.h
00004   * @author  MCD Application Team
00005   * @version V6.0.1
00006   * @date    18-December-2015
00007   * @brief   This file contains definitions for STM3210E_EVAL's LEDs, 
00008   *          push-buttons and COM ports hardware resources.
00009   ******************************************************************************
00010   * @attention
00011   *
00012   * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
00013   *
00014   * Redistribution and use in source and binary forms, with or without modification,
00015   * are permitted provided that the following conditions are met:
00016   *   1. Redistributions of source code must retain the above copyright notice,
00017   *      this list of conditions and the following disclaimer.
00018   *   2. Redistributions in binary form must reproduce the above copyright notice,
00019   *      this list of conditions and the following disclaimer in the documentation
00020   *      and/or other materials provided with the distribution.
00021   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00022   *      may be used to endorse or promote products derived from this software
00023   *      without specific prior written permission.
00024   *
00025   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00026   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00028   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00029   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00030   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00031   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00032   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00033   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00034   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00035   *
00036   ******************************************************************************
00037   */
00038 
00039 /* Define to prevent recursive inclusion -------------------------------------*/
00040 #ifndef __STM3210E_EVAL_H
00041 #define __STM3210E_EVAL_H
00042 
00043 #ifdef __cplusplus
00044  extern "C" {
00045 #endif 
00046 
00047 /** @addtogroup BSP
00048   * @{
00049   */ 
00050 
00051 /** @addtogroup STM3210E_EVAL
00052   * @{
00053   */ 
00054 
00055 /* Includes ------------------------------------------------------------------*/
00056 #include "stm32f1xx_hal.h"
00057 
00058 /** @addtogroup STM3210E_EVAL_Common STM3210E-EVAL Common
00059   * @{
00060   */ 
00061 
00062 /** @defgroup STM3210E_EVAL_Exported_Types Exported Types
00063   * @{
00064   */
00065 
00066 /**
00067  * @brief LED Types Definition
00068  */
00069 typedef enum 
00070 {
00071   LED1 = 0,
00072   LED2 = 1,
00073   LED3 = 2,
00074   LED4 = 3,
00075 
00076   LED_GREEN  = LED1,
00077   LED_ORANGE = LED2,
00078   LED_RED    = LED3,
00079   LED_BLUE   = LED4
00080 
00081 } Led_TypeDef;
00082 
00083 /**
00084  * @brief BUTTON Types Definition
00085  */
00086 typedef enum 
00087 {
00088   BUTTON_WAKEUP = 0,
00089   BUTTON_TAMPER = 1,
00090   BUTTON_KEY    = 2,
00091   BUTTON_SEL    = 3,
00092   BUTTON_LEFT   = 4,
00093   BUTTON_RIGHT  = 5,
00094   BUTTON_DOWN   = 6,
00095   BUTTON_UP     = 7,
00096 
00097 } Button_TypeDef;
00098 
00099 typedef enum 
00100 {  
00101   BUTTON_MODE_GPIO = 0,
00102   BUTTON_MODE_EXTI = 1,
00103   BUTTON_MODE_EVT  = 2
00104 
00105 } ButtonMode_TypeDef;
00106 
00107 /**
00108  * @brief JOYSTICK Types Definition
00109  */
00110 typedef enum 
00111 { 
00112   JOY_SEL   = 0,
00113   JOY_LEFT  = 1,
00114   JOY_RIGHT = 2,
00115   JOY_DOWN  = 3,
00116   JOY_UP    = 4,
00117   JOY_NONE  = 5
00118 
00119 }JOYState_TypeDef;
00120 
00121 typedef enum 
00122 { 
00123   JOY_MODE_GPIO = 0,
00124   JOY_MODE_EXTI = 1
00125 
00126 }JOYMode_TypeDef;
00127 
00128 /**
00129  * @brief COM Types Definition
00130  */
00131 typedef enum 
00132 {
00133   COM1 = 0,
00134   COM2 = 1
00135 
00136 } COM_TypeDef;  
00137 
00138 /**
00139   * @}
00140   */ 
00141 
00142 /** @defgroup STM3210E_EVAL_Exported_Constants Exported Constants
00143   * @{
00144   */ 
00145 
00146 /** 
00147   * @brief  Define for STM3210E_EVAL board  
00148   */ 
00149 #if !defined (USE_STM3210E_EVAL)
00150  #define USE_STM3210E_EVAL
00151 #endif
00152   
00153 /** @addtogroup STM3210E_EVAL_LED
00154   * @{
00155   */
00156 #define LEDn                             4
00157 
00158 #define LED1_PIN                         GPIO_PIN_6             /* PF.06*/
00159 #define LED1_GPIO_PORT                   GPIOF
00160 #define LED1_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOF_CLK_ENABLE()
00161 #define LED1_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOF_CLK_DISABLE()
00162   
00163 #define LED2_PIN                         GPIO_PIN_7             /* PF.07*/
00164 #define LED2_GPIO_PORT                   GPIOF
00165 #define LED2_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOF_CLK_ENABLE()
00166 #define LED2_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOF_CLK_DISABLE()
00167 
00168 
00169 #define LED3_PIN                         GPIO_PIN_8            /* PF.08*/
00170 #define LED3_GPIO_PORT                   GPIOF
00171 #define LED3_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOF_CLK_ENABLE()
00172 #define LED3_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOF_CLK_DISABLE()
00173 
00174 
00175 #define LED4_PIN                         GPIO_PIN_9            /* PF.09*/
00176 #define LED4_GPIO_PORT                   GPIOF
00177 #define LED4_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOF_CLK_ENABLE()
00178 #define LED4_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOF_CLK_DISABLE()
00179 
00180 #define LEDx_GPIO_CLK_ENABLE(__LED__) do { if ((__LED__) == LED1) LED1_GPIO_CLK_ENABLE(); else\
00181                                            if ((__LED__) == LED2) LED2_GPIO_CLK_ENABLE(); else \
00182                                            if ((__LED__) == LED3) LED3_GPIO_CLK_ENABLE(); else\
00183                                            if ((__LED__) == LED4) LED4_GPIO_CLK_ENABLE();} while(0)
00184 
00185 #define LEDx_GPIO_CLK_DISABLE(__LED__)   (((__LED__) == LED1) ? LED1_GPIO_CLK_DISABLE() :\
00186                                           ((__LED__) == LED2) ? LED2_GPIO_CLK_DISABLE() :\
00187                                           ((__LED__) == LED3) ? LED3_GPIO_CLK_DISABLE() :\
00188                                           ((__LED__) == LED4) ? LED4_GPIO_CLK_DISABLE() : 0 )
00189 
00190 /**
00191   * @}
00192   */
00193   
00194 /** @addtogroup STM3210E_EVAL_BUTTON
00195   * @{
00196   */  
00197 #define JOYn                             5
00198 #define BUTTONn                          3 + JOYn
00199 
00200 /**
00201  * @brief Tamper push-button
00202  */
00203 #define TAMPER_BUTTON_PIN                   GPIO_PIN_13             /* PC.13*/
00204 #define TAMPER_BUTTON_GPIO_PORT             GPIOC
00205 #define TAMPER_BUTTON_GPIO_CLK_ENABLE()     __HAL_RCC_GPIOC_CLK_ENABLE()
00206 #define TAMPER_BUTTON_GPIO_CLK_DISABLE()    __HAL_RCC_GPIOC_CLK_DISABLE()
00207 #define TAMPER_BUTTON_EXTI_IRQn             EXTI15_10_IRQn
00208 
00209 /**
00210  * @brief Key push-button
00211  */
00212 #define KEY_BUTTON_PIN                      GPIO_PIN_8             /* PG.08*/
00213 #define KEY_BUTTON_GPIO_PORT                GPIOG
00214 #define KEY_BUTTON_GPIO_CLK_ENABLE()        __HAL_RCC_GPIOG_CLK_ENABLE()
00215 #define KEY_BUTTON_GPIO_CLK_DISABLE()       __HAL_RCC_GPIOG_CLK_DISABLE()
00216 #define KEY_BUTTON_EXTI_IRQn                EXTI9_5_IRQn
00217 
00218 /**
00219  * @brief Wake-up push-button
00220  */
00221 #define WAKEUP_BUTTON_PIN                   GPIO_PIN_0             /* PA.00*/
00222 #define WAKEUP_BUTTON_GPIO_PORT             GPIOA
00223 #define WAKEUP_BUTTON_GPIO_CLK_ENABLE()     __HAL_RCC_GPIOA_CLK_ENABLE()
00224 #define WAKEUP_BUTTON_GPIO_CLK_DISABLE()    __HAL_RCC_GPIOA_CLK_DISABLE()
00225 #define WAKEUP_BUTTON_EXTI_IRQn             EXTI0_IRQn
00226 
00227 /**
00228  * @brief Joystick Right push-button
00229  */
00230 #define RIGHT_JOY_PIN                       GPIO_PIN_13             /* PG.13*/
00231 #define RIGHT_JOY_GPIO_PORT                 GPIOG
00232 #define RIGHT_JOY_GPIO_CLK_ENABLE()         __HAL_RCC_GPIOG_CLK_ENABLE()
00233 #define RIGHT_JOY_GPIO_CLK_DISABLE()        __HAL_RCC_GPIOG_CLK_DISABLE()
00234 #define RIGHT_JOY_EXTI_IRQn                 EXTI15_10_IRQn
00235 
00236 /**
00237  * @brief Joystick Left push-button
00238  */    
00239 #define LEFT_JOY_PIN                        GPIO_PIN_14             /* PG.14*/
00240 #define LEFT_JOY_GPIO_PORT                  GPIOG
00241 #define LEFT_JOY_GPIO_CLK_ENABLE()          __HAL_RCC_GPIOG_CLK_ENABLE()
00242 #define LEFT_JOY_GPIO_CLK_DISABLE()         __HAL_RCC_GPIOG_CLK_DISABLE()
00243 #define LEFT_JOY_EXTI_IRQn                  EXTI15_10_IRQn
00244 
00245 /**
00246  * @brief Joystick Up push-button
00247  */
00248 #define UP_JOY_PIN                          GPIO_PIN_15             /* PG.15*/
00249 #define UP_JOY_GPIO_PORT                    GPIOG
00250 #define UP_JOY_GPIO_CLK_ENABLE()            __HAL_RCC_GPIOG_CLK_ENABLE()
00251 #define UP_JOY_GPIO_CLK_DISABLE()           __HAL_RCC_GPIOG_CLK_DISABLE()
00252 #define UP_JOY_EXTI_IRQn                    EXTI15_10_IRQn
00253 
00254 /**
00255  * @brief Joystick Down push-button
00256  */   
00257 #define DOWN_JOY_PIN                        GPIO_PIN_3             /* PD.03*/
00258 #define DOWN_JOY_GPIO_PORT                  GPIOD
00259 #define DOWN_JOY_GPIO_CLK_ENABLE()          __HAL_RCC_GPIOD_CLK_ENABLE()
00260 #define DOWN_JOY_GPIO_CLK_DISABLE()         __HAL_RCC_GPIOD_CLK_DISABLE()
00261 #define DOWN_JOY_EXTI_IRQn                  EXTI3_IRQn
00262 
00263 /**
00264  * @brief Joystick Sel push-button
00265  */  
00266 #define SEL_JOY_PIN                         GPIO_PIN_7             /* PG.07*/
00267 #define SEL_JOY_GPIO_PORT                   GPIOG
00268 #define SEL_JOY_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOG_CLK_ENABLE()
00269 #define SEL_JOY_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOG_CLK_DISABLE()
00270 #define SEL_JOY_EXTI_IRQn                   EXTI9_5_IRQn
00271 
00272 #define BUTTONx_GPIO_CLK_ENABLE(__BUTTON__) do { if ((__BUTTON__) == BUTTON_TAMPER) TAMPER_BUTTON_GPIO_CLK_ENABLE(); else\
00273                                                  if ((__BUTTON__) == BUTTON_KEY) KEY_BUTTON_GPIO_CLK_ENABLE(); else\
00274                                                  if ((__BUTTON__) == BUTTON_WAKEUP) WAKEUP_BUTTON_GPIO_CLK_ENABLE(); else\
00275                                                  if ((__BUTTON__) == BUTTON_SEL) SEL_JOY_GPIO_CLK_ENABLE(); else\
00276                                                  if ((__BUTTON__) == BUTTON_LEFT) LEFT_JOY_GPIO_CLK_ENABLE(); else\
00277                                                  if ((__BUTTON__) == BUTTON_RIGHT) RIGHT_JOY_GPIO_CLK_ENABLE(); else\
00278                                                  if ((__BUTTON__) == BUTTON_DOWN) DOWN_JOY_GPIO_CLK_ENABLE(); else\
00279                                                  if ((__BUTTON__) == BUTTON_UP) UP_JOY_GPIO_CLK_ENABLE();} while(0)
00280 
00281 #define BUTTONx_GPIO_CLK_DISABLE(__BUTTON__)    (((__BUTTON__) == BUTTON_TAMPER) ? TAMPER_BUTTON_GPIO_CLK_DISABLE()  :\
00282                                                  ((__BUTTON__) == BUTTON_KEY) ? KEY_BUTTON_GPIO_CLK_DISABLE()  :\
00283                                                  ((__BUTTON__) == BUTTON_WAKEUP) ? WAKEUP_BUTTON_GPIO_CLK_DISABLE()  :\
00284                                                  ((__BUTTON__) == BUTTON_SEL) ? SEL_JOY_GPIO_CLK_DISABLE()  :\
00285                                                  ((__BUTTON__) == BUTTON_LEFT) ? LEFT_JOY_GPIO_CLK_DISABLE()  :\
00286                                                  ((__BUTTON__) == BUTTON_RIGHT) ? RIGHT_JOY_GPIO_CLK_DISABLE()  :\
00287                                                  ((__BUTTON__) == BUTTON_DOWN) ? DOWN_JOY_GPIO_CLK_DISABLE()  :\
00288                                                  ((__BUTTON__) == BUTTON_UP) ? UP_JOY_GPIO_CLK_DISABLE() : 0 )
00289 
00290 #define JOYx_GPIO_CLK_ENABLE(__JOY__)    do { if ((__JOY__) == JOY_SEL) SEL_JOY_GPIO_CLK_ENABLE(); else\
00291                                               if ((__JOY__) == JOY_LEFT) LEFT_JOY_GPIO_CLK_ENABLE(); else\
00292                                               if ((__JOY__) == JOY_RIGHT) RIGHT_JOY_GPIO_CLK_ENABLE(); else\
00293                                               if ((__JOY__) == JOY_DOWN) DOWN_JOY_GPIO_CLK_ENABLE(); else\
00294                                               if ((__JOY__) == JOY_UP) UP_JOY_GPIO_CLK_ENABLE();} while(0)
00295 
00296 #define JOYx_GPIO_CLK_DISABLE(__JOY__)   (((__JOY__) == JOY_SEL) ? SEL_JOY_GPIO_CLK_DISABLE() :\
00297                                           ((__JOY__) == JOY_LEFT) ? LEFT_JOY_GPIO_CLK_DISABLE() :\
00298                                           ((__JOY__) == JOY_RIGHT) ? RIGHT_JOY_GPIO_CLK_DISABLE() :\
00299                                           ((__JOY__) == JOY_DOWN) ? DOWN_JOY_GPIO_CLK_DISABLE() :\
00300                                           ((__JOY__) == JOY_UP) ? UP_JOY_GPIO_CLK_DISABLE() : 0 )
00301 
00302 /**
00303   * @}
00304   */ 
00305 
00306 /** @addtogroup STM3210E_EVAL_COM
00307   * @{
00308   */
00309 #define COMn                             2
00310 
00311 /**
00312  * @brief Definition for COM port1, connected to USART1
00313  */ 
00314 #define EVAL_COM1                        USART1
00315 #define EVAL_COM1_CLK_ENABLE()           __HAL_RCC_USART1_CLK_ENABLE()
00316 #define EVAL_COM1_CLK_DISABLE()          __HAL_RCC_USART1_CLK_DISABLE()
00317 
00318 #define EVAL_COM1_TX_PIN                 GPIO_PIN_9             /* PA.09*/
00319 #define EVAL_COM1_TX_GPIO_PORT           GPIOA
00320 #define EVAL_COM1_TX_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOA_CLK_ENABLE()
00321 #define EVAL_COM1_TX_GPIO_CLK_DISABLE()  __HAL_RCC_GPIOA_CLK_DISABLE()
00322 
00323 #define EVAL_COM1_RX_PIN                 GPIO_PIN_10             /* PA.10*/
00324 #define EVAL_COM1_RX_GPIO_PORT           GPIOA
00325 #define EVAL_COM1_RX_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOA_CLK_ENABLE()
00326 #define EVAL_COM1_RX_GPIO_CLK_DISABLE()  __HAL_RCC_GPIOA_CLK_DISABLE()
00327 
00328 #define EVAL_COM1_IRQn                   USART1_IRQn
00329 
00330 /**
00331  * @brief Definition for COM port2, connected to USART2
00332  */ 
00333 #define EVAL_COM2                        USART2
00334 #define EVAL_COM2_CLK_ENABLE()           __HAL_RCC_USART2_CLK_ENABLE()
00335 #define EVAL_COM2_CLK_DISABLE()          __HAL_RCC_USART2_CLK_DISABLE()
00336 
00337 #define EVAL_COM2_TX_PIN                 GPIO_PIN_2             /* PA.02*/
00338 #define EVAL_COM2_TX_GPIO_PORT           GPIOA
00339 #define EVAL_COM2_TX_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOA_CLK_ENABLE()
00340 #define EVAL_COM2_TX_GPIO_CLK_DISABLE()  __HAL_RCC_GPIOA_CLK_DISABLE()
00341 
00342 #define EVAL_COM2_RX_PIN                 GPIO_PIN_3             /* PA.03*/
00343 #define EVAL_COM2_RX_GPIO_PORT           GPIOA
00344 #define EVAL_COM2_RX_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOA_CLK_ENABLE()
00345 #define EVAL_COM2_RX_GPIO_CLK_DISABLE()  __HAL_RCC_GPIOA_CLK_DISABLE()
00346 
00347 #define EVAL_COM2_IRQn                   USART2_IRQn
00348 
00349 #define COMx_CLK_ENABLE(__INDEX__)              do { if((__INDEX__) == COM1) EVAL_COM1_CLK_ENABLE(); else\
00350                                                      if((__INDEX__) == COM2) EVAL_COM2_CLK_ENABLE();} while(0)
00351 
00352 #define COMx_CLK_DISABLE(__INDEX__)             (((__INDEX__) == COM1) ? EVAL_COM1_CLK_DISABLE() :\
00353                                                  ((__INDEX__) == COM2) ? EVAL_COM2_CLK_DISABLE() : 0)
00354 
00355 #define COMx_TX_GPIO_CLK_ENABLE(__INDEX__)      do { if((__INDEX__) == COM1) EVAL_COM1_TX_GPIO_CLK_ENABLE(); else\
00356                                                      if((__INDEX__) == COM2) EVAL_COM2_TX_GPIO_CLK_ENABLE();} while(0)
00357 
00358 #define COMx_TX_GPIO_CLK_DISABLE(__INDEX__)     (((__INDEX__) == COM1) ? EVAL_COM1_TX_GPIO_CLK_DISABLE() :\
00359                                                  ((__INDEX__) == COM2) ? EVAL_COM2_TX_GPIO_CLK_DISABLE() : 0)
00360 
00361 #define COMx_RX_GPIO_CLK_ENABLE(__INDEX__)      do { if((__INDEX__) == COM1) EVAL_COM1_RX_GPIO_CLK_ENABLE(); else\
00362                                                      if((__INDEX__) == COM2) EVAL_COM2_RX_GPIO_CLK_ENABLE();} while(0)
00363 
00364 #define COMx_RX_GPIO_CLK_DISABLE(__INDEX__)     (((__INDEX__) == COM1) ? EVAL_COM1_RX_GPIO_CLK_DISABLE() :\
00365                                                  ((__INDEX__) == COM2) ? EVAL_COM2_RX_GPIO_CLK_DISABLE() : 0)
00366 
00367 /**
00368   * @}
00369   */ 
00370 
00371 /** @addtogroup STM3210E_EVAL_BUS
00372   * @{
00373   */
00374 
00375 /* Exported constant IO ------------------------------------------------------*/
00376 /*##################### I2Cx ###################################*/
00377 /* User can use this section to tailor I2Cx instance used and associated 
00378    resources */
00379 /* Definition for I2Cx Pins */
00380 #define EVAL_I2Cx_SCL_PIN                       GPIO_PIN_6        /* PB.06*/
00381 #define EVAL_I2Cx_SCL_GPIO_PORT                 GPIOB
00382 #define EVAL_I2Cx_SDA_PIN                       GPIO_PIN_7        /* PB.07*/
00383 #define EVAL_I2Cx_SDA_GPIO_PORT                 GPIOB
00384 
00385 /* Definition for I2Cx clock resources */
00386 #define EVAL_I2Cx                               I2C1
00387 #define EVAL_I2Cx_CLK_ENABLE()                  __HAL_RCC_I2C1_CLK_ENABLE()
00388 #define EVAL_I2Cx_SDA_GPIO_CLK_ENABLE()         __HAL_RCC_GPIOB_CLK_ENABLE()
00389 #define EVAL_I2Cx_SCL_GPIO_CLK_ENABLE()         __HAL_RCC_GPIOB_CLK_ENABLE() 
00390 
00391 #define EVAL_I2Cx_FORCE_RESET()                 __HAL_RCC_I2C1_FORCE_RESET()
00392 #define EVAL_I2Cx_RELEASE_RESET()               __HAL_RCC_I2C1_RELEASE_RESET()
00393     
00394 /* Definition for I2Cx's NVIC */
00395 #define EVAL_I2Cx_EV_IRQn                       I2C1_EV_IRQn
00396 #define EVAL_I2Cx_EV_IRQHandler                 I2C1_EV_IRQHandler
00397 #define EVAL_I2Cx_ER_IRQn                       I2C1_ER_IRQn
00398 #define EVAL_I2Cx_ER_IRQHandler                 I2C1_ER_IRQHandler
00399 
00400 /* I2C clock speed configuration (in Hz) 
00401    WARNING: 
00402    Make sure that this define is not already declared in other files (ie. 
00403    stm3210e_eval.h file). It can be used in parallel by other modules. */
00404 #ifndef BSP_I2C_SPEED
00405  #define BSP_I2C_SPEED                            100000
00406 #endif /* I2C_SPEED */
00407 
00408 
00409 /* Maximum Timeout values for flags waiting loops. These timeouts are not based
00410    on accurate values, they just guarantee that the application will not remain
00411    stuck if the I2C communication is corrupted.
00412    You may modify these timeout values depending on CPU frequency and application
00413    conditions (interrupts routines ...). */   
00414 #define EVAL_I2Cx_TIMEOUT_MAX                   3000
00415 
00416 /*##################### SPIx ###################################*/
00417 #define EVAL_SPIx                               SPI1
00418 #define EVAL_SPIx_CLK_ENABLE()                  __HAL_RCC_SPI1_CLK_ENABLE()
00419 
00420 #define EVAL_SPIx_SCK_GPIO_PORT                 GPIOA             /* PA.05*/
00421 #define EVAL_SPIx_SCK_PIN                       GPIO_PIN_5
00422 #define EVAL_SPIx_SCK_GPIO_CLK_ENABLE()         __HAL_RCC_GPIOA_CLK_ENABLE()
00423 #define EVAL_SPIx_SCK_GPIO_CLK_DISABLE()        __HAL_RCC_GPIOA_CLK_DISABLE()
00424 
00425 #define EVAL_SPIx_MISO_MOSI_GPIO_PORT           GPIOA
00426 #define EVAL_SPIx_MISO_MOSI_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOA_CLK_ENABLE()
00427 #define EVAL_SPIx_MISO_MOSI_GPIO_CLK_DISABLE()  __HAL_RCC_GPIOA_CLK_DISABLE()
00428 #define EVAL_SPIx_MISO_PIN                      GPIO_PIN_6       /* PA.06*/
00429 #define EVAL_SPIx_MOSI_PIN                      GPIO_PIN_7       /* PA.07*/
00430 /* Maximum Timeout values for flags waiting loops. These timeouts are not based
00431    on accurate values, they just guarantee that the application will not remain
00432    stuck if the SPI communication is corrupted.
00433    You may modify these timeout values depending on CPU frequency and application
00434    conditions (interrupts routines ...). */   
00435 #define EVAL_SPIx_TIMEOUT_MAX                   1000
00436 
00437 /**
00438   * @}
00439   */ 
00440 
00441 /** @addtogroup STM3210E_EVAL_COMPONENT
00442   * @{
00443   */
00444 
00445 /*##################### FLASH SPI ###################################*/
00446 /**
00447   * @brief  M25P FLASH SPI Chip Select macro definition 
00448   */
00449 #define FLASH_SPI_CS_LOW()       HAL_GPIO_WritePin(FLASH_SPI_CS_GPIO_PORT, FLASH_SPI_CS_PIN, GPIO_PIN_RESET)
00450 #define FLASH_SPI_CS_HIGH()      HAL_GPIO_WritePin(FLASH_SPI_CS_GPIO_PORT, FLASH_SPI_CS_PIN, GPIO_PIN_SET)
00451 
00452 /**
00453   * @brief  M25P FLASH SPI Control Interface pins
00454   */
00455 #define FLASH_SPI_CS_PIN                           GPIO_PIN_2        /* PB.02*/
00456 #define FLASH_SPI_CS_GPIO_PORT                     GPIOB
00457 #define FLASH_SPI_CS_GPIO_CLK_ENABLE()             __HAL_RCC_GPIOB_CLK_ENABLE()
00458 #define FLASH_SPI_CS_GPIO_CLK_DISABLE()            __HAL_RCC_GPIOB_CLK_DISABLE()
00459 
00460 /**
00461   * @brief  M25P FLASH SPI supported commands
00462   */  
00463 #define FLASH_SPI_CMD_WRITE          0x02  /*!< Write to Memory instruction */
00464 #define FLASH_SPI_CMD_WRSR           0x01  /*!< Write Status Register instruction */
00465 #define FLASH_SPI_CMD_WREN           0x06  /*!< Write enable instruction */
00466 #define FLASH_SPI_CMD_READ           0x03  /*!< Read from Memory instruction */
00467 #define FLASH_SPI_CMD_RDSR           0x05  /*!< Read Status Register instruction  */
00468 #define FLASH_SPI_CMD_RDID           0x9F  /*!< Read identification */
00469 #define FLASH_SPI_CMD_SE             0xD8  /*!< Sector Erase instruction */
00470 #define FLASH_SPI_CMD_BE             0xC7  /*!< Bulk Erase instruction */
00471 
00472 #define FLASH_SPI_WIP_FLAG           0x01  /*!< Write In Progress (WIP) flag */
00473 
00474 #define FLASH_SPI_DUMMY_BYTE         0xA5
00475 #define FLASH_SPI_PAGESIZE           0x100
00476 
00477 #define FLASH_SPI_M25P128_ID         0x202018
00478 #define FLASH_SPI_M25P64_ID          0x202017
00479 
00480 
00481 /*##################### AUDIO ##########################*/
00482 /**
00483   * @brief  AUDIO I2C Interface pins
00484   */
00485 #define AUDIO_I2C_ADDRESS                     0x27
00486   
00487   /* Audio Reset Pin definition */
00488 #define AUDIO_RESET_GPIO_CLK_ENABLE()         __HAL_RCC_GPIOG_CLK_ENABLE()
00489 #define AUDIO_RESET_PIN                       GPIO_PIN_11
00490 #define AUDIO_RESET_GPIO                      GPIOG
00491 
00492 /**
00493   * @}
00494   */
00495 
00496 /**
00497   * @}
00498   */ 
00499 
00500 
00501 
00502 /** @addtogroup STM3210E_EVAL_Exported_Functions
00503   * @{
00504   */ 
00505 uint32_t                BSP_GetVersion(void);
00506 void                    BSP_LED_Init(Led_TypeDef Led);
00507 void                    BSP_LED_On(Led_TypeDef Led);
00508 void                    BSP_LED_Off(Led_TypeDef Led);
00509 void                    BSP_LED_Toggle(Led_TypeDef Led);
00510 void                    BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode);
00511 uint32_t                BSP_PB_GetState(Button_TypeDef Button);
00512 #ifdef HAL_UART_MODULE_ENABLED
00513 void                    BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef* huart);
00514 #endif /* HAL_UART_MODULE_ENABLED */
00515 uint8_t                 BSP_JOY_Init(JOYMode_TypeDef Joy_Mode);
00516 JOYState_TypeDef        BSP_JOY_GetState(void);
00517 
00518 /**
00519   * @}
00520   */
00521 
00522 
00523 /**
00524   * @}
00525   */
00526   
00527 /**
00528   * @}
00529   */
00530   
00531 /**
00532   * @}
00533   */
00534   
00535 #ifdef __cplusplus
00536 }
00537 #endif
00538   
00539 #endif /* __STM3210E_EVAL_H */
00540 
00541 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
00542 
Generated on Thu Dec 10 2015 17:39:43 for STM3210E_EVAL BSP User Manual by   doxygen 1.7.6.1