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
| #include "gd32e23x.h"
| #include <stdio.h>
| #include "gpio.h"
| #include "adc.h"
| #include "pwm.h"
| #include "uart.h"
| #include "clock.h"
| #include "motor.h"
| #include "bldc_ctrl.h"
| #include "bsp_pid.h"
| #include "os_task.h"
| #include "RttTask.h"
| #include "SEGGER_RTT_Conf.h"
| #include "SEGGER_RTT.h"
|
| static void Comm_Task(void *p)
| {
| // uint8_t step = 0;
| // step = get_hall_state();
| // SEGGER_RTT_printf(0, "Hall state is:%d!\n", step);
| }
|
| int main()
| {
|
| OS_TASK_MSG task_queue[8] = {0};
| InitOSTaskQueue(task_queue, 8);
|
| Clock_Config();
| GPIO_Init();
| TimerInit();
|
| UartInit();
| ADC_Init();
| Motor_Init();
| bldcm_init();
| PID_param_init();
| RTT_TaskInit();
| Ostick_config();
|
| OSTaskCreate(&Comm_Task, 10, 7, NULL);
| OSTaskCreate(&RTT_Task10ms, 1000, 7, NULL);
| OSSchedule(&OS_GetTick);
| while (1)
| ;
| return 0;
| }
|
|