-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdrive_task_ui.c
More file actions
48 lines (35 loc) · 1.07 KB
/
drive_task_ui.c
File metadata and controls
48 lines (35 loc) · 1.07 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
#include "drive_task_ui.h"
#include "drive_ui.h"
#undef LIST_H
#include <stddef.h>
#include <string.h>
#include <FreeRTOS.h>
#include <task.h>
#define TASK_UI_STACK_SIZE (configMINIMAL_STACK_SIZE * 4)
typedef struct _Ui_Task {
// Задача.
StackType_t task_stack[TASK_UI_STACK_SIZE]; //!< Стэк задачи.
StaticTask_t task_buffer; //!< Буфер задачи.
TaskHandle_t task_handle; //!< Идентификатор задачи.
} ui_task_t;
static ui_task_t ui_task;
static void ui_task_proc(void*);
err_t drive_task_ui_init(uint32_t priority)
{
memset(&ui_task, 0x0, sizeof(ui_task_t));
ui_task.task_handle = xTaskCreateStatic(ui_task_proc, "ui_task",
TASK_UI_STACK_SIZE, NULL, priority, ui_task.task_stack, &ui_task.task_buffer);
if(ui_task.task_handle == NULL) return E_INVALID_VALUE;
return E_NO_ERROR;
}
void drive_task_ui_deinit(void)
{
vTaskDelete(ui_task.task_handle);
}
static void ui_task_proc(void* arg)
{
while(drive_ui_setup() != E_NO_ERROR);
for(;;){
drive_ui_process();
}
}