Skip to content

Commit 79221db

Browse files
jilaypandyakartben
authored andcommitted
dts: bindings: stepper remove property-allowlist from step-dir drivers
drop property-allowlist and implement invert-direction in step-dir-common Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
1 parent cbced96 commit 79221db

File tree

5 files changed

+4
-20
lines changed

5 files changed

+4
-20
lines changed

drivers/stepper/step_dir/step_dir_stepper_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ static inline int step_dir_stepper_perform_step(const struct device *dev)
1616

1717
switch (data->direction) {
1818
case STEPPER_DIRECTION_POSITIVE:
19-
ret = gpio_pin_set_dt(&config->dir_pin, 1);
19+
ret = gpio_pin_set_dt(&config->dir_pin, 1 ^ config->invert_direction);
2020
break;
2121
case STEPPER_DIRECTION_NEGATIVE:
22-
ret = gpio_pin_set_dt(&config->dir_pin, 0);
22+
ret = gpio_pin_set_dt(&config->dir_pin, 0 ^ config->invert_direction);
2323
break;
2424
default:
2525
LOG_ERR("Unsupported direction: %d", data->direction);

drivers/stepper/step_dir/step_dir_stepper_common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct step_dir_stepper_common_config {
3232
bool dual_edge;
3333
const struct stepper_timing_source_api *timing_source;
3434
const struct device *counter;
35+
bool invert_direction;
3536
};
3637

3738
/**
@@ -47,6 +48,7 @@ struct step_dir_stepper_common_config {
4748
.dir_pin = GPIO_DT_SPEC_GET(node_id, dir_gpios), \
4849
.dual_edge = DT_PROP_OR(node_id, dual_edge_step, false), \
4950
.counter = DEVICE_DT_GET_OR_NULL(DT_PHANDLE(node_id, counter)), \
51+
.invert_direction = DT_PROP(node_id, invert_direction), \
5052
.timing_source = COND_CODE_1(DT_NODE_HAS_PROP(node_id, counter), \
5153
(&step_counter_timing_source_api), \
5254
(&step_work_timing_source_api)), \

dts/bindings/stepper/adi/adi,tmc2209.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ compatible: "adi,tmc2209"
1919

2020
include:
2121
- name: stepper-controller.yaml
22-
property-allowlist:
23-
- micro-step-res
24-
- step-gpios
25-
- dir-gpios
26-
- en-gpios
27-
- counter
2822

2923
properties:
3024
msx-gpios:

dts/bindings/stepper/allegro/allegro,a4979.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ compatible: "allegro,a4979"
2525

2626
include:
2727
- name: stepper-controller.yaml
28-
property-allowlist:
29-
- micro-step-res
30-
- step-gpios
31-
- dir-gpios
32-
- en-gpios
33-
- counter
3428

3529
properties:
3630
m0-gpios:

dts/bindings/stepper/ti/ti,drv8424.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ compatible: "ti,drv8424"
2929

3030
include:
3131
- name: stepper-controller.yaml
32-
property-allowlist:
33-
- micro-step-res
34-
- step-gpios
35-
- dir-gpios
36-
- en-gpios
37-
- counter
3832

3933
properties:
4034
fault-gpios:

0 commit comments

Comments
 (0)