Skip to content

Commit 9c5cb93

Browse files
Update device tree overlay and driver enable functions for stepper controller (#3)
1 parent cb61259 commit 9c5cb93

6 files changed

Lines changed: 31 additions & 19 deletions

File tree

.github/workflows/docs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
name: Documentation
55

6-
on: [push, pull_request]
6+
on:
7+
push:
8+
branches:
9+
- main
10+
pull_request:
711

812
permissions:
913
contents: read

app/boards/esp32s3_devkitc_procpu.overlay

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,31 @@
44
*/
55

66
/* Devicetree overlay enabling the Moonlite focuser firmware on ESP32-S3 DevKitC
7-
* (PROCPU). The TMC2209 stepper driver is exposed via the "stepper" and
8-
* "stepper-drv" aliases, while the zephyr,user node supplies the UART phandle
7+
* (PROCPU). The zephyr,gpio-step-dir-controller drives the step/dir pins
8+
* referenced by the "stepper" alias, while the dedicated TMC2209 device is
9+
* referenced by the "stepper-drv" alias so the application can toggle the
10+
* external driver rails. The zephyr,user node supplies the UART phandle
911
* consumed by the application.
1012
*/
1113

1214
/ {
1315
aliases {
1416
stepper = &focuser_stepper;
15-
stepper-drv = &focuser_stepper;
17+
stepper-drv = &focuser_stepper_drv;
1618
};
1719

18-
focuser_stepper: focuser_stepper {
20+
focuser_stepper_drv: focuser_stepper_drv {
1921
compatible = "adi,tmc2209";
22+
en-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
23+
micro-step-res = <1>;
24+
status = "okay";
25+
};
26+
27+
focuser_stepper: focuser_stepper {
28+
compatible = "zephyr,gpio-step-dir-controller";
2029
step-gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
2130
dir-gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
22-
en-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
2331
step-width-ns = <10000>;
24-
micro-step-res = <1>;
2532
status = "okay";
2633
};
2734

app/boards/qemu_cortex_m0.overlay

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33
*
44
* Devicetree overlay enabling the Moonlite focuser firmware on the
55
* qemu_cortex_m0 board. The design uses the generic GPIO H-bridge stepper
6-
* controller so the application can run entirely in the simulator.
6+
* controller for motion ("stepper" alias) plus the Zephyr fake stepper
7+
* driver ("stepper-drv" alias) so the application can exercise the driver
8+
* enable path under simulation.
79
*/
810

911
/ {
1012
aliases {
1113
stepper = &focuser_stepper;
12-
stepper-drv = &focuser_stepper;
14+
stepper-drv = &focuser_stepper_drv;
15+
};
16+
17+
focuser_stepper_drv: focuser_stepper_drv {
18+
compatible = "zephyr,fake-stepper-driver";
19+
status = "okay";
1320
};
1421

1522
focuser_stepper: focuser_stepper {
16-
compatible = "zephyr,h-bridge-stepper";
17-
/* Four phase outputs feeding a simulated H-bridge. */
18-
gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>,
19-
<&gpio0 2 GPIO_ACTIVE_HIGH>,
20-
<&gpio0 3 GPIO_ACTIVE_HIGH>,
21-
<&gpio0 4 GPIO_ACTIVE_HIGH>;
22-
en-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
23-
micro-step-res = <1>;
23+
compatible = "zephyr,fake-stepper-controller";
2424
status = "okay";
2525
};
2626

app/prj.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ CONFIG_LOG_BACKEND_UART=y
2424
# Set the application log level.
2525
CONFIG_APP_LOG_LEVEL_INF=y
2626

27+
CONFIG_COUNTER=y
28+
2729
# Enable Zephyr's generic stepper controller subsystem and the TMC2209 backend.
2830
CONFIG_STEPPER=y
2931
CONFIG_STEPPER_ADI_TMC2209=y

app/sample.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ common:
88
build_only: true
99
integration_platforms:
1010
- esp32s3_devkitc/esp32s3/procpu
11-
- qemu_cortex_m0
1211
tests:
1312
app.default: {}
1413
app.debug:

app/src/ZephyrStepper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,5 @@ int ZephyrFocuserStepper::enable_driver(bool enable)
9393
return 0;
9494
}
9595

96-
return enable ? stepper_enable(m_stepper_drv) : stepper_disable(m_stepper_drv);
96+
return enable ? stepper_drv_enable(m_stepper_drv) : stepper_drv_disable(m_stepper_drv);
9797
}

0 commit comments

Comments
 (0)