mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
加入数据处理的任务
This commit is contained in:
36
Power_Pico/User/Tasks/Src/user_DataTask.c
Normal file
36
Power_Pico/User/Tasks/Src/user_DataTask.c
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user