PwmState Struct

Header: #include <applibs/pwm.h>

The state of a PWM channel.

typedef struct PwmState {
    unsigned int period_nsec;
    unsigned int dutyCycle_nsec;
    PwmPolarity polarity;
    bool enabled;
} PwmState;

Members

period_nsec

The length of each period, in nanoseconds. This includes the total length of both the high and low states.

dutyCycle_nsec

The number of nanoseconds to spend in either a high or low state during a period. This value must be less than the period.

polarity

The PWM polarity to apply. This specifies whether the dutyCycle_nsec parameter applies to a high or a low state.

enabled

True to enable the PWM functionality, false to disable it.

Remarks

This struct is used by the PWM_Apply function.

Minimum and maximum limits for period and duty cycle are device dependent. Consult your specific device’s data sheet for details.