This commit is contained in:
moyuhai
2026-06-09 16:39:17 +08:00
commit 41a602f89c
3057 changed files with 771495 additions and 0 deletions
@@ -0,0 +1,82 @@
#ifndef _TIMESLICE_C_
#define _TIMESLICE_C_
/*********************************************************************************************************************/
#include "timeslice.h"
#include "stdint.h"
#include "uart.h"
#include "xc_drv_uart.h"
#include "rgblight.h"
#include "timer.h"
#include "mode.h"
#include "RF433.h"
#include "ota_flash_interface.h"
#include "ota_protocol.h"
#include "pwm.h"
/*********************************************************************************************************************/
void rwip_schedule(void);
TASK_COMPONENTS TaskComps[] =
{
{0, 1, 1, rwip_schedule}, //协议栈调度任务
{0, 100, 30, ble_message_process}, //蓝牙处理任务
{0, 0, 0, app_op_flash_on},
{0,1,1,choice_mode},
{0,1,1,set_mode},
{0,1,1,Set_timing},
{0,100,100,scan_433},
{0, 100,3, Encoder_key},
{0,1,1,My_ADC_Get_Value},
{0, 311, 1, app_op_flash}, //用户数据持久化 fmc_spi_read9
{0, 311, 1, xc_ota_schedule}, //保存flash数据任务 8 //最后调用的
};
/**************************************************************************************
* FunctionName : TaskRemarks()
* Description : 任务标志处理
* EntryParameter : None
* ReturnValue : None
**************************************************************************************/
void TaskRemarks(void)
{
unsigned char i;
for (i=0; i<TASKS_MAX; i++) // 逐个任务时间处理
{
if (TaskComps[i].Timer) // 时间不为0
{
TaskComps[i].Timer--; // 减去一个节拍
if (TaskComps[i].Timer == 0) // 时间减完了
{
TaskComps[i].Timer = TaskComps[i].ItvTime; // 恢复计时器值,从新下一次
TaskComps[i].Run = 1; // 任务可以运行
}
}
}
}
/**************************************************************************************
* FunctionName : TaskProcess()
* Description : 任务处理
* EntryParameter : None
* ReturnValue : None
**************************************************************************************/
void TaskProcess(void)
{
unsigned char i;
for (i=0; i<TASKS_MAX; i++) // 逐个任务时间处理
{
if (TaskComps[i].Run) // 时间不为0
{
TaskComps[i].Run = 0; // 标志清0
TaskComps[i].TaskHook(); // 运行任务
}
}
}
void set_TaskComps_timer(uint8_t index,uint16_t value)
{
TaskComps[index].Timer = value;
}
/*********************************************************************************************************************/
#endif