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

Go to the source code of this file.

Macros

#define SHUTDOWN_PIN   32
 
#define CH_SAFETY_PIN   36
 
#define LATCHING_ERROR_PIN   34
 
#define MAX_VOLTAGE   456000
 
#define MAX_CURRENT   18000
 

Enumerations

enum  status { idle , charging , shutdown }
 

Functions

void parseMessage (CAN_message_t message)
 
void canint (const CAN_message_t &message)
 
void setup ()
 
void chargerMachine ()
 
void printStates ()
 
void readInputs ()
 
void powerOnModule (bool OnOff)
 
void setVoltage (uint32_t voltage)
 
void setCurrent (uint32_t current)
 
void setLOW ()
 
void updateCharger (status CH_Status)
 
void loop ()
 

Variables

FlexCAN_T4< CAN1, RX_SIZE_256, TX_SIZE_16 > can1
 
elapsedMillis step
 
elapsedMillis temp
 
PARAMETERS param
 
bool request = 0
 
bool charge = 0
 
bool shutdownStatus = 0
 
bool latchingStatus = 0
 
status CH_Status
 
status NX_CH_Status
 
String CH_Status_Strings [] = {"idle", "charging", "shutdown"}
 

Macro Definition Documentation

◆ CH_SAFETY_PIN

#define CH_SAFETY_PIN   36

Definition at line 13 of file main.cpp.

◆ LATCHING_ERROR_PIN

#define LATCHING_ERROR_PIN   34

Definition at line 14 of file main.cpp.

◆ MAX_CURRENT

#define MAX_CURRENT   18000

Definition at line 17 of file main.cpp.

◆ MAX_VOLTAGE

#define MAX_VOLTAGE   456000

Definition at line 16 of file main.cpp.

◆ SHUTDOWN_PIN

#define SHUTDOWN_PIN   32

Definition at line 12 of file main.cpp.

Enumeration Type Documentation

◆ status

enum status
Enumerator
idle 
charging 
shutdown 

Definition at line 26 of file main.cpp.

Function Documentation

◆ canint()

void canint ( const CAN_message_t &  message)

Definition at line 234 of file main.cpp.

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

◆ chargerMachine()

void chargerMachine ( )

Definition at line 261 of file main.cpp.

Here is the caller graph for this function:

◆ loop()

void loop ( )

Definition at line 381 of file main.cpp.

Here is the call graph for this function:

◆ parseMessage()

void parseMessage ( CAN_message_t  message)

Definition at line 37 of file main.cpp.

Here is the caller graph for this function:

◆ powerOnModule()

void powerOnModule ( bool  OnOff)

Definition at line 300 of file main.cpp.

Here is the caller graph for this function:

◆ printStates()

void printStates ( )

Definition at line 288 of file main.cpp.

Here is the caller graph for this function:

◆ readInputs()

void readInputs ( )

Definition at line 294 of file main.cpp.

Here is the caller graph for this function:

◆ setCurrent()

void setCurrent ( uint32_t  current)

Definition at line 339 of file main.cpp.

Here is the caller graph for this function:

◆ setLOW()

void setLOW ( )

Definition at line 357 of file main.cpp.

◆ setup()

void setup ( )

Definition at line 237 of file main.cpp.

Here is the call graph for this function:

◆ setVoltage()

void setVoltage ( uint32_t  voltage)

Definition at line 321 of file main.cpp.

Here is the caller graph for this function:

◆ updateCharger()

void updateCharger ( status  CH_Status)

Definition at line 375 of file main.cpp.

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

Variable Documentation

◆ can1

FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> can1

Write CSV fields feature example.

Definition at line 7 of file main.cpp.

◆ CH_Status

status CH_Status

Definition at line 32 of file main.cpp.

◆ CH_Status_Strings

String CH_Status_Strings[] = {"idle", "charging", "shutdown"}

Definition at line 35 of file main.cpp.

◆ charge

bool charge = 0

Definition at line 22 of file main.cpp.

◆ latchingStatus

bool latchingStatus = 0

Definition at line 24 of file main.cpp.

◆ NX_CH_Status

status NX_CH_Status

Definition at line 33 of file main.cpp.

◆ param

PARAMETERS param

Definition at line 19 of file main.cpp.

◆ request

bool request = 0

Definition at line 21 of file main.cpp.

◆ shutdownStatus

bool shutdownStatus = 0

Definition at line 23 of file main.cpp.

◆ step

elapsedMillis step

Definition at line 9 of file main.cpp.

◆ temp

elapsedMillis temp

Definition at line 10 of file main.cpp.