1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
32
35
36
37
38
42
43
44
49
50
51
52
53
54
55
56
57
58
65
66
67
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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
124
125
126
127
128
129
130
131
134
135
136
137
138
141
142
143
144
145
146
147
148
149
150
151
152
153
154
173
174
177
178
/* ... */
#include "main.h"
/* ... */
/* ... */
Includes
LL_GPIO_InitTypeDef gpio_initstruct;
Private typedef
void SystemClock_Config(void);
void Configure_GPIO(void);
Private function prototypes
/* ... */
int main(void)
{
SystemClock_Config();
Configure_GPIO();
while (1)
{
LL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN);
LL_mDelay(250);
}while (1) { ... }
}{ ... }
/* ... */
void Configure_GPIO(void)
{
LED2_GPIO_CLK_ENABLE();
gpio_initstruct.Pin = LED2_PIN;
gpio_initstruct.Mode = LL_GPIO_MODE_OUTPUT;
gpio_initstruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
gpio_initstruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
gpio_initstruct.Pull = LL_GPIO_PULL_NO;
if (LL_GPIO_Init(LED2_GPIO_PORT, &gpio_initstruct) != SUCCESS)
{
while (1)
{
}while (1) { ... }
}if (LL_GPIO_Init(LED2_GPIO_PORT, &gpio_initstruct) != SUCCESS) { ... }
}{ ... }
/* ... */
void SystemClock_Config(void)
{
LL_RCC_HSE_EnableBypass();
LL_RCC_HSE_Enable();
while(LL_RCC_HSE_IsReady() != 1)
{
}while (LL_RCC_HSE_IsReady() != 1) { ... };
LL_FLASH_SetLatency(LL_FLASH_LATENCY_3);
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_8, 400, LL_RCC_PLLP_DIV_4);
LL_RCC_PLL_Enable();
while(LL_RCC_PLL_IsReady() != 1)
{
}while (LL_RCC_PLL_IsReady() != 1) { ... };
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
{
}while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) { ... };
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_2);
LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
SysTick_Config(100000000 / 1000);
SystemCoreClock = 100000000;
}{ ... }
#ifdef USE_FULL_ASSERT
/* ... */
void assert_failed(uint8_t *file, uint32_t line)
{
/* ... */
while (1)
{
}while (1) { ... }
}assert_failed (uint8_t *file, uint32_t line) { ... }
/* ... */#endif
/* ... */
/* ... */