stm32f4_discovery.h
Go to the documentation of this file.
1 
37 /* Define to prevent recursive inclusion -------------------------------------*/
38 #ifndef __STM32F4_DISCOVERY_H
39 #define __STM32F4_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
69 } Led_TypeDef;
70 
71 typedef enum
72 {
75 
76 typedef enum
77 {
92 #if !defined (USE_STM32F4_DISCO)
93  #define USE_STM32F4_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 #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()
110 
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()
115 
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()
120 
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(); \
125  }while(0)
126 
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(); \
131  }while(0)
132 
139 #define BUTTONn 1
140 
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
149 
150 #define BUTTONx_GPIO_CLK_ENABLE(__INDEX__) do{if((__INDEX__) == 0) KEY_BUTTON_GPIO_CLK_ENABLE(); \
151  }while(0)
152 
153 #define BUTTONx_GPIO_CLK_DISABLE(__INDEX__) do{if((__INDEX__) == 0) KEY_BUTTON_GPIO_CLK_DISABLE(); \
154  }while(0)
155 
163 /*############################### SPI1 #######################################*/
164 #define DISCOVERY_SPIx SPI1
165 #define DISCOVERY_SPIx_CLK_ENABLE() __HAL_RCC_SPI1_CLK_ENABLE()
166 #define DISCOVERY_SPIx_GPIO_PORT GPIOA /* 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 /* PA.05 */
171 #define DISCOVERY_SPIx_MISO_PIN GPIO_PIN_6 /* PA.06 */
172 #define DISCOVERY_SPIx_MOSI_PIN GPIO_PIN_7 /* PA.07 */
173 
174 /* Maximum Timeout values for flags waiting loops. These timeouts are not based
175  on accurate values, they just guarantee that the application will not remain
176  stuck if the SPI communication is corrupted.
177  You may modify these timeout values depending on CPU frequency and application
178  conditions (interrupts routines ...). */
179 #define SPIx_TIMEOUT_MAX 0x1000 /*<! The value of the maximal timeout for BUS waiting loops */
180 
181 
182 /*############################# I2C1 #########################################*/
183 /* I2C clock speed configuration (in Hz) */
184 #ifndef BSP_I2C_SPEED
185  #define BSP_I2C_SPEED 100000
186 #endif /* BSP_I2C_SPEED */
187 
188 /* I2C peripheral configuration defines (control interface of the audio codec) */
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
196 
197 #define DISCOVERY_I2Cx_FORCE_RESET() __HAL_RCC_I2C1_FORCE_RESET()
198 #define DISCOVERY_I2Cx_RELEASE_RESET() __HAL_RCC_I2C1_RELEASE_RESET()
199 
200 /* I2C interrupt requests */
201 #define DISCOVERY_I2Cx_EV_IRQn I2C1_EV_IRQn
202 #define DISCOVERY_I2Cx_ER_IRQn I2C1_ER_IRQn
203 
204 /* Maximum Timeout values for flags waiting loops. These timeouts are not based
205  on accurate values, they just guarantee that the application will not remain
206  stuck if the SPI communication is corrupted.
207  You may modify these timeout values depending on CPU frequency and application
208  conditions (interrupts routines ...). */
209 #define I2Cx_TIMEOUT_MAX 0x1000 /*<! The value of the maximal timeout for BUS waiting loops */
210 
211 
212 /*############################# ACCELEROMETER ################################*/
213 /* Read/Write command */
214 #define READWRITE_CMD ((uint8_t)0x80)
215 /* Multiple byte read/write command */
216 #define MULTIPLEBYTE_CMD ((uint8_t)0x40)
217 /* Dummy Byte Send by the SPI Master device in order to generate the Clock to the Slave device */
218 #define DUMMY_BYTE ((uint8_t)0x00)
219 
220 /* Chip Select macro definition */
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)
223 
227 #define ACCELERO_CS_PIN GPIO_PIN_3 /* PE.03 */
228 #define ACCELERO_CS_GPIO_PORT GPIOE /* 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 /* 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 /* PE.00 */
235 #define ACCELERO_INT1_EXTI_IRQn EXTI0_IRQn
236 #define ACCELERO_INT2_PIN GPIO_PIN_1 /* PE.01 */
237 #define ACCELERO_INT2_EXTI_IRQn EXTI1_IRQn
238 
243 /*############################### AUDIO ######################################*/
247 #define AUDIO_I2C_ADDRESS 0x94
248 
249  /* Audio Reset Pin definition */
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
253 
267 uint32_t BSP_GetVersion(void);
268 void BSP_LED_Init(Led_TypeDef Led);
269 void BSP_LED_On(Led_TypeDef Led);
270 void BSP_LED_Off(Led_TypeDef Led);
271 void BSP_LED_Toggle(Led_TypeDef Led);
273 uint32_t BSP_PB_GetState(Button_TypeDef Button);
274 
295 #ifdef __cplusplus
296 }
297 #endif
298 
299 #endif /* __STM32F4_DISCOVERY_H */
300 
301 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
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: stm32f4_discovery.h:78
LED4
@ LED4
Definition: stm32f4_discovery.h:65
BSP_LED_On
void BSP_LED_On(Led_TypeDef Led)
Turns selected LED On.
Definition: stm32f4_discovery.c:197
BSP_LED_Toggle
void BSP_LED_Toggle(Led_TypeDef Led)
Toggles the selected LED.
Definition: stm32f4_discovery.c:225
BSP_PB_Init
void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef Mode)
Configures Button GPIO and EXTI Line.
Definition: stm32f4_discovery.c:248
BUTTON_MODE_EXTI
@ BUTTON_MODE_EXTI
Definition: stm32f4_discovery.h:79
ButtonMode_TypeDef
ButtonMode_TypeDef
Definition: stm32f4_discovery.h:76
LED6
@ LED6
Definition: stm32f4_discovery.h:68
BSP_GetVersion
uint32_t BSP_GetVersion(void)
This method returns the STM32F4 DISCO BSP Driver revision.
Definition: stm32f4_discovery.c:156
LED3
@ LED3
Definition: stm32f4_discovery.h:66
Button_TypeDef
Button_TypeDef
Definition: stm32f4_discovery.h:71
Led_TypeDef
Led_TypeDef
Definition: stm32f4_discovery.h:63
BUTTON_KEY
@ BUTTON_KEY
Definition: stm32f4_discovery.h:73
BSP_LED_Off
void BSP_LED_Off(Led_TypeDef Led)
Turns selected LED Off.
Definition: stm32f4_discovery.c:211
LED5
@ LED5
Definition: stm32f4_discovery.h:67
BSP_LED_Init
void BSP_LED_Init(Led_TypeDef Led)
Configures LED GPIO.
Definition: stm32f4_discovery.c:170
Mode
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/stb_vorbis.c:745


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