Skip to content

Commit

Permalink
Added some encode functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Imeguras committed Dec 9, 2023
1 parent 487a1c9 commit b988974
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions CAN_datadb.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@
#define MAP_DECODE_CONSUMED_POWER(x) (x[7] << 16 | x[6] << 8 | x[5])
#define MAP_DECODE_TARGET_POWER (x) (x[4] << 16 | x[3] << 8 | x[2])
#define MAP_DECODE_BRAKE_PRESSURE (x)(x[1])
#define MAP_DECODE_THROTTLE_POSITION (x) (x[0]) #define MAP_APPS (x) MAP_THROTTLE_POSITION(x)


#define MAP_DECODE_THROTTLE_POSITION (x) (x[0])

#define MAP_DECODE_APPS (x) MAP_DECODE_THROTTLE_POSITION(x)

#define MAP_ENCODE_CONSUMED_POWER(pnt, x) (pnt[7] = (x >> 16) & 0xFF, pnt[6] = (x >> 8) & 0xFF, pnt[5] = x & 0xFF)
#define MAP_ENCODE_TARGET_POWER(pnt, x) (pnt[4] = (x >> 16) & 0xFF, pnt[3] = (x >> 8) & 0xFF, pnt[2] = x & 0xFF)
#define MAP_ENCODE_BRAKE_PRESSURE(pnt, x) (pnt[1] = x)
#define MAP_ENCODE_THROTTLE_POSITION(pnt, x) (pnt[0] = x)

#define MAP_ENCODE_APPS(pnt, x) MAP_ENCODE_THROTTLE_POSITION(pnt, x)

/**======================================================================**/
#define CAN_VCU_MODULUS_2 0x021
Expand Down

0 comments on commit b988974

Please sign in to comment.