Formula Student Electronics & Software
The code for the embedded software
Loading...
Searching...
No Matches
can.cpp File Reference
#include "can.h"
#include "debug.h"
Include dependency graph for can.cpp:

Go to the source code of this file.

Macros

#define DC_THRESHOLD   4328
 

Functions

void initCanMessages ()
 Initialize CAN messages.
 
void request_dataLOG_messages ()
 
void sendTorqueVal (int value_bamo)
 
void sendAPPS (int val1, int val2)
 
void initBamocarD3 ()
 
void REGIDHandler (const CAN_message_t &msg)
 
void canSniffer (const CAN_message_t &msg)
 
void canSetup ()
 

Variables

FlexCAN_T4< CAN1, RX_SIZE_256, TX_SIZE_16 > can1
 
CAN_message_t disable
 
CAN_message_t BTBStatus
 
CAN_message_t BTBCyclic
 
CAN_message_t noDisable
 
CAN_message_t clearErrors
 
CAN_message_t BTBResponse
 
CAN_message_t statusRequest
 
CAN_message_t torqueRequest
 
CAN_message_t enableResponse
 
CAN_message_t DCVoltageRequest
 
CAN_message_t actualSpeedRequest
 
CAN_message_t transmissionRequestEnable
 
CAN_message_t rpmRequest
 
CAN_message_t speedRequest
 
CAN_message_t currentMOTOR
 
CAN_message_t tempMOTOR
 
CAN_message_t tempBAMO
 
CAN_message_t VoltageMotor
 
CAN_message_t torque_motor
 
CAN_message_t battery_voltage
 
CAN_message_t ASStatus
 
int Ibat
 
int Vbat
 
int Mout
 
int Nact
 
int Vout
 
int Tpeak
 
int Iq_cmd
 
int Imax_peak
 
int I_con_eff
 
int Iq_actual
 
int I_lim_inuse
 
int I_actual_filtered
 
volatile bool BTBReady
 
volatile bool transmissionEnabled
 
volatile bool disabled
 
volatile bool TSOn
 
volatile bool R2DOverride
 
volatile bool ASReady
 
int highTemp
 
int soc
 
int current
 
int speedInt
 
int packVoltage
 
int lowTemp
 
int speed = 0
 
int current_BMS
 
int powerStageTemp
 
int motorTemp
 
int rpm
 
int ACCurrent
 
volatile uint16_t brakeValue
 
elapsedMillis R2DTimer
 
elapsedMillis CANTimer
 
const int CANTimeoutMS = 100
 
elapsedMillis ASEmergencyTimer
 
bool entered_emergency = false
 

Macro Definition Documentation

◆ DC_THRESHOLD

#define DC_THRESHOLD   4328

Definition at line 74 of file can.cpp.

Function Documentation

◆ canSetup()

void canSetup ( )

Definition at line 333 of file can.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ canSniffer()

void canSniffer ( const CAN_message_t &  msg)

Definition at line 278 of file can.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initBamocarD3()

void initBamocarD3 ( )

Definition at line 244 of file can.cpp.

Here is the caller graph for this function:

◆ initCanMessages()

void initCanMessages ( )

Initialize CAN messages.

Definition at line 86 of file can.cpp.

Here is the caller graph for this function:

◆ REGIDHandler()

void REGIDHandler ( const CAN_message_t &  msg)

Definition at line 260 of file can.cpp.

Here is the caller graph for this function:

◆ request_dataLOG_messages()

void request_dataLOG_messages ( )

Definition at line 152 of file can.cpp.

Here is the caller graph for this function:

◆ sendAPPS()

void sendAPPS ( int  val1,
int  val2 
)

Definition at line 227 of file can.cpp.

Here is the caller graph for this function:

◆ sendTorqueVal()

void sendTorqueVal ( int  value_bamo)

Definition at line 218 of file can.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ ACCurrent

int ACCurrent
extern

Definition at line 16 of file display.cpp.

◆ actualSpeedRequest

CAN_message_t actualSpeedRequest

Definition at line 16 of file can.cpp.

◆ ASEmergencyTimer

elapsedMillis ASEmergencyTimer

Definition at line 76 of file can.cpp.

◆ ASReady

volatile bool ASReady
extern

Definition at line 22 of file main.cpp.

◆ ASStatus

CAN_message_t ASStatus

Definition at line 28 of file can.cpp.

◆ battery_voltage

CAN_message_t battery_voltage

Definition at line 26 of file can.cpp.

◆ brakeValue

volatile uint16_t brakeValue
extern

Definition at line 11 of file apps.cpp.

◆ BTBCyclic

CAN_message_t BTBCyclic

Definition at line 8 of file can.cpp.

◆ BTBReady

volatile bool BTBReady
extern

Definition at line 16 of file main.cpp.

◆ BTBResponse

CAN_message_t BTBResponse

Definition at line 11 of file can.cpp.

◆ BTBStatus

CAN_message_t BTBStatus

Definition at line 7 of file can.cpp.

◆ can1

FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> can1

Write CSV fields feature example.

Definition at line 4 of file can.cpp.

◆ CANTimeoutMS

const int CANTimeoutMS = 100

Definition at line 72 of file can.cpp.

◆ CANTimer

elapsedMillis CANTimer

Definition at line 71 of file can.cpp.

◆ clearErrors

CAN_message_t clearErrors

Definition at line 10 of file can.cpp.

◆ current

int current
extern

Definition at line 59 of file main.cpp.

◆ current_BMS

int current_BMS
extern

Definition at line 12 of file main.cpp.

◆ currentMOTOR

CAN_message_t currentMOTOR

Definition at line 21 of file can.cpp.

◆ DCVoltageRequest

CAN_message_t DCVoltageRequest

Definition at line 15 of file can.cpp.

◆ disable

CAN_message_t disable

Definition at line 6 of file can.cpp.

◆ disabled

volatile bool disabled
extern

Definition at line 15 of file main.cpp.

◆ enableResponse

CAN_message_t enableResponse

Definition at line 14 of file can.cpp.

◆ entered_emergency

bool entered_emergency = false

Definition at line 78 of file can.cpp.

◆ highTemp

int highTemp
extern

Definition at line 20 of file display.cpp.

◆ I_actual_filtered

int I_actual_filtered

Definition at line 41 of file can.cpp.

◆ I_con_eff

int I_con_eff

Definition at line 38 of file can.cpp.

◆ I_lim_inuse

int I_lim_inuse

Definition at line 40 of file can.cpp.

◆ Ibat

int Ibat

Definition at line 30 of file can.cpp.

◆ Imax_peak

int Imax_peak

Definition at line 37 of file can.cpp.

◆ Iq_actual

int Iq_actual

Definition at line 39 of file can.cpp.

◆ Iq_cmd

int Iq_cmd

Definition at line 36 of file can.cpp.

◆ lowTemp

int lowTemp
extern

Definition at line 18 of file display.cpp.

◆ motorTemp

int motorTemp
extern

Definition at line 72 of file main.cpp.

◆ Mout

int Mout

Definition at line 32 of file can.cpp.

◆ Nact

int Nact

Definition at line 33 of file can.cpp.

◆ noDisable

CAN_message_t noDisable

Definition at line 9 of file can.cpp.

◆ packVoltage

int packVoltage
extern

Definition at line 22 of file display.cpp.

◆ powerStageTemp

int powerStageTemp
extern

Definition at line 71 of file main.cpp.

◆ R2DOverride

volatile bool R2DOverride
extern

Definition at line 20 of file main.cpp.

◆ R2DTimer

elapsedMillis R2DTimer
extern

Definition at line 44 of file main.cpp.

◆ rpm

int rpm
extern

Definition at line 11 of file display.cpp.

◆ rpmRequest

CAN_message_t rpmRequest

Definition at line 19 of file can.cpp.

◆ soc

int soc
extern

Definition at line 12 of file display.cpp.

◆ speed

int speed = 0

Definition at line 57 of file can.cpp.

◆ speedInt

int speedInt
extern

Definition at line 14 of file display.cpp.

◆ speedRequest

CAN_message_t speedRequest

Definition at line 20 of file can.cpp.

◆ statusRequest

CAN_message_t statusRequest

Definition at line 12 of file can.cpp.

◆ tempBAMO

CAN_message_t tempBAMO

Definition at line 23 of file can.cpp.

◆ tempMOTOR

CAN_message_t tempMOTOR

Definition at line 22 of file can.cpp.

◆ torque_motor

CAN_message_t torque_motor

Definition at line 25 of file can.cpp.

◆ torqueRequest

CAN_message_t torqueRequest

Definition at line 13 of file can.cpp.

◆ Tpeak

int Tpeak

Definition at line 35 of file can.cpp.

◆ transmissionEnabled

volatile bool transmissionEnabled
extern

Definition at line 17 of file main.cpp.

◆ transmissionRequestEnable

CAN_message_t transmissionRequestEnable

Definition at line 17 of file can.cpp.

◆ TSOn

volatile bool TSOn
extern

Definition at line 19 of file main.cpp.

◆ Vbat

int Vbat

Definition at line 31 of file can.cpp.

◆ VoltageMotor

CAN_message_t VoltageMotor

Definition at line 24 of file can.cpp.

◆ Vout

int Vout

Definition at line 34 of file can.cpp.