-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
60 lines (53 loc) · 2.17 KB
/
main.c
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
#include <ch.h>
#include <hal.h>
#define toggle(a, b, c) { palSetPad((a), (b)); chThdSleepMilliseconds((c)); palClearPad((a), (b)); chThdSleepMilliseconds((c)); }
int main(void) {
halInit();
chSysInit();
palSetPadMode(GPIOB, 3, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 4, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 5, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 11, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 12, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 13, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 14, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 15, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 9, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOA, 10, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 8, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 7, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOA, 1, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOA, 2, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOA, 3, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOA, 10, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOA, 9, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOA, 8, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOA, 15, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 11, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 10, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 9, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 8, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 7, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 3, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 2, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 1, PAL_MODE_OUTPUT_PUSHPULL);
while (1) {
toggle(GPIOB,7,500);
toggle(GPIOB,15,500);
toggle(GPIOB,9,500);
toggle(GPIOB,10,500);
toggle(GPIOB,11,500);
toggle(GPIOA,7,500);
toggle(GPIOA,15,500);
toggle(GPIOA,9,500);
toggle(GPIOA,8,500);
toggle(GPIOA,1,500);
toggle(GPIOC,7,500);
toggle(GPIOC,6,500);
toggle(GPIOC,9,500);
toggle(GPIOC,8,500);
toggle(GPIOC,1,500);
}
}