Service_TPMS.h 6.32 KB
Newer Older
hu's avatar
hu committed
1 2 3 4 5 6 7 8 9 10 11
#ifndef _SERVICE_TPMS_H_
#define _SERVICE_TPMS_H_

#include "TYW_stdint.h"

/******************************************************************************
VC66对应关系

        []           []              No1

        []           []              No2
hu's avatar
hu committed
12

hu's avatar
hu committed
13 14 15 16 17
        [] []     [] []              No3

        [] []     [] []              No4


hu's avatar
hu committed
18 19
TPMS    FirstLOutID                   左前轮(No1)
        FirstROutID                   右前轮(No1)
hu's avatar
hu committed
20 21 22 23 24 25 26 27 28 29
        SecondLInID                   左中前轮(No2)
        SecondRInID                   右中前轮(No2)
        ThirdLOutID                   左中后轮_外侧(No3)
        ThirdLInID                    左中后轮_内侧(No3)
        ThirdRInID                    右中后轮_内侧(No3)
        ThirdROutID                   右中后轮_外侧(No3)
        FourthLOutID                  左后轮_外侧(No4)
        FourthLInID                   左后轮_内侧(No4)
        FourthRInID                   右后轮_内侧(No4)
        FourthROutID                  右后轮_外侧(No4)
hu's avatar
hu committed
30 31


hu's avatar
hu committed
32 33
******************************************************************************/

hu's avatar
hu committed
34
#define     FirstLOutID     0x12u
hu's avatar
hu committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#define     FirstROutID     0x13u
#define     SecondLInID     0x22u
#define     SecondRInID     0x23u
#define     ThirdLOutID     0x31u
#define     ThirdLInID      0x32u
#define     ThirdRInID      0x33u
#define     ThirdROutID     0x34u
#define     FourthLOutID    0x41u
#define     FourthLInID     0x42u
#define     FourthRInID     0x43u
#define     FourthROutID    0x44u



#define     TYRETEMP_OFFSET_VALUE     (273u)  /*胎温数据偏移量*/

typedef enum
{
hu's avatar
hu committed
53
    FirstLOut       =       0   ,
hu's avatar
hu committed
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
    FirstROut                   ,
    SecondLIn                   ,
    SecondRIn                   ,
    ThirdLOut                   ,
    ThirdLIn                    ,
    ThirdRIn                    ,
    ThirdROut                   ,
    FourthLOut                  ,
    FourthLIn                   ,
    FourthRIn                   ,
    FourthROut                  ,

    TPMSNumMax                  ,
} TPMSNUM_t;

typedef enum
{
    SOLID_GRAY          =    0  ,
    WHITEBOX_GRAY               ,
    YELLOW_FLASH                ,
    SOLID_GREEN                 ,
hu's avatar
hu committed
75
} en_TPMSGUI;
hu's avatar
hu committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96



typedef struct
{
    uint8_t  TPMSTyreID                     ; /*轮胎位置            */
    uint16_t TPMSPressure                   ; /*轮胎气压            */
    uint8_t  TPMSTemp                       ; /*轮胎温度            */
    uint8_t  TPMSTempSign                   ; /*轮胎温度正负        */
    uint8_t  TPMSLowpressure                ; /*低气压报警          */
    uint8_t  TPMSHighpressure               ; /*高气压报警          */
    uint8_t  TPMSHightemperature            ; /*高温报警            */
    uint8_t  TPMSRapidleakage               ; /*快速漏气报警        */
    uint8_t  TPMSLowvoltage                 ; /*低电压报警          */
    uint8_t  TPMSNosignal                   ; /*无信号报警           */
    uint8_t  TPMSSensorfault                ; /*传感器故障信息       */

    uint8_t  TPMSPressureThresholdDetection ; /*压力检测            */
    uint8_t  TPMSStandarTempSetSts          ; /*轮胎标准温度设置状态  */
    uint8_t  TPMSInvaliddata                ; /*标识报警信号的有效性  */
    uint8_t  TPMSDataupdating               ; /*数据有效性           */
hu's avatar
hu committed
97

hu's avatar
hu committed
98
    //uint8_t  TPMSLostWarningSig             ; /*轮胎被盗报警信号      */
hu's avatar
hu committed
99 100
    //uint8_t  TPMSTemporaryNoSignal          ; /*短时无信号           */
    uint8_t  TPMSTempSigStat                ; /*轮胎温度符号状态      */
hu's avatar
hu committed
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
    uint16_t TPMSDataInvalidTime              ; /*数据无效计时器       */
    //uint16_t TPMSValueSta                   ; /*数据返回状态         */

    uint8_t CurPoxID                          ; /*当前光标位置*/
    en_TPMSGUI TPMSGuiSta                     ; /*轮子显示状态*/
    uint8_t PairSuccess                       ;
    uint8_t PairEn                            ;
    uint8_t PairTimer                         ;
    uint8_t PairCmd                           ; /*TxID 18033317 Byte1*/
    uint8_t TireNumber                        ; /*TxID 18033317 Byte2*/

} _USER_TPMS;

extern _USER_TPMS TPMS_Out[TPMSNumMax];

void Data_TPMS_KL30_Init(void);
void Data_TPMS_KL15_ON_Init(void);

void Get_Data_TPMS_Value(TPMSNUM_t TPMSTyreID);
void Get_Data_TPMS_Status(TPMSNUM_t TPMSTyreID);
void Get_Data_TPMS_Pair(TPMSNUM_t TPMSTyreID);

void Data_TPMS_Value_Processing(void );

uint16_t Get_DataTPMS_Pressure_Value(TPMSNUM_t TPMSTyreID);
uint16_t Get_DataTPMS_Pressure_Sta(TPMSNUM_t TPMSTyreID);
uint8_t Get_DataTPMS_Pressure_FLashSta(TPMSNUM_t TPMSTyreID);

uint16_t Get_DataTPMS_Temp_Value(TPMSNUM_t TPMSTyreID);
uint16_t Get_DataTPMS_Temp_Sta(TPMSNUM_t TPMSTyreID);
uint8_t Get_DataTPMS_Temp_FLashSta(TPMSNUM_t TPMSTyreID);

uint16_t Get_DataTPMS_Leakrate_Value(TPMSNUM_t TPMSTyreID);
uint8_t Get_DataTPMS_Highpressure_Value(TPMSNUM_t TPMSTyreID);
uint8_t Get_DataTPMS_Lowpressure_Value(TPMSNUM_t TPMSTyreID);
uint8_t Get_DataTPMS_SensorErrorWarningSig_Value(TPMSNUM_t TPMSTyreID);
uint8_t Get_DataTPMS_TyresLostWarningSig_Value(TPMSNUM_t TPMSTyreID);
hu's avatar
hu committed
138

hu's avatar
hu committed
139 140 141 142 143 144
uint8_t Get_DataTPMS_TireStandarPressureSettingSts_Value(TPMSNUM_t TPMSTyreID);
uint8_t Get_DataTPMS_TireStandarTemperatureSettingSts_Value(TPMSNUM_t TPMSTyreID);
uint8_t Get_DataTPMS_RapidLeakWarningSig_Value(TPMSNUM_t TPMSTyreID);
uint8_t Get_DataTPMS_TyreTempWarningSig_Value(TPMSNUM_t TPMSTyreID);
uint8_t Get_DataTPMS_TemporaryNoSignal_Value(TPMSNUM_t TPMSTyreID);

hu's avatar
hu committed
145 146 147 148
uint8_t Get_TPMSLowpressure_Sta(TPMSNUM_t TPMSTyreID);
uint8_t Get_TPMSHighpressure_Sta(TPMSNUM_t TPMSTyreID);
uint8_t Get_TPMSNosignal_Sta(TPMSNUM_t TPMSTyreID);
uint8_t Get_TPMSPresure_Alarm(TPMSNUM_t TPMSTyreID);
hu's avatar
hu committed
149 150 151 152 153 154 155 156 157 158

uint8_t Get_DataTPMS_Tyre_Red_Sta(TPMSNUM_t TPMSTyreID);
uint8_t Get_DataTPMS_Tyre_FLASH_Sta(TPMSNUM_t TPMSTyreID);

/*key 调用*/
extern void ChooseKey_TPMS_Event(TPMSNUM_t TPMSTyreID);
extern void EnterKey_TPMS_Event(TPMSNUM_t TPMSTyreID);
extern void ReturnKey_TPMS_Event(TPMSNUM_t TPMSTyreID);

/*Gui 调用*/
hu's avatar
hu committed
159
/*轮子的式样
hu's avatar
hu committed
160 161 162 163 164 165 166 167 168 169 170 171
SOLID_GRAY      -   全灰色
WHITEBOX_GRAY   -   灰色白框
YELLOW_FLASH    -   黄色闪烁
SOLID_GREEN     -   绿色
*/
extern en_TPMSGUI Get_TPMSSetGui_Sta(TPMSNUM_t TPMSTyreID);
/*
配对状态  0 - 失败  1 - 成功
*/
extern uint8_t Get_PairSuccess(TPMSNUM_t TPMSTyreID);

#endif