mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
add pd ufp
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
/* 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)
|
||||
{
|
||||
|
||||
// over current and valtage, beep
|
||||
|
||||
osDelay(100);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "stm32f4xx_it.h"
|
||||
#include "adc.h"
|
||||
#include "rtc.h"
|
||||
|
||||
#include "i2c.h"
|
||||
// user
|
||||
#include "user_TasksInit.h"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "lcd_init.h"
|
||||
#include "gate.h"
|
||||
#include "data_queue.h"
|
||||
#include "fusb302_dev.h"
|
||||
|
||||
// ui
|
||||
#include "lvgl.h"
|
||||
@@ -64,9 +65,6 @@ void HardwareInitTask(void *argument)
|
||||
Gate_Port_Init();
|
||||
flow_route_selection(HIGH_CUR);
|
||||
|
||||
// FUSB CC dis connect
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_RESET);
|
||||
|
||||
// ADC sample start
|
||||
HAL_ADC_Start_DMA(&hadc1, (uint32_t *)adc_packet.data, ADC_TIMES * ADC_CHANELS); /*启动ADC的DMA传输,配合定时器触发ADC转换 12位的ADC对应0-4095 */
|
||||
HAL_TIM_Base_Start(&htim2); /*开启定时器,用溢出时间来触发ADC*/
|
||||
@@ -80,6 +78,9 @@ void HardwareInitTask(void *argument)
|
||||
// key
|
||||
Key_Port_Init();
|
||||
|
||||
// FUSB CC pin connect
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_SET);
|
||||
|
||||
// lcd
|
||||
// done in lvgl disp init
|
||||
|
||||
@@ -94,7 +95,6 @@ void HardwareInitTask(void *argument)
|
||||
|
||||
xTaskResumeAll();
|
||||
vTaskDelete(NULL);
|
||||
osDelay(500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
//tasks
|
||||
#include "user_HardwareInitTask.h"
|
||||
#include "user_DataTask.h"
|
||||
#include "user_PDUFPTask.h"
|
||||
#include "user_KeyTask.h"
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
@@ -37,11 +37,11 @@ const osThreadAttr_t HardwareInitTask_attributes = {
|
||||
};
|
||||
|
||||
//Data process task
|
||||
osThreadId_t DataTaskHandle;
|
||||
const osThreadAttr_t DataTask_attributes = {
|
||||
.name = "DataTask",
|
||||
osThreadId_t PDUFPTaskHandle;
|
||||
const osThreadAttr_t PDUFPTask_attributes = {
|
||||
.name = "PDUFPTask",
|
||||
.stack_size = 128 * 2,
|
||||
.priority = (osPriority_t) osPriorityHigh1,
|
||||
.priority = (osPriority_t) osPriorityLow7,
|
||||
};
|
||||
|
||||
//Key task
|
||||
@@ -86,7 +86,7 @@ void User_Tasks_Init(void)
|
||||
|
||||
/* add threads, ... */
|
||||
HardwareInitTaskHandle = osThreadNew(HardwareInitTask, NULL, &HardwareInitTask_attributes);
|
||||
// DataTaskHandle = osThreadNew(DataTask, NULL, &DataTask_attributes);
|
||||
// PDUFPTaskHandle = osThreadNew(PDUFPTask, NULL, &PDUFPTask_attributes);
|
||||
KeyTaskHandle = osThreadNew(KeyTask, NULL, &KeyTask_attributes);
|
||||
LvHandlerTaskHandle = osThreadNew(LvHandlerTask, NULL, &LvHandlerTask_attributes);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user