-
Notifications
You must be signed in to change notification settings - Fork 12
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
Adding EL6001 fastcat device library #90
Draft
davidinkyu-kim
wants to merge
8
commits into
master
Choose a base branch
from
davkim-add-el6001
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+274
−1
Draft
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9b48f8c
Added el6001 device skeleton
davidinkyu-kim 8ad125d
Added write for el6001, and offline codes
davidinkyu-kim 416a85a
Added baud rate config loading
davidinkyu-kim cb3ebf8
Added offline, device process
davidinkyu-kim 610ec78
Merge branch 'master' into davkim-add-el6001
davidinkyu-kim 440dc51
Merged recent master to be up-to-date
davidinkyu-kim ff69b5e
Populating more data in Read
davidinkyu-kim 10b0d03
Merge branch 'master' into davkim-add-el6001
davidinkyu-kim 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 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 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 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 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,53 @@ | ||
// Include related header (for cc files) | ||
#include "fastcat/jsd/el6001.h" | ||
|
||
// Include c then c++ libraries | ||
#include <string.h> | ||
|
||
#include <cmath> | ||
#include <iostream> | ||
|
||
// Include external then project includes | ||
#include "fastcat/yaml_parser.h" | ||
|
||
fastcat::El6001::El6001() | ||
{ | ||
MSG_DEBUG("Constructed El6001"); | ||
|
||
state_ = std::make_shared<DeviceState>(); | ||
state_->type = EL6001_STATE; | ||
} | ||
|
||
bool fastcat::El6001::ConfigFromYaml(YAML::Node node) | ||
{ | ||
bool retval = ConfigFromYamlCommon(node); | ||
jsd_set_slave_config((jsd_t*)context_, slave_id_, jsd_slave_config_); | ||
return retval; | ||
} | ||
|
||
bool fastcat::El6001::ConfigFromYamlCommon(YAML::Node node) | ||
{ | ||
if (!ParseVal(node, "name", name_)) { | ||
return false; | ||
} | ||
state_->name = name_; | ||
|
||
jsd_slave_config_.configuration_active = true; | ||
jsd_slave_config_.product_code = JSD_EL6001_PRODUCT_CODE; | ||
snprintf(jsd_slave_config_.name, JSD_NAME_LEN, "%s", name_.c_str()); | ||
|
||
return true; | ||
} | ||
|
||
bool fastcat::El6001::Read() | ||
{ | ||
jsd_el6001_read((jsd_t*)context_, slave_id_); | ||
|
||
const jsd_el6001_state_t* jsd_state = | ||
jsd_el6001_get_state((jsd_t*)context_, slave_id_); | ||
|
||
state_->el6001_state.statusword = jsd_state->statusword; | ||
state_->el6001_state.controlword = jsd_state->controlword_user; | ||
|
||
return true; | ||
} |
This file contains 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,34 @@ | ||
#ifndef FASTCAT_EL6001_H_ | ||
#define FASTCAT_EL6001_H_ | ||
|
||
// Include related header (for cc files) | ||
|
||
// Include c then c++ libraries | ||
|
||
// Include external then project includes | ||
#include "fastcat/jsd/jsd_device_base.h" | ||
#include "jsd/jsd_el6001_pub.h" | ||
|
||
namespace fastcat | ||
{ | ||
class El6001 : public JsdDeviceBase | ||
{ | ||
public: | ||
El6001(); | ||
bool ConfigFromYaml(YAML::Node node) override; | ||
bool Read() override; | ||
bool Write(DeviceCmd& cmd) override; | ||
// FaultType Process() override; | ||
// void Fault() override; | ||
// void Reset() override; | ||
|
||
protected: | ||
bool ConfigFromYamlCommon(YAML::Node node); | ||
|
||
private: | ||
jsd_slave_config_t jsd_slave_config_{0}; | ||
}; | ||
|
||
} // namespace fastcat | ||
|
||
#endif |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be addressed before we can conclude this merge.