diff --git a/Power_Pico/User/Tasks/Inc/user_DataTask.h b/Power_Pico/User/Tasks/Inc/user_DataTask.h new file mode 100644 index 0000000..e658d15 --- /dev/null +++ b/Power_Pico/User/Tasks/Inc/user_DataTask.h @@ -0,0 +1,16 @@ +#ifndef __USER_DATATASK_H__ +#define __USER_DATATASK_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void DataTask(void *argument); + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/Power_Pico/User/Tasks/Src/user_DataTask.c b/Power_Pico/User/Tasks/Src/user_DataTask.c new file mode 100644 index 0000000..1ce67d0 --- /dev/null +++ b/Power_Pico/User/Tasks/Src/user_DataTask.c @@ -0,0 +1,36 @@ +/* Private includes -----------------------------------------------------------*/ +//includes +#include "user_TasksInit.h" +#include "user_DataTask.h" +#include "main.h" +#include "adc.h" +#include "gate.h" +#include "usart.h" +/* Private typedef -----------------------------------------------------------*/ + +/* Private define ------------------------------------------------------------*/ + + +/* Private variables ---------------------------------------------------------*/ + +/* Private function prototypes -----------------------------------------------*/ + +/** + * @brief task for data process and so on + * @param argument: Not used + * @retval None + */ +void DataTask(void *argument) +{ + uint8_t keystr = 0; + uint16_t cur_bias = 4096 / 2; + while(1) + { + if(osMessageQueueGet(Key_MessageQueue, &keystr, NULL, 0)==osOK) + { + // UART6_TX_Send((uint8_t *)"key pressed\r\n", 13); + } + + osDelay(1); + } +} diff --git a/Power_Pico/User/Tasks/Src/user_TasksInit.c b/Power_Pico/User/Tasks/Src/user_TasksInit.c index 4b62998..05c1742 100644 --- a/Power_Pico/User/Tasks/Src/user_TasksInit.c +++ b/Power_Pico/User/Tasks/Src/user_TasksInit.c @@ -10,7 +10,7 @@ //tasks #include "user_HardwareInitTask.h" -#include "user_SendTask.h" +#include "user_DataTask.h" #include "user_KeyTask.h" /* Private typedef -----------------------------------------------------------*/ @@ -35,10 +35,10 @@ const osThreadAttr_t HardwareInitTask_attributes = { .priority = (osPriority_t) osPriorityHigh3, }; -//UART send task -osThreadId_t UartSendTaskHandle; -const osThreadAttr_t UartSendTask_attributes = { - .name = "UartSendTask", +//Data process task +osThreadId_t DataTaskHandle; +const osThreadAttr_t DataTask_attributes = { + .name = "DataTask", .stack_size = 128 * 2, .priority = (osPriority_t) osPriorityHigh1, }; @@ -85,7 +85,7 @@ void User_Tasks_Init(void) /* add threads, ... */ HardwareInitTaskHandle = osThreadNew(HardwareInitTask, NULL, &HardwareInitTask_attributes); - UartSendTaskHandle = osThreadNew(UartSendTask, NULL, &UartSendTask_attributes); + DataTaskHandle = osThreadNew(DataTask, NULL, &DataTask_attributes); KeyTaskHandle = osThreadNew(KeyTask, NULL, &KeyTask_attributes); LvHandlerTaskHandle = osThreadNew(LvHandlerTask, NULL, &LvHandlerTask_attributes);