-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
52 lines (37 loc) · 1.09 KB
/
main.c
File metadata and controls
52 lines (37 loc) · 1.09 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
#include "tl_common.h"
#include "drivers.h"
#include "stack/ble/ble.h"
#include "vendor/common/user_config.h"
extern void user_init_normal();
extern void user_init_deepRetn();
extern void main_loop (void);
_attribute_my_ram_code_ void irq_handler(void)
{
irq_blt_sdk_handler();
}
_attribute_ram_code_ int main (void) //must run in ramcode
{
blc_pm_select_internal_32k_crystal();
cpu_wakeup_init();
int deepRetWakeUp = pm_is_MCU_deepRetentionWakeup(); //MCU deep retention wakeUp
rf_drv_init(RF_MODE_BLE_1M);
gpio_init( !deepRetWakeUp ); //analog resistance will keep available in deepSleep mode, so no need initialize again
#if (CLOCK_SYS_CLOCK_HZ == 16000000)
clock_init(SYS_CLK_16M_Crystal);
#elif (CLOCK_SYS_CLOCK_HZ == 24000000)
clock_init(SYS_CLK_24M_Crystal);
#endif
blc_app_loadCustomizedParameters(); //load customized freq_offset cap value
if( deepRetWakeUp ) {
user_init_deepRetn();
}
else {
user_init_normal();
}
while (1) {
#if (MODULE_WATCHDOG_ENABLE)
wd_clear(); //clear watch dog
#endif
main_loop();
}
}