Sys_Task_List.c 3.29 KB
Newer Older
李俭双's avatar
李俭双 committed
1 2 3 4 5 6

#include "Sys_Scheduler_Lib.h"
#include "Application.h"
#include "Components.h"
#include "RTE.h"
#include "UDS_ISO14229_Server.h"
7

李俭双's avatar
李俭双 committed
8 9 10 11 12 13 14 15 16 17 18 19
void Sys_Pseudo_Real_Time_Tasks(void)
{
    Power_Management_Service();
    DoCAN_Communication_Service();              
    UDS_Server_Application_Service();
    BU98R10_Update_Service();
    LED_Driver_Service();
    
}

void Sys_2ms_Tasks(void)
{
20
        Common_Input_Para();
21
    //Can_Write_Fun(&CAN_CH0_CanMsgTxOp, 2000u);
李俭双's avatar
李俭双 committed
22 23
    Sys_Status_Update_Service();
    Analog_Signal_Conv_Service();
24
    
李俭双's avatar
李俭双 committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38

    // if (RTE_GPIO_Get_Level(VSPEED_TEN_OUT))
    // {
    //     RTE_GPIO_Config(VSPEED_TEN_OUT, RTE_GPIO_DIR_OUT|RTE_GPIO_LEVEL_LOW);
    // }
    // else
    // {
    //     RTE_GPIO_Config(VSPEED_TEN_OUT, RTE_GPIO_DIR_OUT|RTE_GPIO_LEVEL_HIGH);
    // }
}

void Sys_5ms_Tasks(void)
{
    Flash_Sync_Signal_Generation_Service();
39
    CanMSg_XMS_Analysis(&CAN_CH0_CanMsgOp,5u);
40 41
}

李俭双's avatar
李俭双 committed
42 43

void Sys_10ms_Tasks(void)
44 45
{    
	Line_In_Debounce_Service(10u);
46
    if(Common_GetIgnOnTime() >= CHEAKTIME)
47 48 49 50
    {
        Key_Service();
    }

李俭双's avatar
李俭双 committed
51 52 53 54 55
    Data_Mileage_Write_EEPROM();
    Can_BusOff_Recover(10u);
    Turn_Left_Right_Lamp();
    Fuel_R_Cal(10u);
    TYW_Check_Count();
56
    Data_TPMS_Processing_Service();
57 58
    //Protocol_Service();
    //Protocol_Send_Service();  
59
    
60 61
    //FaultCode_Service(10u);
    FaultCode_Servers();
62
    }    
李俭双's avatar
李俭双 committed
63 64 65

void Sys_20ms_Tasks(void)
{
66
        //Key_Clear_Time();
67
    //Key_Auto_Save();
李俭双's avatar
李俭双 committed
68 69
    Data_Vehicle_Speed_Processing_Service();
    Data_Engine_Speed_Processing_Service();
70
    Data_Coolant_Temp_Processing_Service();
71
    
李俭双's avatar
李俭双 committed
72
    
73
    BU98R10_Update_Request();
李俭双's avatar
李俭双 committed
74 75 76 77
}

void Sys_50ms_Tasks(void)
{
78
   
李俭双's avatar
李俭双 committed
79 80 81 82 83 84 85
    LED_Driver_Scan_Refresh();
    Telltales_Management();
    Gauge_Service();
    Key_Check_Service();
}

uint8_t u8LEDDriverCheckCount = 0U;
86

李俭双's avatar
李俭双 committed
87 88
void Sys_100ms_Tasks(void)
{
李俭双's avatar
李俭双 committed
89 90 91 92 93 94
    if((PageType != Page_Time_Hour)&&(PageType != Page_Time_Minute))
    {
        RTE_RTC_Get_CounterValue(&counter_val);
        counter_val.time.RTC_Hours = RTC_Bcd2ToByte(counter_val.time.RTC_Hours);
		counter_val.time.RTC_Minutes = RTC_Bcd2ToByte(counter_val.time.RTC_Minutes);
    }
95
    Service_Interval_Processing();
李俭双's avatar
李俭双 committed
96 97 98
    Fuel_Cal_Sevice(100u);
    BackLight_Process();
    Services_Mileage_Callback();
99
    Data_Voltage_Processing_Service();
100
	S3_ServerCNTT();    
101
    //Send_UUID_To_Esp32();
102
    
李俭双's avatar
李俭双 committed
103 104 105 106
    if (u8LEDDriverCheckCount >= 10U)
    {
        u8LEDDriverCheckCount = 0U;
        LED_Driver_Work_Check();
107
        //LED_Driver_Service_Immediate();//注意顺序1
108
        //ALS_Service();//注意顺序2
李俭双's avatar
李俭双 committed
109 110 111 112
    }
    else
    {
        u8LEDDriverCheckCount++;
113 114
    }   

115 116
    //Clear_Navigation_St(); 
    //Protocol_ESP32_Active_Service();
117 118 119 120
    if(Common_GetIgnOffTime() >= 1000)
    {
        CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Disable);
    }
121
    
李俭双's avatar
李俭双 committed
122 123 124 125 126 127 128
}


/**
 * @brief 50us中断服务 尽可能的减少中断使用
 * 
 */
129

李俭双's avatar
李俭双 committed
130 131 132
void Sys_Exact_50us_Tasks(void)
{
    static uint32_t task_1ms = 0u;
133
    static uint32_t task_100ms = 0u;
134
    Can_Write_Fun(&CAN_CH0_CanMsgTxOp, 50u);
陈家乐's avatar
陈家乐 committed
135
        DoCAN_Timer_Update(50u);
李俭双's avatar
李俭双 committed
136
    GenDelay_Tick();
137
    task_100ms++;
陈家乐's avatar
陈家乐 committed
138
    if(task_100ms >= 1996)
139
    {
140
        task_100ms = 0u;
141
        if(Get_MileageInit_Status() == 0X5AA53AA3UL)
142 143 144
        {
            Data_Mileage_ISR();
        }
陈家乐's avatar
陈家乐 committed
145

146
    }
李俭双's avatar
李俭双 committed
147 148 149 150 151 152
    task_1ms++;
    if ( task_1ms >=20U )   
    {
        task_1ms =0U;
        eeprom_1ms_timeCount( );
    }
153
    
李俭双's avatar
李俭双 committed
154
}