Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Fake PWM driver. More...

Files

file  pwm_fake.h
 Fake PWM driver API functions.

Functions

 DECLARE_FAKE_VALUE_FUNC (int, fake_pwm_set_cycles, const struct device *, uint32_t, uint32_t, uint32_t, pwm_flags_t)
 @fake_of{pwm_driver_api::set_cycles}

Detailed Description

Fake PWM driver.

@driver_fake{pwm_interface,CONFIG_PWM_FAKE,zephyr\,fake-pwm}

const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(fake_pwm));
zassert_ok(pwm_set_cycles(dev, 0, 1000, 500, 0));
zassert_equal(1, fake_pwm_set_cycles_fake.call_count);
zassert_equal(1000, fake_pwm_set_cycles_fake.arg2_val);
zassert_equal(500, fake_pwm_set_cycles_fake.arg3_val);
#define DEVICE_DT_GET(node_id)
Get a device reference from a devicetree node identifier.
Definition device.h:317
#define DT_NODELABEL(label)
Get a node identifier for a node label.
Definition devicetree.h:197
int pwm_set_cycles(const struct device *dev, uint32_t channel, uint32_t period, uint32_t pulse, pwm_flags_t flags)
Set the period and pulse width for a single PWM output.
#define zassert_equal(a, b,...)
Assert that a equals b.
Definition ztest_assert.h:321
#define zassert_ok(cond,...)
Assert that cond is 0 (success).
Definition ztest_assert.h:289
Runtime device structure (in ROM) per driver instance.
Definition device.h:525

Function Documentation

◆ DECLARE_FAKE_VALUE_FUNC()

DECLARE_FAKE_VALUE_FUNC ( int ,
fake_pwm_set_cycles ,
const struct device * ,
uint32_t ,
uint32_t ,
uint32_t ,
pwm_flags_t  )

#include <pwm_fake.h>

@fake_of{pwm_driver_api::set_cycles}