yy1717
2024-02-28 27fc91fbe8f88b6885356e68828cfe1ce1db7601
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
//
// Created by fctom on 2020/2/13.
//
 
#ifndef MYAPPLICATION2_COMM_TEST_H
#define MYAPPLICATION2_COMM_TEST_H
 
#include <cstdint>
 
// Name
enum {
    OBD_SPEED,
    ENGINE_RPM,
    GEAR,
    TURN_SIGNAL_LAMP,
    DIPPED_BEAM_LAMP,
    FOG_LAMP,
    CLEARANCE_LAMP,
    FLASH_BEAM_LAMP,
    MAIN_BEAM_LAMP,
    SEATBELT,
    ENGINE_START,
    BRAKE,
    HAND_BRAKE,
    SECOND_BRAKE,
    DOOR,
    SURROUND_CAR_1,
    SURROUND_CAR_2,
    SURROUND_CAR_3,
    SURROUND_CAR_4,
    CAR_STATUS_END              //////////////
};
 
#define LIGHT_OFF   0
#define LIGHT_ON    1
#define INACTIVE    0
#define ACTIVE      1
#define DOOR_OPEN   0
#define DOOR_CLOSE  1
#define EJECT       0
#define INSERT      1
 
// Value
enum {
    GEAR_N,
    GEAR_1,
    GEAR_2,
    GEAR_3,
    GEAR_4,
    GEAR_5,
    GEAR_R,
    HAZARD_LIGHTS,
    LEFT_TURN_LIGHT,
    RIGHT_TURN_LIGHT
};
 
typedef struct {
    int odo;
    int trip;
    int tripTime;
    double cellVolt;
    double speed;
    int engine;
    int sas;
    int key;
    int gear;
    int aps;
    int door;
    int seatBelt;
    int clutch;
    int horn;
    int wiper;
    int handBreak;
    int mainBreak;
    int leftTurnLamp;
    int rightTurnLamp;
    int clearanceLamp;
    int dippedBeamLamp;
    int mainBeamLamp;
    int fogLamp;
    int assBreak;
    int surround1;
    int surround2;
    int surround3;
    int surround4;
} car_sensor_t;
 
void CarSensorInit(void);
int ReadCarStatus(uint16_t id);
void UpdateSensorHw(const car_sensor_t *s);
 
void SetSensorCfg(int (*sensor)[3], int sensorNum);
 
#endif //MYAPPLICATION2_COMM_TEST_H