MCU
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MCUStateMachine< DrivetrainSysType > Class Template Reference

#include <MCUStateMachine.h>

Collaboration diagram for MCUStateMachine< DrivetrainSysType >:
Collaboration graph

Public Member Functions

 MCUStateMachine (BuzzerController *buzzer, DrivetrainSysType *drivetrain, DashboardInterface *dashboard, PedalsSystem *pedals, TCMuxType *mux, SafetySystem *safety_system)
 
void tick_state_machine (unsigned long cm, const SharedCarState_s &current_car_state)
 function to tick the state machine. More...
 
CAR_STATE get_state ()
 
bool car_in_ready_to_drive ()
 

Private Member Functions

void set_state_ (CAR_STATE new_state, unsigned long curr_time)
 
void handle_entry_logic_ (CAR_STATE new_state, unsigned long curr_time)
 the function run upon the entry of the car into a new state More...
 
void handle_exit_logic_ (CAR_STATE prev_state, unsigned long curr_time)
 function run upon the exit of a state More...
 

Private Attributes

CAR_STATE current_state_
 
BuzzerControllerbuzzer_
 components within state machine More...
 
DrivetrainSysType * drivetrain_
 
PedalsSystempedals_
 
DashboardInterfacedashboard_
 drivers within state machine More...
 
SafetySystemsafety_system_
 
TCMuxTypecontroller_mux_
 

Detailed Description

template<typename DrivetrainSysType>
class MCUStateMachine< DrivetrainSysType >

Definition at line 26 of file MCUStateMachine.h.

Constructor & Destructor Documentation

◆ MCUStateMachine()

template<typename DrivetrainSysType >
MCUStateMachine< DrivetrainSysType >::MCUStateMachine ( BuzzerController buzzer,
DrivetrainSysType *  drivetrain,
DashboardInterface dashboard,
PedalsSystem pedals,
TCMuxType mux,
SafetySystem safety_system 
)
inline

Definition at line 29 of file MCUStateMachine.h.

35 {
36 current_state_ = CAR_STATE::STARTUP;
39 dashboard_ = dashboard;
40 pedals_ = pedals;
41 controller_mux_ = mux;
42 safety_system_ = safety_system;
43 }
PedalsSystem * pedals_
TCMuxType * controller_mux_
CAR_STATE current_state_
BuzzerController * buzzer_
components within state machine
DashboardInterface * dashboard_
drivers within state machine
SafetySystem * safety_system_
DrivetrainSysType * drivetrain_
DriveSys_t drivetrain
Definition: main.cpp:223
BuzzerController buzzer(BUZZER_ON_INTERVAL)
Definition: main.cpp:325

Member Function Documentation

◆ car_in_ready_to_drive()

template<typename DrivetrainSysType >
bool MCUStateMachine< DrivetrainSysType >::car_in_ready_to_drive ( )
inline

Definition at line 52 of file MCUStateMachine.h.

52{ return current_state_ == CAR_STATE::READY_TO_DRIVE; };

◆ get_state()

template<typename DrivetrainSysType >
CAR_STATE MCUStateMachine< DrivetrainSysType >::get_state ( )
inline

Definition at line 51 of file MCUStateMachine.h.

51{ return current_state_; }

◆ handle_entry_logic_()

template<typename DrivetrainSysType >
void MCUStateMachine< DrivetrainSysType >::handle_entry_logic_ ( CAR_STATE  new_state,
unsigned long  curr_time 
)
private

the function run upon the entry of the car into a new state

Parameters
new_statethe state in which we are entering

◆ handle_exit_logic_()

template<typename DrivetrainSysType >
void MCUStateMachine< DrivetrainSysType >::handle_exit_logic_ ( CAR_STATE  prev_state,
unsigned long  curr_time 
)
private

function run upon the exit of a state

Parameters
prev_statethe state in which we are leaving

◆ set_state_()

template<typename DrivetrainSysType >
void MCUStateMachine< DrivetrainSysType >::set_state_ ( CAR_STATE  new_state,
unsigned long  curr_time 
)
private

◆ tick_state_machine()

template<typename DrivetrainSysType >
void MCUStateMachine< DrivetrainSysType >::tick_state_machine ( unsigned long  cm,
const SharedCarState_s current_car_state 
)

function to tick the state machine.

Parameters
cmcurrent millis from systick
current_car_statecurrent state of the car (not to be confused with the CAR_STATE enum which is the state machine state)

Member Data Documentation

◆ buzzer_

template<typename DrivetrainSysType >
BuzzerController* MCUStateMachine< DrivetrainSysType >::buzzer_
private

components within state machine

Definition at line 67 of file MCUStateMachine.h.

◆ controller_mux_

template<typename DrivetrainSysType >
TCMuxType* MCUStateMachine< DrivetrainSysType >::controller_mux_
private

Definition at line 75 of file MCUStateMachine.h.

◆ current_state_

template<typename DrivetrainSysType >
CAR_STATE MCUStateMachine< DrivetrainSysType >::current_state_
private

Definition at line 64 of file MCUStateMachine.h.

◆ dashboard_

template<typename DrivetrainSysType >
DashboardInterface* MCUStateMachine< DrivetrainSysType >::dashboard_
private

drivers within state machine

Definition at line 72 of file MCUStateMachine.h.

◆ drivetrain_

template<typename DrivetrainSysType >
DrivetrainSysType* MCUStateMachine< DrivetrainSysType >::drivetrain_
private

Definition at line 68 of file MCUStateMachine.h.

◆ pedals_

template<typename DrivetrainSysType >
PedalsSystem* MCUStateMachine< DrivetrainSysType >::pedals_
private

Definition at line 69 of file MCUStateMachine.h.

◆ safety_system_

template<typename DrivetrainSysType >
SafetySystem* MCUStateMachine< DrivetrainSysType >::safety_system_
private

Definition at line 74 of file MCUStateMachine.h.


The documentation for this class was generated from the following file: