-
Notifications
You must be signed in to change notification settings - Fork 1
FWT-146 Solve Dat One (SDO) Issue #112
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
Merged
Merged
Changes from 46 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
dfad85a
SDO Sample
DiegoLHendrix 35424c8
This SDO no worky
DiegoLHendrix dd1dd90
Merge branch 'main' of https://github.com/RIT-EVT/EVT-core into featu…
DiegoLHendrix c00d790
idk anymore
DiegoLHendrix fbeb922
Merge branch 'main' of https://github.com/RIT-EVT/EVT-core into featu…
DiegoLHendrix 4451a8b
The voices are getting louder
DiegoLHendrix ae64dc7
I Start Drinking On mondays at 8:15 am
DiegoLHendrix 028f030
Start Drinking On comapny time
DiegoLHendrix 9169c95
Good heavens I have arrived!
DiegoLHendrix 4c750e4
Added comments
DiegoLHendrix 580dbfa
CANopen is my sleep paralysis demon
DiegoLHendrix fff86b4
Merge branch 'main' of https://github.com/RIT-EVT/EVT-core into featu…
DiegoLHendrix ffc8495
please work cmake
DiegoLHendrix f85675a
Merge branch 'main' into feature/diegolhendrix/sdo-sample
DiegoLHendrix 6319675
Merge branch 'main' of https://github.com/RIT-EVT/EVT-core into featu…
DiegoLHendrix 9301881
Beetlejuice Beetlejuice Beetlejuice
DiegoLHendrix 8a9b880
I am the Oppenheimer of CAN
DiegoLHendrix 53d5b88
Merge branch 'feature/diegolhendrix/sdo-sample' of https://github.com…
DiegoLHendrix ff17043
Applied Formatting Changes During GitHub Build
359df66
Get me out of PR review hell
DiegoLHendrix 0563097
Applied Formatting Changes During GitHub Build
7ee46da
I am Tyler Durden
DiegoLHendrix 92d8cc7
Applied Formatting Changes During GitHub Build
df47e01
Merge branch 'main' of https://github.com/RIT-EVT/EVT-core into featu…
DiegoLHendrix a651e26
Made a macro and changed registerCallBack
DiegoLHendrix f4aca03
Applied Formatting Changes During GitHub Build
83b893b
Increased size of message size in snprintf
DiegoLHendrix 0c37b58
Merge branch 'main' into feature/diegolhendrix/sdo-sample
DiegoLHendrix d4f9389
Started pr changes
DiegoLHendrix 04e4cfd
Added #ifdef to sdo canInterupt
DiegoLHendrix ff7c199
Deleted unnecessary comments
DiegoLHendrix ad442dc
Applied Formatting Changes During GitHub Build
221c07c
Edited more comments
DiegoLHendrix ea7e8b2
Fixed SDO_CONFIGURATION_1200 method in SDOCanNode.hpp
DiegoLHendrix 3587bce
Merge branch 'main' into feature/diegolhendrix/sdo-sample
DiegoLHendrix 59806c1
Merge branch 'main' into feature/diegolhendrix/sdo-sample
DiegoLHendrix 9cf8008
Merge branch 'feature/diegolhendrix/sdo-sample' of https://github.com…
DiegoLHendrix d0dc51b
Fixed SDO methods
DiegoLHendrix 5c1b840
Merge branch 'main' into feature/diegolhendrix/sdo-sample
DiegoLHendrix 9532b47
Fixed UART in tpdo and rpdo after a merging error
DiegoLHendrix 0a003be
Applied Formatting Changes During GitHub Build
d03bdb9
Merge remote-tracking branch 'origin/main' into feature/diegolhendrix…
DiegoLHendrix cec169e
PR Changes
DiegoLHendrix 78357c8
Applied Formatting Changes During GitHub Build
816429c
Updated SDO transfer function to get the value to be transferred as c…
DiegoLHendrix 7e9e259
Applied Formatting Changes During GitHub Build
37eee14
Fixed formatting on comments and includes
DiegoLHendrix bd88aac
Merge branch 'feature/diegolhendrix/sdo-sample' of https://github.com…
DiegoLHendrix 4bb4a73
Edited SDO class description
DiegoLHendrix 52f8486
Merge branch 'main' into feature/diegolhendrix/sdo-sample
DiegoLHendrix a85b989
Applied Formatting Changes During GitHub Build
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
Some comments aren't visible on the classic Files Changed page.
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
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 |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| add_subdirectory(canopen_rpdo) | ||
| add_subdirectory(canopen_sample) | ||
| add_subdirectory(canopen_sdo) | ||
| add_subdirectory(canopen_tpdo) |
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,4 @@ | ||
| include(../../../cmake/evt-core_build.cmake) | ||
|
|
||
| set( SAMPLE_SOURCES main.cpp SDOCanNode.cpp) | ||
| make_exe(canopen_sdo "${SAMPLE_SOURCES}") |
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,58 @@ | ||
| #include "SDOCanNode.hpp" | ||
| #include <core/utils/log.hpp> | ||
| #include <cstdio> | ||
|
DiegoLHendrix marked this conversation as resolved.
|
||
|
|
||
| namespace log = core::log; | ||
|
|
||
| SDOCanNode::SDOCanNode(CO_NODE& canNode) : node(canNode), transferBuff(0) {} | ||
|
|
||
| void SDOCanNode::transferData(io::csdo_callback_t callback, void* context) { | ||
| // Get the value to be transferred | ||
| transferBuff = static_cast<uint8_t*>(context); | ||
|
|
||
| /* | ||
| * Initiates an SDO transfer for the specified node using the provided | ||
| * transfer buffer array. Targets the object dictionary entry at index 0x2100, | ||
| * sub-index 0x02. Registers and executes the SDOTransferCallback function upon completion. | ||
|
DiegoLHendrix marked this conversation as resolved.
|
||
| */ | ||
| CO_ERR err = io::SDOTransfer(node, transferBuff, 2, CO_DEV(0x2100, 0x02), callback, transferBuff); | ||
|
|
||
| /* Check if the SDO transfer was successfully started. */ | ||
| if (err == CO_ERR_NONE) { | ||
| /* Transfer is started successfully */ | ||
| log::LOGGER.log(log::Logger::LogLevel::INFO, "SDOTransfer Sent Request"); | ||
| } else { | ||
| /* Unable to start the SDO transfer */ | ||
| log::LOGGER.log(log::Logger::LogLevel::ERROR, "SDOTransfer Request Error"); | ||
| } | ||
| } | ||
|
|
||
| void SDOCanNode::receiveData(io::csdo_callback_t callback, void* context) { | ||
| /* | ||
| * Initiates an SDO receive operation for the specified node, reading data into | ||
| * the provided receive buffer array. Targets the object dictionary entry at | ||
| * index 0x2100, sub-index 0x01. Registers and executes the SDOReceiveCallback function upon completion. | ||
| */ | ||
| CO_ERR err = io::SDOReceive(node, (uint8_t*) context, 1, CO_DEV(0x2100, 0x01), callback, context); | ||
|
|
||
| /* Check if the SDO receive operation was successfully started. */ | ||
| if (err == CO_ERR_NONE) { | ||
| /* Receive is started successfully */ | ||
| log::LOGGER.log(log::Logger::LogLevel::INFO, "SDOReceive Sent Request"); | ||
| } else { | ||
| /* Unable to start the SDO transfer */ | ||
| log::LOGGER.log(log::Logger::LogLevel::ERROR, "SDOReceive Request Error"); | ||
| } | ||
| } | ||
|
|
||
| CO_OBJ_T* SDOCanNode::getObjectDictionary() { | ||
| return &objectDictionary[0]; | ||
| } | ||
|
|
||
| uint8_t SDOCanNode::getNumElements() { | ||
| return OBJECT_DICTIONARY_SIZE; | ||
| } | ||
|
|
||
| uint8_t SDOCanNode::getNodeID() { | ||
| return NODE_ID; | ||
| } | ||
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,92 @@ | ||
| #include <co_core.h> | ||
| #include <core/io/CANDevice.hpp> | ||
| #include <core/io/CANOpenMacros.hpp> | ||
| #include <core/io/CANopen.hpp> | ||
|
|
||
| namespace io = core::io; | ||
|
|
||
| /** | ||
| * Representation of the CAN node. Handles constructing the object | ||
|
DiegoLHendrix marked this conversation as resolved.
|
||
| * dictionary and other baseline settings. The idea is that each "board" | ||
| * will have a specific object dictionary associated with it. The object | ||
| * dictionary itself will also need to have information on "data of interest". | ||
| * For example, a temperature management system may to expose water pump | ||
| * flow rate in the object dictionary. | ||
| */ | ||
| class SDOCanNode : public CANDevice { | ||
|
DiegoLHendrix marked this conversation as resolved.
|
||
| public: | ||
| SDOCanNode(CO_NODE& canNode); | ||
|
|
||
| /** | ||
| * Update Object Dictionary entry | ||
| * | ||
| * @param callback[in] Callback function for the transfer operation | ||
| * @param context[in] Context for the callback function | ||
| */ | ||
| void transferData(io::csdo_callback_t callback, void* context); | ||
|
|
||
| /** | ||
| * Read Object Dictionary entry | ||
| * | ||
| * @param callback[in] Callback function for the receive operation | ||
| * @param context[in] Context for the callback function | ||
| */ | ||
| void receiveData(io::csdo_callback_t callback, void* context); | ||
|
|
||
| /** | ||
| * Get a pointer to the start of the object dictionary | ||
| * | ||
| * @return Pointer to the start of the object dictionary | ||
| */ | ||
| CO_OBJ_T* getObjectDictionary() override; | ||
|
|
||
| /** | ||
| * Get the number of elements in the object dictionary. | ||
| * | ||
| * @return The number of elements in the object dictionary | ||
| */ | ||
| uint8_t getNumElements() override; | ||
|
|
||
| /** | ||
| * Get the device's node ID | ||
| * | ||
| * @return The node ID of the can device. | ||
| */ | ||
| uint8_t getNodeID() override; | ||
|
|
||
| /** | ||
| * Get the device's node ID | ||
| * | ||
| * @return The node ID of the can device. | ||
| */ | ||
| static constexpr uint8_t NODE_ID = 2; | ||
|
|
||
| private: | ||
| /** Holds the data to be transferred */ | ||
| uint8_t* transferBuff; | ||
|
|
||
| CO_NODE& node; | ||
|
|
||
| /** | ||
| * Have to know the size of the object dictionary for initialization | ||
| * process. | ||
| */ | ||
| static constexpr uint8_t OBJECT_DICTIONARY_SIZE = 24; | ||
|
|
||
| /** | ||
| * The object dictionary itself. Will be populated by this object during | ||
| * construction. | ||
| * | ||
| * The plus one is for the special "end of dictionary" marker. | ||
| */ | ||
| CO_OBJ_T objectDictionary[OBJECT_DICTIONARY_SIZE + 1] = { | ||
| MANDATORY_IDENTIFICATION_ENTRIES_1000_1014, | ||
| HEARTBEAT_PRODUCER_1017(2000), | ||
| IDENTITY_OBJECT_1018, | ||
| SDO_CONFIGURATION_1200, | ||
| SDO_CONFIGURATION_1280(1), | ||
|
|
||
| // End of dictionary marker | ||
| CO_OBJ_DICT_ENDMARK, | ||
| }; | ||
| }; | ||
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.