test: Remove usec test for pwm_api

As the pwm interface only takes nanosecond for parameter,
the original test case for mircosecond is not needed.
Check github issue 44887 for more info.

Signed-off-by: Hu Zhenyu <zhenyu.hu@intel.com>
This commit is contained in:
Hu Zhenyu 2022-05-08 14:03:47 +08:00 committed by Maureen Helm
commit 7d20857e4f
2 changed files with 3 additions and 28 deletions

View file

@ -10,7 +10,6 @@
#include <zephyr/device.h> #include <zephyr/device.h>
const struct device *get_pwm_device(void); const struct device *get_pwm_device(void);
void test_pwm_usec(void);
void test_pwm_cycle(void); void test_pwm_cycle(void);
void test_pwm_nsec(void); void test_pwm_nsec(void);
@ -22,7 +21,6 @@ void test_main(void)
k_object_access_grant(dev, k_current_get()); k_object_access_grant(dev, k_current_get());
ztest_test_suite(pwm_basic_test, ztest_test_suite(pwm_basic_test,
ztest_user_unit_test(test_pwm_usec),
ztest_user_unit_test(test_pwm_nsec), ztest_user_unit_test(test_pwm_nsec),
ztest_user_unit_test(test_pwm_cycle)); ztest_user_unit_test(test_pwm_cycle));
ztest_run_test_suite(pwm_basic_test); ztest_run_test_suite(pwm_basic_test);

View file

@ -6,8 +6,8 @@
/** /**
* @file * @file
* @brief Verify PWM can work well when configure through usec, * @brief Verify PWM can work well when configure through nsec,
* nsec, or cycle. * or cycle.
* *
* @details * @details
* - Test Steps * - Test Steps
@ -55,15 +55,11 @@
defined(CONFIG_SOC_MKW41Z4) defined(CONFIG_SOC_MKW41Z4)
#define DEFAULT_PERIOD_CYCLE 1024 #define DEFAULT_PERIOD_CYCLE 1024
#define DEFAULT_PULSE_CYCLE 512 #define DEFAULT_PULSE_CYCLE 512
#define DEFAULT_PERIOD_USEC 2000
#define DEFAULT_PULSE_USEC 500
#define DEFAULT_PERIOD_NSEC 2000000 #define DEFAULT_PERIOD_NSEC 2000000
#define DEFAULT_PULSE_NSEC 500000 #define DEFAULT_PULSE_NSEC 500000
#else #else
#define DEFAULT_PERIOD_CYCLE 64000 #define DEFAULT_PERIOD_CYCLE 64000
#define DEFAULT_PULSE_CYCLE 32000 #define DEFAULT_PULSE_CYCLE 32000
#define DEFAULT_PERIOD_USEC 2000
#define DEFAULT_PULSE_USEC 1000
#define DEFAULT_PERIOD_NSEC 2000000 #define DEFAULT_PERIOD_NSEC 2000000
#define DEFAULT_PULSE_NSEC 1000000 #define DEFAULT_PULSE_NSEC 1000000
#endif #endif
@ -94,8 +90,7 @@
#endif #endif
#define UNIT_CYCLES 0 #define UNIT_CYCLES 0
#define UNIT_USECS 1 #define UNIT_NSECS 1
#define UNIT_NSECS 2
const struct device *get_pwm_device(void) const struct device *get_pwm_device(void)
{ {
@ -131,24 +126,6 @@ static int test_task(uint32_t port, uint32_t period, uint32_t pulse, uint8_t uni
return TC_PASS; return TC_PASS;
} }
void test_pwm_usec(void)
{
/* Period : Pulse (2000 : 1000), unit (usec). Voltage : 1.65V */
zassert_true(test_task(DEFAULT_PWM_PORT, DEFAULT_PERIOD_USEC,
DEFAULT_PULSE_USEC, UNIT_USECS) == TC_PASS, NULL);
k_sleep(K_MSEC(1000));
/* Period : Pulse (2000 : 2000), unit (usec). Voltage : 3.3V */
zassert_true(test_task(DEFAULT_PWM_PORT, DEFAULT_PERIOD_USEC,
DEFAULT_PERIOD_USEC, UNIT_USECS) == TC_PASS, NULL);
k_sleep(K_MSEC(1000));
/* Period : Pulse (2000 : 0), unit (usec). Voltage : 0V */
zassert_true(test_task(DEFAULT_PWM_PORT, DEFAULT_PERIOD_USEC,
0, UNIT_USECS) == TC_PASS, NULL);
k_sleep(K_MSEC(1000));
}
void test_pwm_nsec(void) void test_pwm_nsec(void)
{ {
/* Period : Pulse (2000000 : 1000000), unit (nsec). Voltage : 1.65V */ /* Period : Pulse (2000000 : 1000000), unit (nsec). Voltage : 1.65V */