Skip to content

Commit

Permalink
Added a few more things
Browse files Browse the repository at this point in the history
  • Loading branch information
Imeguras committed Mar 5, 2024
1 parent b988974 commit 38be4ad
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CAN_asdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @brief CAN database for autonomous driving header file
* @details This file contains the mapping used to encode and decode CAN messages
* @author João Vieira
* @version 0.0.0
**/
#ifndef CAN_ASDB_H
#define CAN_ASDB_H
Expand All @@ -12,9 +13,11 @@
**/
#define CAN_AS_STATUS 0x502
/**======================================================================**/
#define MAP_DECODE_AS_MISSION(x) (x[0]&0xE0)
#define MAP_DECODE_AS_EBS(x) (x[0]&0x18)
#define MAP_DECODE_AS_STATE(x) (x[0]&0x07)

#define MAP_ENCODE_AS_MISSION(pnt, x)(pnt[0]=(pnt[0]&0x1F) | (x&0xE0) )
#define MAP_ENCODE_AS_EBS(pnt, x)(pnt[0]=(pnt[0]&0xE7) | (x&0x18) )
#define MAP_ENCODE_AS_STATE(pnt, x)(pnt[0]=(pnt[0]&0xF8)| (x&0x07) )

Expand Down
13 changes: 10 additions & 3 deletions CAN_datadb.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
* @file CAN_datadb.h
* @brief CAN database header file for the data line
* @details This file contains the mapping used to encode and decode CAN messages
* @note THIS IS OBSOLETE/NEEDS TO BE UPDATED
* @note This is being developed as of right now
* @author João Vieira
* @version 0.0.0
**/
#ifndef CAN_DATADB_H
#define CAN_DATADB_H

//#ifdef __LART_T24__

/**
* @brief T24 uses a little endian architecture when it comes to CAN messages
**/
Expand Down Expand Up @@ -39,10 +41,13 @@
#define MAP_DECODE_INVERTER_TEMPERATURE(x) ((x[3] << 8 | x[2]) +40)
#define MAP_DECODE_INVERTER_VOLTAGE(x) ((x[1] << 8 | x[0]))


/**======================================================================**/
#define CAN_VCU_MODULUS_3 0x022
/**======================================================================**/


/**======================================================================**/
#define CAN_TCU_MODULUS_1 0x60
#define CAN_TCU_MODULUS_1 0x060
/**======================================================================**/
#define MAP_DECODE_FIRSTSEGMENT_TEMPERATURE(x) (x[7] << 8 | x[6])
#define MAP_DECODE_PACK_MEAN_TEMPERATURE(x) (x[5] << 8 | x[4])
Expand All @@ -51,6 +56,8 @@
#define MAP_DECODE_POWER_TO_BATTERY_FANS(x) (x[1])**/
#define MAP_DECODE_COLLING_BOARD_STATE(x) (x[0])





//#endif
Expand Down
14 changes: 12 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,24 @@ Rules are Master is only used for stable/tested versions use Dev Branch to paste

## Why the F*ck would i use this

Doing all the work of properly fetching data from a full array **isnt a prestigious job**, nor will anyone clap their hands because you sucessfully decoded a message acording to what was previously defined.
Doing all the work of properly fetching data from a full array **isnt a prestigious job**, nor will anyone clap their hands because you successfully decoded a message acording to what was previously defined.

As such working with byte or worse, bitwise operations, is a dull and gruesome task which is prone to error and wastes time when you could be doing better jobs.

As such this library is designed to be easy to install, light, and easy to work with, hopefully this will increase the throughput of significant work.

**Pro Tip: Its better for 5 people to find and solve 20 shared bugs than it is for one person to find and solve a single bug.**

## This sucks! I just want to decode a single message!!
## This sucks! Why is the library so crappy?

See: Contributing

## It doesnt even work properly!!!

See: Contributing

## Headers
All headers for both can and canfd are prefixed with CAN(all in caps), and suffixed with db and its respective extension
CAN_asdb.h : Contains the header for the autonomous system bus
CAN_datadb.h : Contains the header for the data bus

0 comments on commit 38be4ad

Please sign in to comment.