Formula Student Electronics & Software
The code for the embedded software
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
2#include "debugUtils.hpp"
5#include "enum_utils.hpp"
9#include "timings.hpp"
10
13 system_data_copy; // Copy of the model for Communicator (where interrupt updates are stored)
21
22void setup() {
23 Serial.begin(9600);
27 DEBUG_PRINT("Starting up...");
28}
29
30void loop() {
32
33 noInterrupts();
35 interrupts();
36
38
39 uint8_t current_master_state = to_underlying(as_state.state_);
40 uint8_t current_checkup_state = to_underlying(as_state._checkup_manager_.checkup_state_);
41
42 output_coordinator.process(current_master_state, current_checkup_state);
43
44 delay(LOOP_DELAY);
45}
The ASState class manages and transitions between different states of the vehicle system.
void calculate_state()
Calculates the state of the vehicle.
CheckupManager _checkup_manager_
CheckupManager object for handling various checkup operations.
State state_
Current state of the vehicle system, initialized to OFF.
CheckupState checkup_state_
Current state of the checkup process.
Class that contains definitions of typical messages to send via CAN It serves only as an example of t...
void init()
Initializes the CAN bus.
static SystemData * _systemData
Class responsible for the reading of the digital inputs into the Master teensy.
void digital_reads()
read all digital inputs
Class responsible for controlling digital outputs in the Master Teensy.
void process(uint8_t current_master_state, uint8_t current_checkup_state)
#define DEBUG_PRINT(str)
constexpr auto to_underlying(Enum e) noexcept
Definition enum_utils.hpp:4
Communicator communicator
Definition main.cpp:14
ASState as_state
Definition main.cpp:20
SystemData system_data
Definition main.cpp:11
OutputCoordinator output_coordinator
Definition main.cpp:18
void setup()
Definition main.cpp:22
DigitalSender digital_sender
Definition main.cpp:17
SystemData system_data_copy
Definition main.cpp:13
DigitalReceiver digital_receiver
Definition main.cpp:15
void loop()
Definition main.cpp:30
The whole model of the system: holds all the data necessary.
Mission mission_
HardwareData hardware_data_
constexpr auto LOOP_DELAY
Definition timings.hpp:8