stm32f411e_discovery.h
Go to the documentation of this file.
1 
37 /* Define to prevent recursive inclusion -------------------------------------*/
38 #ifndef __STM32F411E_DISCOVERY_H
39 #define __STM32F411E_DISCOVERY_H
40 
41 #ifdef __cplusplus
42  extern "C" {
43 #endif
44 
45 /* Includes ------------------------------------------------------------------*/
46 #include "stm32f4xx_hal.h"
47 
63 typedef enum
64 {
65  LED4 = 0,
66  LED3 = 1,
67  LED5 = 2,
68  LED6 = 3
70 
71 typedef enum
72 {
75 
76 typedef enum
77 {
92 #if !defined (USE_STM32F411E_DISCO)
93  #define USE_STM32F411E_DISCO
94 #endif
95 
99 #define LEDn 4
100 
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()
105 
106 
107 #define LED3_PIN GPIO_PIN_13
108 #define LED3_GPIO_PORT GPIOD
109 #define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
110 #define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
111 
112 
113 #define LED5_PIN GPIO_PIN_14
114 #define LED5_GPIO_PORT GPIOD
115 #define LED5_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
116 #define LED5_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
117 
118 
119 #define LED6_PIN GPIO_PIN_15
120 #define LED6_GPIO_PORT GPIOD
121 #define LED6_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
122 #define LED6_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
123 
124 #define LEDx_GPIO_CLK_ENABLE(__INDEX__) do{if((__INDEX__) == 0) LED4_GPIO_CLK_ENABLE(); else \
125  if((__INDEX__) == 1) LED3_GPIO_CLK_ENABLE(); else \
126  if((__INDEX__) == 2) LED5_GPIO_CLK_ENABLE(); else \
127  if((__INDEX__) == 3) LED6_GPIO_CLK_ENABLE(); \
128  }while(0)
129 
130 #define LEDx_GPIO_CLK_DISABLE(__INDEX__) do{if((__INDEX__) == 0) LED4_GPIO_CLK_DISABLE(); else \
131  if((__INDEX__) == 1) LED3_GPIO_CLK_DISABLE(); else \
132  if((__INDEX__) == 2) LED5_GPIO_CLK_DISABLE(); else \
133  if((__INDEX__) == 3) LED6_GPIO_CLK_DISABLE(); \
134  }while(0)
135 
142 #define BUTTONn 1
143 
147 #define KEY_BUTTON_PIN GPIO_PIN_0
148 #define KEY_BUTTON_GPIO_PORT GPIOA
149 #define KEY_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
150 #define KEY_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
151 #define KEY_BUTTON_EXTI_IRQn EXTI0_IRQn
152 
153 #define BUTTONx_GPIO_CLK_ENABLE(__INDEX__) do{if((__INDEX__) == 0) KEY_BUTTON_GPIO_CLK_ENABLE(); \
154  }while(0)
155 #define BUTTONx_GPIO_CLK_DISABLE(__INDEX__) do{if((__INDEX__) == 0) KEY_BUTTON_GPIO_CLK_DISABLE(); \
156  }while(0)
157 
165 /*############################### I2Cx #######################################*/
166 #define DISCOVERY_I2Cx I2C1
167 #define DISCOVERY_I2Cx_CLOCK_ENABLE() __HAL_RCC_I2C1_CLK_ENABLE()
168 #define DISCOVERY_I2Cx_GPIO_PORT GPIOB /* GPIOB */
169 #define DISCOVERY_I2Cx_SCL_PIN GPIO_PIN_6 /* PB.06 */
170 #define DISCOVERY_I2Cx_SDA_PIN GPIO_PIN_9 /* PB.09 */
171 #define DISCOVERY_I2Cx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
172 #define DISCOVERY_I2Cx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
173 #define DISCOVERY_I2Cx_AF GPIO_AF4_I2C1
174 
175 #define DISCOVERY_I2Cx_FORCE_RESET() __HAL_RCC_I2C1_FORCE_RESET()
176 #define DISCOVERY_I2Cx_RELEASE_RESET() __HAL_RCC_I2C1_RELEASE_RESET()
177 
178 /* I2C interrupt requests */
179 #define DISCOVERY_I2Cx_EV_IRQn I2C1_EV_IRQn
180 #define DISCOVERY_I2Cx_ER_IRQn I2C1_ER_IRQn
181 
182 /* I2C speed and timeout max */
183 #define I2Cx_TIMEOUT_MAX 0xA000 /*<! The value of the maximal timeout for I2C waiting loops */
184 #define I2Cx_MAX_COMMUNICATION_FREQ ((uint32_t) 100000)
185 
186 /*################################# SPI1 #####################################*/
187 #define DISCOVERY_SPIx SPI1
188 #define DISCOVERY_SPIx_CLOCK_ENABLE() __HAL_RCC_SPI1_CLK_ENABLE()
189 #define DISCOVERY_SPIx_GPIO_PORT GPIOA /* GPIOA */
190 #define DISCOVERY_SPIx_AF GPIO_AF5_SPI1
191 #define DISCOVERY_SPIx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
192 #define DISCOVERY_SPIx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
193 #define DISCOVERY_SPIx_SCK_PIN GPIO_PIN_5 /* PA.05 */
194 #define DISCOVERY_SPIx_MISO_PIN GPIO_PIN_6 /* PA.06 */
195 #define DISCOVERY_SPIx_MOSI_PIN GPIO_PIN_7 /* PA.07 */
196 /* Maximum Timeout values for flags waiting loops. These timeouts are not based
197  on accurate values, they just guarantee that the application will not remain
198  stuck if the SPI communication is corrupted.
199  You may modify these timeout values depending on CPU frequency and application
200  conditions (interrupts routines ...). */
201 #define SPIx_TIMEOUT_MAX ((uint32_t)0x1000)
202 
203 /*################################ GYROSCOPE #################################*/
204 /* Read/Write command */
205 #define READWRITE_CMD ((uint8_t)0x80)
206 /* Multiple byte read/write command */
207 #define MULTIPLEBYTE_CMD ((uint8_t)0x40)
208 /* Dummy Byte Send by the SPI Master device in order to generate the Clock to the Slave device */
209 #define DUMMY_BYTE ((uint8_t)0x00)
210 
211 /* Chip Select macro definition */
212 #define GYRO_CS_LOW() HAL_GPIO_WritePin(GYRO_CS_GPIO_PORT, GYRO_CS_PIN, GPIO_PIN_RESET)
213 #define GYRO_CS_HIGH() HAL_GPIO_WritePin(GYRO_CS_GPIO_PORT, GYRO_CS_PIN, GPIO_PIN_SET)
214 
218 #define GYRO_CS_GPIO_PORT GPIOE /* GPIOE */
219 #define GYRO_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
220 #define GYRO_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
221 #define GYRO_CS_PIN GPIO_PIN_3 /* PE.03 */
222 
223 #define GYRO_INT_GPIO_PORT GPIOE /* GPIOE */
224 #define GYRO_INT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
225 #define GYRO_INT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
226 #define GYRO_INT1_PIN GPIO_PIN_0 /* PE.00 */
227 #define GYRO_INT1_EXTI_IRQn EXTI0_IRQn
228 #define GYRO_INT2_PIN GPIO_PIN_1 /* PE.01 */
229 #define GYRO_INT2_EXTI_IRQn EXTI1_IRQn
230 
231 /*################################### AUDIO ##################################*/
235 /* Device I2C address */
236 #define AUDIO_I2C_ADDRESS 0x94
237 
238 /* Audio codec power on/off macro definition */
239 #define CODEC_AUDIO_POWER_OFF() HAL_GPIO_WritePin(AUDIO_RESET_GPIO, AUDIO_RESET_PIN, GPIO_PIN_RESET)
240 #define CODEC_AUDIO_POWER_ON() HAL_GPIO_WritePin(AUDIO_RESET_GPIO, AUDIO_RESET_PIN, GPIO_PIN_SET)
241 
242 /* Audio Reset Pin definition */
243 #define AUDIO_RESET_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
244 #define AUDIO_RESET_PIN GPIO_PIN_4
245 #define AUDIO_RESET_GPIO GPIOD
246 
250 /*############################### ACCELEROMETER ##############################*/
254 #define ACCELERO_DRDY_GPIO_PORT GPIOE /* GPIOE */
255 #define ACCELERO_DRDY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
256 #define ACCELERO_DRDY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
257 #define ACCELERO_DRDY_PIN GPIO_PIN_2 /* PE.02 */
258 #define ACCELERO_DRDY_EXTI_IRQn TAMP_STAMP_IRQn
259 
260 #define ACCELERO_INT_GPIO_PORT GPIOE /* GPIOE */
261 #define ACCELERO_INT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
262 #define ACCELERO_INT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
263 #define ACCELERO_INT1_PIN GPIO_PIN_4 /* PE.04 */
264 #define ACCELERO_INT1_EXTI_IRQn EXTI4_IRQn
265 #define ACCELERO_INT2_PIN GPIO_PIN_5 /* PE.05 */
266 #define ACCELERO_INT2_EXTI_IRQn EXTI9_5_IRQn
267 
281 uint32_t BSP_GetVersion(void);
282 void BSP_LED_Init(Led_TypeDef Led);
283 void BSP_LED_On(Led_TypeDef Led);
284 void BSP_LED_Off(Led_TypeDef Led);
285 void BSP_LED_Toggle(Led_TypeDef Led);
286 void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
287 uint32_t BSP_PB_GetState(Button_TypeDef Button);
288 
305 #ifdef __cplusplus
306 }
307 #endif
308 
309 #endif /* __STM32F411E_DISCOVERY_H */
310 
311 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
BSP_PB_Init
void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
Configures Button GPIO and EXTI Line.
Definition: stm32f4_discovery.c:248
BSP_PB_GetState
uint32_t BSP_PB_GetState(Button_TypeDef Button)
Returns the selected Button state.
Definition: stm32f4_discovery.c:287
BUTTON_MODE_GPIO
@ BUTTON_MODE_GPIO
Definition: stm32f411e_discovery.h:78
LED4
@ LED4
Definition: stm32f411e_discovery.h:65
BUTTON_MODE_EXTI
@ BUTTON_MODE_EXTI
Definition: stm32f411e_discovery.h:79
ButtonMode_TypeDef
ButtonMode_TypeDef
Definition: stm32f4_discovery.h:76
LED6
@ LED6
Definition: stm32f411e_discovery.h:68
BSP_GetVersion
uint32_t BSP_GetVersion(void)
This method returns the STM32F4 DISCO BSP Driver revision.
Definition: stm32f4_discovery.c:156
Led_TypeDef
Led_TypeDef
Definition: stm32f411e_discovery.h:63
ButtonMode_TypeDef
ButtonMode_TypeDef
Definition: stm32f411e_discovery.h:76
BSP_LED_Toggle
void BSP_LED_Toggle(Led_TypeDef Led)
Toggles the selected LED.
Definition: stm32f4_discovery.c:225
BSP_LED_Off
void BSP_LED_Off(Led_TypeDef Led)
Turns selected LED Off.
Definition: stm32f4_discovery.c:211
LED3
@ LED3
Definition: stm32f411e_discovery.h:66
Button_TypeDef
Button_TypeDef
Definition: stm32f4_discovery.h:71
BSP_LED_Init
void BSP_LED_Init(Led_TypeDef Led)
Configures LED GPIO.
Definition: stm32f4_discovery.c:170
Button_TypeDef
Button_TypeDef
Definition: stm32f411e_discovery.h:71
Led_TypeDef
Led_TypeDef
Definition: stm32f4_discovery.h:63
BUTTON_KEY
@ BUTTON_KEY
Definition: stm32f411e_discovery.h:73
LED5
@ LED5
Definition: stm32f411e_discovery.h:67
BSP_LED_On
void BSP_LED_On(Led_TypeDef Led)
Turns selected LED On.
Definition: stm32f4_discovery.c:197


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:51