Telltales_Lib.h 2.82 KB
Newer Older
时昊's avatar
时昊 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104


#ifndef TELLTALES_H
#define TELLTALES_H

/*
Platform_32Bit
Platform_16Bit
*/

#ifdef Platform_16Bit
    #define Tellib_uint8_t  unsigned char
    #define Tellib_uint16_t unsigned int
    #define Tellib_uint32_t unsigned long

#else
    #define Tellib_uint8_t  unsigned char
    #define Tellib_uint16_t unsigned short
    #define Tellib_uint32_t unsigned int
    #define Tellib_uint64_t unsigned long long
#endif

#ifndef Tellib_NULL
    #define Tellib_NULL ( void * )0u
#endif /* NULL */

#define Tel_MEM_Block_Addition (( Tellib_uint8_t )16u)
#define Tel_MEM_Block_Size     ((( Tellib_uint8_t )2u))
/*
total size =Tel_MEM_Block_Size*LED_Max+Tel_MEM_Block_Addition
*/
#define LED_OFF (Tellib_uint8_t)(0x00u)
#define LED_ON  (Tellib_uint8_t)(0x01u)

#define Diag_LED_OFF (Tellib_uint8_t)(0x10u)
#define Diag_LED_ON  (Tellib_uint8_t)(0x11u)

#define NoSelfCheck (Tellib_uint8_t)(0x00u)
#define SelfCheck   (Tellib_uint8_t)(0x01u)

#define LED_Exist   (Tellib_uint8_t)(0x00u)
#define LED_NOExist (Tellib_uint8_t)(0x01u)

#define AllowBreak (Tellib_uint8_t)(0x00u)
#define NoBreak    (Tellib_uint8_t)(0x01u)

#define NoExterNalCheck (Tellib_uint8_t)(0x00u)
#define ExterNalCheck   (Tellib_uint8_t)(0x01u)

#define LED_IGN_OFF    (Tellib_uint8_t)(0x00u)
#define LED_IGN_ON     (Tellib_uint8_t)(0x01u)
#define LED_IGN_ON_OFF (Tellib_uint8_t)(0x02u)

#define LED_PWR_OFF (Tellib_uint8_t)(0x00u)
#define LED_PWR_ON  (Tellib_uint8_t)(0x01u)

#define LED_CheckNoFinish (Tellib_uint8_t)(0x00u)
#define LED_CheckFinished (Tellib_uint8_t)(0x01u)

#define LED_OFF_State (Tellib_uint8_t)(0x00u)
#define LED_ON_State  (Tellib_uint8_t)(0x01u)

typedef Tellib_uint16_t (*LED_Judgment)(void);
typedef void (*LED_Execution)(Tellib_uint16_t led_status);

typedef Tellib_uint8_t (*LED_PowerSts)(void);
typedef Tellib_uint32_t (*LED_PowerONTimer)(void);
typedef Tellib_uint32_t (*LED_PowerOFFTimer)(void);

typedef struct
{
    Tellib_uint32_t   TotalLength;
    LED_PowerOFFTimer LED_PowerOFF_TimerCbk;
    LED_PowerONTimer  LED_PowerON_TimerCbk;
    LED_PowerSts      LED_PowerCbk;
} TelExtPara;

typedef struct
{
    Tellib_uint16_t LED_Index;
    Tellib_uint16_t isSelfCheck;
    Tellib_uint16_t isExCheck;
    Tellib_uint16_t WorkSts;

    Tellib_uint32_t CheckStart;
    Tellib_uint32_t CheckEnd;

    LED_Judgment  LED_Judgment_Cbk;
    LED_Execution LED_Execution_Cbk;
} LED_Attribute_st;

Tellib_uint16_t Get_TelltalesLedSts(Tellib_uint32_t LedIdx);
Tellib_uint16_t Tel_VersionGet(void);

void Telltales_Management(void);
void Test_LED_AllLight(Tellib_uint16_t LedSts);
void Telltales_KL30_Wakeup_Init(Tellib_uint8_t *MemSpace, const LED_Attribute_st *Array, TelExtPara *para);
void Telltales_DiagCtrl(Tellib_uint32_t ledIdx, Tellib_uint8_t LED_Sts);
void Telltales_DiagRelease(Tellib_uint32_t ledIdx);

void Telltales_KL15_Init(void);
void Telltales_SetCheckFinish(Tellib_uint8_t CheckFinish);

#endif