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
18TeensyTimerTool::PeriodicTimer watchdog_timer_;
19bool is_first_loop = true;
20void setup() {
21 Serial.begin(9600);
25 DEBUG_PRINT("Starting up...");
26 delay(100);
27}
28
29void loop() {
31 noInterrupts();
33 interrupts();
34
36 uint8_t current_master_state = to_underlying(as_state.state_);
37 uint8_t current_checkup_state = to_underlying(as_state._checkup_manager_.checkup_state_);
39
40 output_coordinator.process(current_master_state, current_checkup_state, ebs_state);
41
42 delay(LOOP_DELAY);
43}
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.
EbsPressureTestPhase pressure_test_phase_
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, uint8_t ebs_state)
#define DEBUG_PRINT(str)
constexpr auto to_underlying(Enum e) noexcept
Definition enum_utils.hpp:4
TeensyTimerTool::PeriodicTimer watchdog_timer_
Definition main.cpp:18
Communicator communicator
Definition main.cpp:12
ASState as_state
Definition main.cpp:17
SystemData system_data
Definition main.cpp:11
OutputCoordinator output_coordinator
Definition main.cpp:15
void setup()
Definition main.cpp:20
DigitalSender digital_sender
Definition main.cpp:14
bool is_first_loop
Definition main.cpp:19
DigitalReceiver digital_receiver
Definition main.cpp:13
void loop()
Definition main.cpp:29
The whole model of the system: holds all the data necessary.
NonUnitaryFailureDetection updatable_timestamps_
NonUnitaryFailureDetection updated_timestamps_
constexpr auto LOOP_DELAY
Definition timings.hpp:8