-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.c
72 lines (64 loc) · 1.53 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
61
62
63
64
65
66
67
68
69
70
71
72
#include "ch.h"
#include "hal.h"
#include "system_init.h"
#include "bootloader.h"
/**
* @brief Placeholder for error messages.
*/
volatile assert_errors kfly_assert_errors;
int main(void)
{
/*
* System initializations.
* - HAL initialization, this also initializes the configured
* device drivers and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread
* and the RTOS is active.
*/
halInit();
chSysInit();
/*
*
* Initialize all drivers and modules.
*
*/
vSystemInit();
/*
*
* Main task loop.
*
*/
while(bSystemShutdownRequested() == false)
{
palSetPad(GPIOC, GPIOC_LED_USR);
chThdSleepMilliseconds(150);
palClearPad(GPIOC, GPIOC_LED_USR);
chThdSleepMilliseconds(150);
palSetPad(GPIOC, GPIOC_LED_USR);
chThdSleepMilliseconds(150);
palClearPad(GPIOC, GPIOC_LED_USR);
chThdSleepMilliseconds(500);
//vSystemRequestShutdown(SYSTEM_SHUTDOWN_KEY);
}
/*
*
* Deinitialize all drivers and modules.
*
*/
vSystemDeinit();
/*
*
* All threads, drivers, interrupts and SysTick are now disabled.
* The main function is now just a "normal" function again.
*
*/
/*
*
* Start the DFU bootloader.
* This can be replaced if a custom bootloader is available.
*
*/
//vBootloaderResetAndStartDFU();
/* In case of error get stuck here */
while (1);
}