Skip to content
Commit 7d43c68b authored by Gerard Marull-Paretas's avatar Gerard Marull-Paretas Committed by Carles Cufí
Browse files

drivers: pwm: add pwm_dt_spec and associated helpers



Similar to other APIs, this patch introduces the pwm_dt_spec structure
and associated helpers, e.g. PWM_DT_SPEC_GET() or pwm_set_cycles_dt().

The pwm_dt_spec reduces the boilerplate code needed when using
Devicetree. For example, if we have:

led: led {
    ...
    pwms = <&pwm0 1 PWM_POLARITY_NORMAL>;
    ...
};

One can do now in the application:

struct pwm_dt_spec led = PWM_DT_SPEC_GET(DT_NODELABEL(led));

pwm_set_usec_dt(&led, LED_PERIOD_USEC, LED_PULSE_USEC);

Signed-off-by: default avatarGerard Marull-Paretas <gerard.marull@nordicsemi.no>
parent 10ee44c9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment