Go to the documentation of this file.
38 #ifndef __STM32F4_DISCOVERY_H
39 #define __STM32F4_DISCOVERY_H
46 #include "stm32f4xx_hal.h"
92 #if !defined (USE_STM32F4_DISCO)
93 #define USE_STM32F4_DISCO
101 #define LED4_PIN GPIO_PIN_12
102 #define LED4_GPIO_PORT GPIOD
103 #define LED4_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
104 #define LED4_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
106 #define LED3_PIN GPIO_PIN_13
107 #define LED3_GPIO_PORT GPIOD
108 #define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
109 #define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
111 #define LED5_PIN GPIO_PIN_14
112 #define LED5_GPIO_PORT GPIOD
113 #define LED5_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
114 #define LED5_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
116 #define LED6_PIN GPIO_PIN_15
117 #define LED6_GPIO_PORT GPIOD
118 #define LED6_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
119 #define LED6_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
121 #define LEDx_GPIO_CLK_ENABLE(__INDEX__) do{if((__INDEX__) == 0) LED4_GPIO_CLK_ENABLE(); else \
122 if((__INDEX__) == 1) LED3_GPIO_CLK_ENABLE(); else \
123 if((__INDEX__) == 2) LED5_GPIO_CLK_ENABLE(); else \
124 if((__INDEX__) == 3) LED6_GPIO_CLK_ENABLE(); \
127 #define LEDx_GPIO_CLK_DISABLE(__INDEX__) do{if((__INDEX__) == 0) LED4_GPIO_CLK_DISABLE(); else \
128 if((__INDEX__) == 1) LED3_GPIO_CLK_DISABLE(); else \
129 if((__INDEX__) == 2) LED5_GPIO_CLK_DISABLE(); else \
130 if((__INDEX__) == 3) LED6_GPIO_CLK_DISABLE(); \
144 #define KEY_BUTTON_PIN GPIO_PIN_0
145 #define KEY_BUTTON_GPIO_PORT GPIOA
146 #define KEY_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
147 #define KEY_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
148 #define KEY_BUTTON_EXTI_IRQn EXTI0_IRQn
150 #define BUTTONx_GPIO_CLK_ENABLE(__INDEX__) do{if((__INDEX__) == 0) KEY_BUTTON_GPIO_CLK_ENABLE(); \
153 #define BUTTONx_GPIO_CLK_DISABLE(__INDEX__) do{if((__INDEX__) == 0) KEY_BUTTON_GPIO_CLK_DISABLE(); \
164 #define DISCOVERY_SPIx SPI1
165 #define DISCOVERY_SPIx_CLK_ENABLE() __HAL_RCC_SPI1_CLK_ENABLE()
166 #define DISCOVERY_SPIx_GPIO_PORT GPIOA
167 #define DISCOVERY_SPIx_AF GPIO_AF5_SPI1
168 #define DISCOVERY_SPIx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
169 #define DISCOVERY_SPIx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
170 #define DISCOVERY_SPIx_SCK_PIN GPIO_PIN_5
171 #define DISCOVERY_SPIx_MISO_PIN GPIO_PIN_6
172 #define DISCOVERY_SPIx_MOSI_PIN GPIO_PIN_7
179 #define SPIx_TIMEOUT_MAX 0x1000
184 #ifndef BSP_I2C_SPEED
185 #define BSP_I2C_SPEED 100000
189 #define DISCOVERY_I2Cx I2C1
190 #define DISCOVERY_I2Cx_CLK_ENABLE() __HAL_RCC_I2C1_CLK_ENABLE()
191 #define DISCOVERY_I2Cx_SCL_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
192 #define DISCOVERY_I2Cx_SCL_SDA_AF GPIO_AF4_I2C1
193 #define DISCOVERY_I2Cx_SCL_SDA_GPIO_PORT GPIOB
194 #define DISCOVERY_I2Cx_SCL_PIN GPIO_PIN_6
195 #define DISCOVERY_I2Cx_SDA_PIN GPIO_PIN_9
197 #define DISCOVERY_I2Cx_FORCE_RESET() __HAL_RCC_I2C1_FORCE_RESET()
198 #define DISCOVERY_I2Cx_RELEASE_RESET() __HAL_RCC_I2C1_RELEASE_RESET()
201 #define DISCOVERY_I2Cx_EV_IRQn I2C1_EV_IRQn
202 #define DISCOVERY_I2Cx_ER_IRQn I2C1_ER_IRQn
209 #define I2Cx_TIMEOUT_MAX 0x1000
214 #define READWRITE_CMD ((uint8_t)0x80)
216 #define MULTIPLEBYTE_CMD ((uint8_t)0x40)
218 #define DUMMY_BYTE ((uint8_t)0x00)
221 #define ACCELERO_CS_LOW() HAL_GPIO_WritePin(ACCELERO_CS_GPIO_PORT, ACCELERO_CS_PIN, GPIO_PIN_RESET)
222 #define ACCELERO_CS_HIGH() HAL_GPIO_WritePin(ACCELERO_CS_GPIO_PORT, ACCELERO_CS_PIN, GPIO_PIN_SET)
227 #define ACCELERO_CS_PIN GPIO_PIN_3
228 #define ACCELERO_CS_GPIO_PORT GPIOE
229 #define ACCELERO_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
230 #define ACCELERO_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
231 #define ACCELERO_INT_GPIO_PORT GPIOE
232 #define ACCELERO_INT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
233 #define ACCELERO_INT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
234 #define ACCELERO_INT1_PIN GPIO_PIN_0
235 #define ACCELERO_INT1_EXTI_IRQn EXTI0_IRQn
236 #define ACCELERO_INT2_PIN GPIO_PIN_1
237 #define ACCELERO_INT2_EXTI_IRQn EXTI1_IRQn
247 #define AUDIO_I2C_ADDRESS 0x94
250 #define AUDIO_RESET_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
251 #define AUDIO_RESET_PIN GPIO_PIN_4
252 #define AUDIO_RESET_GPIO GPIOD
uint32_t BSP_PB_GetState(Button_TypeDef Button)
Returns the selected Button state.
void BSP_LED_On(Led_TypeDef Led)
Turns selected LED On.
void BSP_LED_Toggle(Led_TypeDef Led)
Toggles the selected LED.
void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef Mode)
Configures Button GPIO and EXTI Line.
uint32_t BSP_GetVersion(void)
This method returns the STM32F4 DISCO BSP Driver revision.
void BSP_LED_Off(Led_TypeDef Led)
Turns selected LED Off.
void BSP_LED_Init(Led_TypeDef Led)
Configures LED GPIO.