-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdebug_pin.c
More file actions
22 lines (19 loc) · 787 Bytes
/
Copy pathdebug_pin.c
File metadata and controls
22 lines (19 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#define DEBUG_PIN GPIO_PIN_0
#define DEBUG_GPIO_PORT GPIOA
#define DEBUG_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
#define DEBUG_GPIO_CLK_DISABLE() __GPIOA_CLK_DISABLE()
void init_debug_pin(void) {
GPIO_InitTypeDef gpioinitstruct = {0};
/* Enable the GPIO Clock */
DEBUG_GPIO_CLK_ENABLE();
/* Configure the USB D+ pin */
gpioinitstruct.Pin = DEBUG_PIN;
gpioinitstruct.Mode = GPIO_MODE_OUTPUT_PP;
gpioinitstruct.Pull = GPIO_NOPULL;
gpioinitstruct.Speed = GPIO_SPEED_LOW;
HAL_GPIO_Init(DEBUG_GPIO_PORT, &gpioinitstruct);
}
void toogle_debug(void) {
HAL_GPIO_WritePin(DEBUG_GPIO_PORT, DEBUG_PIN, GPIO_PIN_SET);
HAL_GPIO_WritePin(DEBUG_GPIO_PORT, DEBUG_PIN, GPIO_PIN_RESET);
}