2222
2323static struct gpio_callback gpio_cb ;
2424
25- #define PWM_COUNT DT_PROP_LEN(DT_PATH(zephyr_user), pwms)
26- #define PWM_CONFIG_ENTRY (idx , node_id ) PWM_DT_SPEC_GET_BY_IDX(node_id, idx)
27- #define PWM_CONFIG_ARRAY (node_id ) \
25+ #define TEST_PWM_COUNT DT_PROP_LEN(DT_PATH(zephyr_user), pwms)
26+ #define TEST_PWM_CONFIG_ENTRY (idx , node_id ) PWM_DT_SPEC_GET_BY_IDX(node_id, idx)
27+ #define TEST_PWM_CONFIG_ARRAY (node_id ) \
2828 { \
29- LISTIFY(PWM_COUNT, PWM_CONFIG_ENTRY , (,), node_id) \
29+ LISTIFY(TEST_PWM_COUNT, TEST_PWM_CONFIG_ENTRY , (,), node_id) \
3030 }
3131
32- #define GPIO_COUNT DT_PROP_LEN(DT_PATH(zephyr_user), gpios)
33- #define GPIO_CONFIG_ENTRY (idx , node_id ) GPIO_DT_SPEC_GET_BY_IDX(node_id, gpios, idx)
34- #define GPIO_CONFIG_ARRAY (node_id ) \
32+ #define TEST_GPIO_COUNT DT_PROP_LEN(DT_PATH(zephyr_user), gpios)
33+ #define TEST_GPIO_CONFIG_ENTRY (idx , node_id ) GPIO_DT_SPEC_GET_BY_IDX(node_id, gpios, idx)
34+ #define TEST_GPIO_CONFIG_ARRAY (node_id ) \
3535 { \
36- LISTIFY(GPIO_COUNT, GPIO_CONFIG_ENTRY , (,), node_id) \
36+ LISTIFY(TEST_GPIO_COUNT, TEST_GPIO_CONFIG_ENTRY , (,), node_id) \
3737 }
3838
39- static const struct pwm_dt_spec pwms_dt [] = PWM_CONFIG_ARRAY (DT_PATH (zephyr_user ));
40- static const struct gpio_dt_spec gpios_dt [] = GPIO_CONFIG_ARRAY (DT_PATH (zephyr_user ));
39+ static const struct pwm_dt_spec pwms_dt [] = TEST_PWM_CONFIG_ARRAY (DT_PATH (zephyr_user ));
40+ static const struct gpio_dt_spec gpios_dt [] = TEST_GPIO_CONFIG_ARRAY (DT_PATH (zephyr_user ));
4141
4242static struct test_context {
4343 uint32_t last_edge_time ;
@@ -218,7 +218,7 @@ static void test_run(const struct pwm_dt_spec *pwm_dt, const struct gpio_dt_spec
218218
219219ZTEST (pwm_gpio_loopback , test_pwm )
220220{
221- for (int i = 0 ; i < PWM_COUNT ; i ++ ) {
221+ for (int i = 0 ; i < TEST_PWM_COUNT ; i ++ ) {
222222 zassert_true (device_is_ready (pwms_dt [i ].dev ), "PWM device is not ready" );
223223 zassert_true (device_is_ready (gpios_dt [i ].port ), "GPIO device is not ready" );
224224
@@ -238,15 +238,15 @@ ZTEST(pwm_gpio_loopback, test_pwm)
238238
239239ZTEST (pwm_gpio_loopback , test_pwm_cross )
240240{
241- for (int i = 0 ; i < PWM_COUNT ; i ++ ) {
241+ for (int i = 0 ; i < TEST_PWM_COUNT ; i ++ ) {
242242 /* Test case: [Duty: 40%] */
243243 test_run (& pwms_dt [i ], & gpios_dt [i ], 40 , true);
244244 }
245245
246246 /* Set all channels and check if they retain the original
247247 * configuration without calling pwm_set again
248248 */
249- for (int i = 0 ; i < PWM_COUNT ; i ++ ) {
249+ for (int i = 0 ; i < TEST_PWM_COUNT ; i ++ ) {
250250 test_run (& pwms_dt [i ], & gpios_dt [i ], 40 , false);
251251 }
252252}
0 commit comments