-
-
Notifications
You must be signed in to change notification settings - Fork 356
Expand file tree
/
Copy pathmain.c
More file actions
102 lines (84 loc) · 1.52 KB
/
main.c
File metadata and controls
102 lines (84 loc) · 1.52 KB
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
#if F0
#include "stm32f0xx_hal.h"
#elif F1
#include "stm32f1xx_hal.h"
#elif F2
#include "stm32f2xx_hal.h"
#elif F3
#include "stm32f3xx_hal.h"
#elif F4
#include "stm32f4xx_hal.h"
#elif F7
#include "stm32f7xx_hal.h"
#elif H7
#include "stm32h7xx_hal.h"
#elif G0
#include "stm32g0xx_hal.h"
#elif G4
#include "stm32g4xx_hal.h"
#elif H7
#include "stm32f7xx_hal.h"
#elif L0
#include "stm32l0xx_hal.h"
#elif L1
#include "stm32l1xx_hal.h"
#elif L4
#include "stm32l4xx_hal.h"
#elif L5
#include "stm32l5xx_hal.h"
#elif WL
#include "stm32wlxx_hal.h"
#else
#error "Unsupported STM32 Family"
#endif
#define LED_PIN GPIO_PIN_5
#define LED_GPIO_PORT GPIOA
#define LED_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
int main(void)
{
HAL_Init();
LED_GPIO_CLK_ENABLE();
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = LED_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(LED_GPIO_PORT, &GPIO_InitStruct);
while (1)
{
HAL_GPIO_TogglePin(LED_GPIO_PORT, LED_PIN);
HAL_Delay(1000);
}
}
void SysTick_Handler(void)
{
HAL_IncTick();
}
void NMI_Handler(void)
{
}
void HardFault_Handler(void)
{
while (1) {}
}
void MemManage_Handler(void)
{
while (1) {}
}
void BusFault_Handler(void)
{
while (1) {}
}
void UsageFault_Handler(void)
{
while (1) {}
}
void SVC_Handler(void)
{
}
void DebugMon_Handler(void)
{
}
void PendSV_Handler(void)
{
}