Skip to content

Commit 85e8303

Browse files
nono313kartben
authored andcommitted
tests: drivers: test fake-pwm on native_sim for pwm_api test
create native_sim overlay to use fake pwm for test of pwm_api Signed-off-by: Nathan Olff <[email protected]>
1 parent c152453 commit 85e8303

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2024 Kickmaker
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/{
8+
pwm0: pwm0 {
9+
compatible = "zephyr,fake-pwm";
10+
status = "okay";
11+
#pwm-cells = <2>;
12+
frequency = <10000000>;
13+
};
14+
15+
aliases {
16+
pwm-0 = &pwm0;
17+
};
18+
};

tests/drivers/pwm/pwm_api/src/test_pwm.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@
7979
#define DEFAULT_PULSE_NSEC 1000000
8080
#endif
8181

82+
#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_fake_pwm)
83+
#include <zephyr/fff.h>
84+
DEFINE_FFF_GLOBALS;
85+
#endif
86+
8287
#if defined CONFIG_BOARD_SAM_E70_XPLAINED
8388
#define DEFAULT_PWM_PORT 2 /* PWM on EXT2 connector, pin 8 */
8489
#elif defined CONFIG_PWM_NRFX

tests/drivers/pwm/pwm_api/testcase.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,8 @@ tests:
3030
platform_allow:
3131
- frdm_mcxn947/mcxn947/cpu0
3232
- frdm_mcxn947/mcxn947/cpu0/qspi
33+
drivers.pwm.native_sim:
34+
platform_allow:
35+
- native_sim
36+
integration_platforms:
37+
- native_sim

0 commit comments

Comments
 (0)