62 lines
1.9 KiB
C
62 lines
1.9 KiB
C
#ifndef __CAN_PACKET_INCLUDE__
|
|
#define __CAN_PACKET_INCLUDE__
|
|
|
|
/******************************************************************************
|
|
* includes
|
|
*****************************************************************************/
|
|
|
|
#ifdef __linux__
|
|
#include <sys/types.h>
|
|
#endif
|
|
|
|
/******************************************************************************
|
|
* defines
|
|
*****************************************************************************/
|
|
|
|
/******************************************************************************
|
|
* structs & typedefs
|
|
*****************************************************************************/
|
|
|
|
// all data is network byte order (big endian)
|
|
typedef struct _CAN_Packet {
|
|
uint32_t dwCounter; // incrementing counter
|
|
|
|
// J2735 Part 1 floating point
|
|
float fSpeed; // meters/sec (m/s)
|
|
float fSteering; // degrees/sec
|
|
float fAccelLongitudinal; // meters/sec^2
|
|
float fAccelLateral; // meters/sec^2
|
|
float fAccelVertical; // meters/sec^2
|
|
float fYawRate; // degrees/sec
|
|
float fVehicleWidth;
|
|
float fVehicleLength;
|
|
// J2735 Part 2 floating point
|
|
float fThrottle; // %
|
|
|
|
// J2735 Part 1/2 integer
|
|
uint16_t wBrakeSystemStatus;
|
|
uint8_t byTransmission;
|
|
uint8_t byExteriorLights;
|
|
// J2735 Part 2 integer
|
|
uint16_t wEventFlags;
|
|
uint8_t byFrontWipers;
|
|
} __attribute__((packed)) CAN_Packet;
|
|
|
|
/******************************************************************************
|
|
* function prototypes
|
|
*****************************************************************************/
|
|
/* export C functions to C++ */
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
/******************************************************************************
|
|
* Macros
|
|
* ***************************************************************************/
|
|
|
|
#endif
|
|
|