Skip to content

Commit

Permalink
tests: drivers: test fake-pwm on native_sim for pwm_api test
Browse files Browse the repository at this point in the history
create native_sim overlay to use fake pwm for test of pwm_api

Signed-off-by: Nathan Olff <[email protected]>
  • Loading branch information
nono313 authored and kartben committed Dec 14, 2024
1 parent c152453 commit 85e8303
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/drivers/pwm/pwm_api/boards/native_sim.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2024 Kickmaker
*
* SPDX-License-Identifier: Apache-2.0
*/

/{
pwm0: pwm0 {
compatible = "zephyr,fake-pwm";
status = "okay";
#pwm-cells = <2>;
frequency = <10000000>;
};

aliases {
pwm-0 = &pwm0;
};
};
5 changes: 5 additions & 0 deletions tests/drivers/pwm/pwm_api/src/test_pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
#define DEFAULT_PULSE_NSEC 1000000
#endif

#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_fake_pwm)
#include <zephyr/fff.h>
DEFINE_FFF_GLOBALS;
#endif

#if defined CONFIG_BOARD_SAM_E70_XPLAINED
#define DEFAULT_PWM_PORT 2 /* PWM on EXT2 connector, pin 8 */
#elif defined CONFIG_PWM_NRFX
Expand Down
5 changes: 5 additions & 0 deletions tests/drivers/pwm/pwm_api/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ tests:
platform_allow:
- frdm_mcxn947/mcxn947/cpu0
- frdm_mcxn947/mcxn947/cpu0/qspi
drivers.pwm.native_sim:
platform_allow:
- native_sim
integration_platforms:
- native_sim

0 comments on commit 85e8303

Please sign in to comment.