Skip to content

Commit

Permalink
Integrated rpm and wheel speed into ShiftController
Browse files Browse the repository at this point in the history
  • Loading branch information
crsz20 committed Jul 11, 2024
1 parent 910f865 commit 58f05be
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

namespace application {

ShiftController::ShiftController() { }

ShiftController::ShiftController(int16_t &rpm_observer,
std::array<float, 2> &wheel_speeds_observer)
: rpm_(rpm_observer), wheel_speeds_(wheel_speeds_observer) {}

ShiftController::~ShiftController() { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

// Standard Libraries
#include <cstdio>
#include <cinttypes>

#include <array>


namespace application {

Expand Down Expand Up @@ -57,9 +61,12 @@ class ShiftController {
};

State* current_state_{&neutral_state_};
int16_t& rpm_;
std::array<float, 2>& wheel_speeds_;

public:
ShiftController();
ShiftController(int16_t &rpm_observer,
std::array<float, 2> &wheel_speeds_observer);

~ShiftController();

Expand Down
6 changes: 5 additions & 1 deletion Firmware/Shifter_System/Program/Src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern CAN_HandleTypeDef hcan1;
// DFR Custom Dependencies
#include "app.hpp"
#include "../../Core/Inc/retarget.h"
#include "Application/ShiftController/shift_controller.hpp"
#include "./Platform/STM/F4/CAN/bxcan_stmf4.hpp"
#include "./Platform/Interfaces/ican.hpp"
#include "./Sensor/ECU/PE3/iecu.hpp"
Expand Down Expand Up @@ -71,11 +72,14 @@ void cppMain() {
bx_can_peripheral->ConfigureReceiveCallback(rx_interrupt_mode);
bx_can_peripheral->EnableInterruptMode();

int16_t rpm;
int16_t rpm = 0;
std::array<float, 2> wheel_speeds;

application::ShiftController shift_controller(rpm, wheel_speeds);

for(;;){

// Check for updated CAN messages
if (pe3_ecu.NewMessageArrived()) {
can_bus->DisableInterruptMode();

Expand Down

0 comments on commit 58f05be

Please sign in to comment.