Skip to content

Commit

Permalink
compare app vs raw
Browse files Browse the repository at this point in the history
  • Loading branch information
BlakeFreer committed Jul 16, 2024
1 parent 74cfdef commit 03f8a75
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 26 deletions.
2 changes: 1 addition & 1 deletion firmware/projects/FrontController/vehicle_control_system
24 changes: 24 additions & 0 deletions firmware/projects/LVIocheckout/inc/app.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "shared/periph/gpio.h"

class Subsystem {
public:
/**
* @brief Construct a new Subsystem object
*
* @param enable_output Digital Output which enables the subsystem.
* enabled).
*/
Subsystem(shared::periph::DigitalOutput& enable_output)
: enable_output_(enable_output) {}

inline virtual void Enable() const {
enable_output_.SetHigh();
}

inline virtual void Disable() const {
enable_output_.SetLow();
}

private:
shared::periph::DigitalOutput& enable_output_;
};
66 changes: 42 additions & 24 deletions firmware/projects/LVIocheckout/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,64 @@
#include <cstdint>
#include <regex>

#include "app.h"
#include "bindings.h"
#include "inc/bindings.h"
#include "shared/periph/gpio.h"
#include "shared/periph/pwm.h"
#include "shared/util/mappers/identity.h"
#include "shared/util/mappers/mapper.h"

Subsystem front_controller{bindings::front_controller_en};

int main(void) {
bindings::Initialize();

while (true) {
// bool dcdc_valid = bindings::dcdc_valid.Read();
// TODO: set a digital out to this value.
bindings::accumulator_en.SetHigh();
bindings::dcdc_en.SetHigh();
bindings::tsal_en.SetHigh();
bindings::raspberry_pi_en.SetHigh();
bindings::front_controller_en.SetHigh();
bindings::speedgoat_en.SetHigh();
bindings::motor_ctrl_precharge_en.SetHigh();
bindings::motor_ctrl_en.SetHigh();
bindings::imu_gps_en.SetHigh();
bindings::shutdown_circuit_en.SetHigh();
bindings::inverter_en.SetHigh();
// bindings::accumulator_en.SetHigh();
// bindings::dcdc_en.SetHigh();
// bindings::tsal_en.SetHigh();
// bindings::raspberry_pi_en.SetHigh();
// bindings::front_controller_en.SetHigh();

bindings::DelayMS(1000);
for (int i = 0; i < 4; i++) {
front_controller.Enable();
bindings::DelayMS(500);
front_controller.Disable();
bindings::DelayMS(500);
}

bindings::accumulator_en.SetLow();
bindings::dcdc_en.SetLow();
bindings::tsal_en.SetLow();
bindings::raspberry_pi_en.SetLow();
bindings::front_controller_en.SetLow();
bindings::speedgoat_en.SetLow();
bindings::motor_ctrl_precharge_en.SetLow();
bindings::motor_ctrl_en.SetLow();
bindings::imu_gps_en.SetLow();
bindings::shutdown_circuit_en.SetLow();
bindings::inverter_en.SetLow();
bindings::DelayMS(1000);

for (int i = 0; i < 2; i++) {
bindings::front_controller_en.SetHigh();
bindings::DelayMS(1000);
bindings::front_controller_en.SetLow();
bindings::DelayMS(1000);
}
bindings::DelayMS(1000);

// bindings::speedgoat_en.SetHigh();
// bindings::motor_ctrl_precharge_en.SetHigh();
// bindings::motor_ctrl_en.SetHigh();
// bindings::imu_gps_en.SetHigh();
// bindings::shutdown_circuit_en.SetHigh();
// bindings::inverter_en.SetHigh();

// bindings::accumulator_en.SetLow();
// bindings::dcdc_en.SetLow();
// bindings::tsal_en.SetLow();
// bindings::raspberry_pi_en.SetLow();

// bindings::speedgoat_en.SetLow();
// bindings::motor_ctrl_precharge_en.SetLow();
// bindings::motor_ctrl_en.SetLow();
// bindings::imu_gps_en.SetLow();
// bindings::shutdown_circuit_en.SetLow();
// bindings::inverter_en.SetLow();

// bindings::DelayMS(1000);
}

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ ProjectManager.FreePins=false
ProjectManager.HalAssertFull=false
ProjectManager.HeapSize=0x200
ProjectManager.KeepUserCode=false
ProjectManager.LastFirmware=true
ProjectManager.LastFirmware=false
ProjectManager.LibraryCopy=1
ProjectManager.MainLocation=Src
ProjectManager.NoMain=true
Expand Down

0 comments on commit 03f8a75

Please sign in to comment.