Zephyr API Documentation  3.4.0
A Scalable Open Source RTOS
3.4.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
pwm.h File Reference

Go to the source code of this file.

Macros

PWM period set helpers

The period cell in the PWM specifier needs to be provided in nanoseconds. However, in some applications it is more convenient to use another scale.

#define PWM_NSEC(x)   (x)
 
#define PWM_USEC(x)   (PWM_NSEC(x) * 1000UL)
 
#define PWM_MSEC(x)   (PWM_USEC(x) * 1000UL)
 
#define PWM_SEC(x)   (PWM_MSEC(x) * 1000UL)
 
#define PWM_HZ(x)   (PWM_SEC(1UL) / (x))
 
#define PWM_KHZ(x)   (PWM_HZ((x) * 1000UL))
 
PWM polarity flags

The PWM_POLARITY_* flags are used with pwm_set_cycles(), pwm_set() or pwm_configure_capture() to specify the polarity of a PWM channel.

The flags are on the lower 8bits of the pwm_flags_t

#define PWM_POLARITY_NORMAL   (0 << 0)
 
#define PWM_POLARITY_INVERTED   (1 << 0)