-
Notifications
You must be signed in to change notification settings - Fork 7.3k
drivers: stepper: unify msx-gpios #88798
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
Open
jilaypandya
wants to merge
1
commit into
zephyrproject-rtos:main
Choose a base branch
from
jilaypandya:fix/msx-gpios
base: main
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.
+87
−88
Open
Changes from all commits
Commits
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
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 |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
struct step_dir_stepper_common_config { | ||
const struct gpio_dt_spec step_pin; | ||
const struct gpio_dt_spec dir_pin; | ||
const struct gpio_dt_spec *msx_pins; | ||
bool dual_edge; | ||
const struct stepper_timing_source_api *timing_source; | ||
const struct device *counter; | ||
|
@@ -42,24 +43,25 @@ | |
* | ||
* @param node_id The devicetree node identifier. | ||
*/ | ||
#define STEP_DIR_STEPPER_DT_COMMON_CONFIG_INIT(node_id) \ | ||
{ \ | ||
#define STEP_DIR_STEPPER_DT_COMMON_CONFIG_INIT(node_id, msx_gpio_array) \ | ||
{ \ | ||
IF_ENABLED( DT_NODE_HAS_PROP(node_id, msx_gpios), (.msx_pins = msx_gpio_array,)) \ | ||
.step_pin = GPIO_DT_SPEC_GET(node_id, step_gpios), \ | ||
.dir_pin = GPIO_DT_SPEC_GET(node_id, dir_gpios), \ | ||
.dual_edge = DT_PROP_OR(node_id, dual_edge_step, false), \ | ||
.counter = DEVICE_DT_GET_OR_NULL(DT_PHANDLE(node_id, counter)), \ | ||
.invert_direction = DT_PROP(node_id, invert_direction), \ | ||
.timing_source = COND_CODE_1(DT_NODE_HAS_PROP(node_id, counter), \ | ||
(&step_counter_timing_source_api), \ | ||
(&step_work_timing_source_api)), \ | ||
(&step_work_timing_source_api)), \ | ||
} | ||
|
||
/** | ||
* @brief Initialize common step direction stepper config from devicetree instance. | ||
* @param inst Instance. | ||
*/ | ||
#define STEP_DIR_STEPPER_DT_INST_COMMON_CONFIG_INIT(inst) \ | ||
STEP_DIR_STEPPER_DT_COMMON_CONFIG_INIT(DT_DRV_INST(inst)) | ||
#define STEP_DIR_STEPPER_DT_INST_COMMON_CONFIG_INIT(inst, msx_gpio_array) \ | ||
STEP_DIR_STEPPER_DT_COMMON_CONFIG_INIT(DT_DRV_INST(inst), msx_gpio_array) | ||
|
||
/** | ||
* @brief Common step direction stepper data. | ||
|
@@ -150,7 +152,7 @@ | |
* @return 0 on success, or a negative error code on failure. | ||
*/ | ||
int step_dir_stepper_common_set_microstep_interval(const struct device *dev, | ||
const uint64_t microstep_interval_ns); | ||
const uint64_t microstep_interval_ns); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated formatting :^) |
||
|
||
/** | ||
* @brief Set the reference position of the stepper motor. | ||
|
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
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
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.
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.
Why not read the property in here? Currently there is again potential for giving the property different names since the driver does the property checking.
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.
the *msx-pins cannot be scalar initialized here, or? The pointer has to be initialized to an already existing array.