-
Notifications
You must be signed in to change notification settings - Fork 0
WIP: inverter interface add in (ignore branch name) #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 36 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
7e0b1c6
adding in linter w/ rules and step
RCMast3r 6a48d29
added in check steps
RCMast3r b728f9c
updating clang / ide stuff
RCMast3r 29b73b1
adding in linter w/ rules and step
RCMast3r c8e4f28
added in check steps
RCMast3r ab999fe
updating clang / ide stuff
RCMast3r 79206ee
WIP: Fixing linter errors
jhwang04 4c027b4
Merge branch 'feature/linter_formatter' of github.com:hytech-racing/V…
RCMast3r 9da3d5b
WIP: Fixing Linter errors
jhwang04 6a85a4b
Merge branch 'feature/linter_formatter' of github.com:hytech-racing/V…
RCMast3r 72fb475
Updated code to abide by clangtidy rules
jhwang04 1896d4b
Merge branch 'feature/linter_formatter' of github.com:hytech-racing/V…
RCMast3r e4045dd
(feat) changed some more linting rules
RCMast3r 5e6453e
adding in v2 for now
RCMast3r 82b7724
progress on drivetrain system
RCMast3r c14d410
added reqs / todos
RCMast3r b83d447
working through more of the state machine
RCMast3r bf03f2d
added current docs for drivetrain state machine
RCMast3r 93d08a1
new adds to drivetrain system
RCMast3r 452100c
added more design docs to the drivetrain system
RCMast3r 9adec30
added description for the inverter command messages
RCMast3r da5c80f
updated system and interface docs for inverter / drivetrain
RCMast3r 015cd9f
updated inverter messaging
RCMast3r 0ff34ec
adding in feedback types for the inverter interface
RCMast3r 0fa1c43
working through state machine
RCMast3r 0d560e3
adding in drivetrain system
RCMast3r e542af4
addressing linter errors
RCMast3r 1b4110c
merging with main
RCMast3r e1d0932
Add Inverter Interface
KrishKittur dfead07
first stab at CAN interface
KrishKittur 3f91ea0
Add library to ini and fix small build errors
KrishKittur 6bba319
Changed CAN interface and updated inverter inverter interface with ne…
KrishKittur e57b664
merging main in
RCMast3r 42aca00
changed inverter interface
KrishKittur 40893fe
merge
KrishKittur 296628d
builds
KrishKittur 45d3f5b
pluh
KrishKittur d3d879c
drivetrain system inital rev w/o torque and speed modes
KrishKittur 64da786
chill
KrishKittur ebea17e
add inverter params
KrishKittur f725a8d
Resolve PR comments
KrishKittur 8480610
Updated the inverter interface to include new CAN descriptions
KrishKittur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| #ifndef HYTECHCANINTERFACE | ||
| #define HYTECHCANINTERFACE | ||
|
|
||
| #include <FlexCAN_T4.h> | ||
| #include <hytech.h> | ||
| #include <etl/delegate.h> | ||
| #include <stdint.h> | ||
| #include <InverterInterface.h> | ||
| #include <MessageQueueDefine.h> | ||
|
|
||
| /* Recieve Buffers */ | ||
| extern CANBufferType CAN1_rxBuffer; | ||
| extern CANBufferType CAN2_rxBuffer; | ||
| extern CANBufferType CAN3_rxBuffer; | ||
|
|
||
| /* Transfer Buffers */ | ||
| extern CANBufferType CAN1_txBuffer; | ||
| extern CANBufferType CAN2_txBuffer; | ||
| extern CANBufferType CAN3_txBuffer; | ||
|
|
||
| /** | ||
| * Struct holding the interfaces processed by the ring buffer | ||
| */ | ||
|
|
||
| struct CANInterfaces | ||
| { | ||
| InverterInterface front_left_inv; | ||
| InverterInterface front_right_inv; | ||
| InverterInterface back_left_inv; | ||
| InverterInterface back_right_inv; | ||
| }; | ||
|
|
||
| /** Methods called on can recieve */ | ||
| void on_can1_recieve(const CAN_message_t &msg); | ||
|
|
||
| void on_can2_recieve(const CAN_message_t &msg); | ||
|
|
||
| void on_can3_recieve(const CAN_message_t &msg); | ||
|
|
||
| /** | ||
| * Recieving CAN messages | ||
| * (needs to be called in a loop) | ||
| */ | ||
| template <typename BufferType> | ||
| void process_ring_buffer(BufferType &rx_buffer, CANInterfaces interfaces) { | ||
| while (rx_buffer.available()) | ||
| { | ||
| CAN_message_t recvd_msg; | ||
| uint8_t buf[sizeof(CAN_message_t)]; | ||
| rx_buffer.pop_front(buf, sizeof(CAN_message_t)); | ||
| memmove(&recvd_msg, buf, sizeof(recvd_msg)); | ||
| switch (recvd_msg.id) | ||
| { | ||
| // FL Inverter | ||
| case (MCI1_STATUS_CANID): | ||
| interfaces.front_left_inv.recieve_MCI_STATUS(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI1_TEMPS_CANID): | ||
| interfaces.front_left_inv.recieve_MCI_TEMPS(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI1_DYNAMICS_CANID): | ||
| interfaces.front_left_inv.recieve_MCI_DYNAMICS(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI1_POWER_CANID): | ||
| interfaces.front_left_inv.recieve_MCI_POWER(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI1_FEEDBACK_CANID): | ||
| interfaces.front_left_inv.recieve_MCI_FEEDBACK(recvd_msg); | ||
|
|
||
| // FR inverter | ||
| case (MCI2_STATUS_CANID): | ||
| interfaces.front_right_inv.recieve_MCI_STATUS(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI2_TEMPS_CANID): | ||
| interfaces.front_right_inv.recieve_MCI_TEMPS(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI2_DYNAMICS_CANID): | ||
| interfaces.front_right_inv.recieve_MCI_DYNAMICS(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI2_POWER_CANID): | ||
| interfaces.front_right_inv.recieve_MCI_POWER(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI2_FEEDBACK_CANID): | ||
| interfaces.front_right_inv.recieve_MCI_FEEDBACK(recvd_msg); | ||
|
|
||
| // RL Inverter | ||
| case (MCI3_STATUS_CANID): | ||
| interfaces.back_left_inv.recieve_MCI_STATUS(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI3_TEMPS_CANID): | ||
| interfaces.back_left_inv.recieve_MCI_TEMPS(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI3_DYNAMICS_CANID): | ||
| interfaces.back_left_inv.recieve_MCI_DYNAMICS(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI3_POWER_CANID): | ||
| interfaces.back_left_inv.recieve_MCI_POWER(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI3_FEEDBACK_CANID): | ||
| interfaces.back_left_inv.recieve_MCI_FEEDBACK(recvd_msg); | ||
|
|
||
| // RR Inverter | ||
| case (MCI4_STATUS_CANID): | ||
| interfaces.back_right_inv.recieve_MCI_STATUS(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI4_TEMPS_CANID): | ||
| interfaces.back_right_inv.recieve_MCI_TEMPS(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI4_DYNAMICS_CANID): | ||
| interfaces.back_right_inv.recieve_MCI_DYNAMICS(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI4_POWER_CANID): | ||
| interfaces.back_right_inv.recieve_MCI_POWER(recvd_msg); | ||
| break; | ||
|
|
||
| case (MCI4_FEEDBACK_CANID): | ||
| interfaces.back_right_inv.recieve_MCI_FEEDBACK(recvd_msg); | ||
|
|
||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Sending CAN messages | ||
| * (needs to be called in loop) | ||
| * */ | ||
| template <typename bufferType> | ||
| void send_all_CAN_msgs(bufferType &tx_buffer, FlexCAN_T4_Base *can_interface) | ||
| { | ||
| CAN_message_t msg; | ||
| while (tx_buffer.available()) | ||
| { | ||
| CAN_message_t msg; | ||
| uint8_t buf[sizeof(CAN_message_t)]; | ||
| tx_buffer.pop_front(buf, sizeof(CAN_message_t)); | ||
| memmove(&msg, buf, sizeof(msg)); | ||
| can_interface->write(msg); | ||
| } | ||
| } | ||
|
|
||
| #endif /* HYTECHCANINTERFACE */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #ifndef MESAGE_QUEUE_DEFINE_H | ||
| #define MESAGE_QUEUE_DEFINE_H | ||
|
|
||
| #include "FlexCAN_T4.h" | ||
|
|
||
| using CANBufferType = Circular_Buffer<uint8_t, (uint32_t)128, sizeof(CAN_message_t)>; | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "name": "interfaces-lib", | ||
| "version": "1.0.0", | ||
| "license": "MIT", | ||
| "dependencies": { | ||
| "can_lib": "*", | ||
| "shared_data": "*", | ||
| "CASE_lib": "*", | ||
| "nanopb": "*" | ||
| }, | ||
| "frameworks": "*", | ||
| "platforms": "*" | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.