-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstm32f4_discovery.h
214 lines (179 loc) · 5.33 KB
/
stm32f4_discovery.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/**
******************************************************************************
* @file stm32f4_discovery.h
* @author MCD Application Team
* @version V1.1.0
* @date 28-October-2011
* @brief This file contains definitions for STM32F4-Discovery Kit's Leds and
* push-button hardware resources.
******************************************************************************
* @attention
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F4_DISCOVERY_H
#define __STM32F4_DISCOVERY_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx.h"
/** @addtogroup Utilities
* @{
*/
/** @addtogroup STM32F4_DISCOVERY
* @{
*/
/** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL
* @{
*/
/** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Types
* @{
*/
typedef enum
{
LED4 = 0,
LED3 = 1,
LED5 = 2,
LED6 = 3
} Led_TypeDef;
typedef enum
{
ELED0 = 0,
ELED1 = 1,
ELED2 = 2,
ELED3 = 3,
ELED4 = 4,
ELED5 = 5,
ELED6 = 6,
ELED7 = 7
} Exp_Led_TypeDef;
typedef enum
{
BUTTON_USER = 0,
} Button_TypeDef;
typedef enum
{
BUTTON_MODE_GPIO = 0,
BUTTON_MODE_EXTI = 1
} ButtonMode_TypeDef;
typedef enum
{
COM1 = 0,
COM2 = 1
} COM_TypeDef;
/**
* @}
*/
/** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Constants
* @{
*/
/** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL_LED
* @{
*/
#define LEDn 4
#define LED4_PIN GPIO_Pin_12
#define LED4_GPIO_PORT GPIOD
#define LED4_GPIO_CLK RCC_AHB1Periph_GPIOD
#define LED3_PIN GPIO_Pin_13
#define LED3_GPIO_PORT GPIOD
#define LED3_GPIO_CLK RCC_AHB1Periph_GPIOD
#define LED5_PIN GPIO_Pin_14
#define LED5_GPIO_PORT GPIOD
#define LED5_GPIO_CLK RCC_AHB1Periph_GPIOD
#define LED6_PIN GPIO_Pin_15
#define LED6_GPIO_PORT GPIOD
#define LED6_GPIO_CLK RCC_AHB1Periph_GPIOD
/**
* @}
*/
/** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL_BUTTON
* @{
*/
#define BUTTONn 1
/**
* @brief Wakeup push-button
*/
#define USER_BUTTON_PIN GPIO_Pin_0
#define USER_BUTTON_GPIO_PORT GPIOA
#define USER_BUTTON_GPIO_CLK RCC_AHB1Periph_GPIOA
#define USER_BUTTON_EXTI_LINE EXTI_Line0
#define USER_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOA
#define USER_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource0
#define USER_BUTTON_EXTI_IRQn EXTI0_IRQn
/**
* @}
*/
/** @addtogroup STM324xG_EVAL_LOW_LEVEL_COM
* @{
*/
#define COMn 1
/**
* @brief Definition for COM port1, connected to USART3
*/
#define EVAL_COM1 USART3
#define EVAL_COM1_CLK RCC_APB1Periph_USART3
#define EVAL_COM1_TX_PIN GPIO_Pin_10
#define EVAL_COM1_TX_GPIO_PORT GPIOC
#define EVAL_COM1_TX_GPIO_CLK RCC_AHB1Periph_GPIOA
#define EVAL_COM1_TX_SOURCE GPIO_PinSource10
#define EVAL_COM1_TX_AF GPIO_AF_USART3
#define EVAL_COM1_RX_PIN GPIO_Pin_11
#define EVAL_COM1_RX_GPIO_PORT GPIOC
#define EVAL_COM1_RX_GPIO_CLK RCC_AHB1Periph_GPIOA
#define EVAL_COM1_RX_SOURCE GPIO_PinSource11
#define EVAL_COM1_RX_AF GPIO_AF_USART3
#define EVAL_COM1_IRQn USART3_IRQn
/** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Functions
* @{
*/
void STM_EVAL_LEDInit(Led_TypeDef Led);
void STM_EVAL_LEDOn(Led_TypeDef Led);
void STM_EVAL_LEDOff(Led_TypeDef Led);
void STM_EVAL_LEDToggle(Led_TypeDef Led);
void STM_EVAL_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode);
void STM_EVAL_COMInit(COM_TypeDef COM, USART_InitTypeDef* USART_InitStruct);
uint32_t STM_EVAL_PBGetState(Button_TypeDef Button);
void STM_EVAL_SET_Red(uint8_t Red);
void STM_EVAL_SET_Green(uint8_t Green);
void STM_EVAL_SET_Blue(uint8_t Blue);
void STM_EVAL_EXP_SW(void);
void STM_EVAL_EXP_LED_INIT(void);
void STM_EVAL_EXP_LED_TOGGLE(uint8_t i);
void STM_EVAL_EXP_RGB(void);
void STM_EVAL_EXP_INIT(void);
void STM_EVAL_EXP_SEND_UART(char *msj);
void LCD_LED_Init(void);
void ADC_Configuration(void);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM32F4_DISCOVERY_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/