Skip to content

Commit 7c87d89

Browse files
jilaypandyacfriedt
authored andcommitted
drivers: stepper: adi_tmc: refactor common headers
currently adi_tmc5xxx_common.h and adi_tmc_reg.h are placed directly in the adi_tmc folder, however placing them in a common folder and adding to the include directories results in the drivers not having to include these files using relative paths. Signed-off-by: Jilay Pandya <[email protected]>
1 parent 7150693 commit 7c87d89

File tree

7 files changed

+15
-10
lines changed

7 files changed

+15
-10
lines changed

drivers/stepper/adi_tmc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ zephyr_library_sources_ifdef(CONFIG_STEPPER_ADI_TMC50XX tmc50xx.c)
99
add_subdirectory_ifdef(CONFIG_STEPPER_ADI_TMC51XX tmc51xx)
1010

1111
add_subdirectory(bus)
12+
add_subdirectory(common)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 Jilay Sandeep Pandya
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_library_include_directories(include)

drivers/stepper/adi_tmc/adi_tmc5xxx_common.h renamed to drivers/stepper/adi_tmc/common/include/adi_tmc5xxx_common.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
* SPDX-License-Identifier: Apache-2.0
1010
*/
1111

12-
#ifndef ZEPHYR_DRIVERS_STEPPER_ADI_TMC_ADI_TMC5XXX_COMMON_H_
13-
#define ZEPHYR_DRIVERS_STEPPER_ADI_TMC_ADI_TMC5XXX_COMMON_H_
12+
#ifndef ZEPHYR_DRIVERS_STEPPER_ADI_TMC_COMMON_ADI_TMC5XXX_COMMON_H_
13+
#define ZEPHYR_DRIVERS_STEPPER_ADI_TMC_COMMON_ADI_TMC5XXX_COMMON_H_
1414

15-
#include "adi_tmc_reg.h"
15+
#include <adi_tmc_reg.h>
1616

1717
#ifdef __cplusplus
1818
extern "C" {
@@ -48,4 +48,4 @@ static inline uint32_t tmc5xxx_calculate_velocity_from_hz_to_fclk(uint64_t veloc
4848
}
4949
#endif
5050

51-
#endif /* ZEPHYR_DRIVERS_STEPPER_ADI_TMC_ADI_TMC5XXX_COMMON_H_ */
51+
#endif /* ZEPHYR_DRIVERS_STEPPER_ADI_TMC_COMMON_ADI_TMC5XXX_COMMON_H_ */

drivers/stepper/adi_tmc/adi_tmc_reg.h renamed to drivers/stepper/adi_tmc/common/include/adi_tmc_reg.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
* SPDX-License-Identifier: Apache-2.0
1212
*/
1313

14-
#ifndef ZEPHYR_DRIVERS_STEPPER_ADI_TMC_REG_H_
15-
#define ZEPHYR_DRIVERS_STEPPER_ADI_TMC_REG_H_
14+
#ifndef ZEPHYR_DRIVERS_STEPPER_ADI_TMC_COMMON_ADI_TMC_REG_H_
15+
#define ZEPHYR_DRIVERS_STEPPER_ADI_TMC_COMMON_ADI_TMC_REG_H_
1616

1717
#ifdef __cplusplus
1818
extern "C" {
@@ -192,4 +192,4 @@ extern "C" {
192192
}
193193
#endif
194194

195-
#endif /* ZEPHYR_DRIVERS_STEPPER_ADI_TMC_REG_H_ */
195+
#endif /* ZEPHYR_DRIVERS_STEPPER_ADI_TMC_COMMON_ADI_TMC_REG_H_ */

drivers/stepper/adi_tmc/tmc50xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <zephyr/drivers/stepper/stepper_trinamic.h>
1313

1414
#include <adi_tmc_spi.h>
15-
#include "adi_tmc5xxx_common.h"
15+
#include <adi_tmc5xxx_common.h>
1616

1717
#include <zephyr/logging/log.h>
1818
LOG_MODULE_REGISTER(tmc50xx, CONFIG_STEPPER_LOG_LEVEL);

drivers/stepper/adi_tmc/tmc51xx/tmc51xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#include <zephyr/drivers/stepper.h>
1010

1111
#include <adi_tmc_bus.h>
12+
#include <adi_tmc5xxx_common.h>
1213
#include "tmc51xx.h"
13-
#include "../adi_tmc5xxx_common.h"
1414

1515
#include <zephyr/logging/log.h>
1616
LOG_MODULE_REGISTER(tmc51xx, CONFIG_STEPPER_LOG_LEVEL);

drivers/stepper/adi_tmc/tmc51xx/tmc51xx_spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
#include <adi_tmc_bus.h>
1010
#include <adi_tmc_spi.h>
11+
#include <adi_tmc_reg.h>
1112

1213
#include "tmc51xx.h"
13-
#include "../adi_tmc_reg.h"
1414

1515
#if TMC51XX_BUS_SPI
1616
LOG_MODULE_DECLARE(tmc51xx, CONFIG_STEPPER_LOG_LEVEL);

0 commit comments

Comments
 (0)