| 
    Zephyr Project API
    3.3.0
    
   A Scalable Open Source RTOS 
   | 
 
Public PWM Driver APIs. More...
#include <errno.h>#include <stdint.h>#include <zephyr/device.h>#include <zephyr/devicetree.h>#include <zephyr/sys_clock.h>#include <zephyr/sys/math_extras.h>#include <zephyr/toolchain.h>#include <zephyr/dt-bindings/pwm/pwm.h>#include <syscalls/pwm.h>Go to the source code of this file.
Data Structures | |
| struct | pwm_dt_spec | 
| Container for PWM information specified in devicetree.  More... | |
Macros | |
| #define | PWM_DT_SPEC_GET_BY_NAME(node_id, name) | 
| Static initializer for a struct pwm_dt_spec.  More... | |
| #define | PWM_DT_SPEC_INST_GET_BY_NAME(inst, name) PWM_DT_SPEC_GET_BY_NAME(DT_DRV_INST(inst), name) | 
| Static initializer for a struct pwm_dt_spec from a DT_DRV_COMPAT instance.  More... | |
| #define | PWM_DT_SPEC_GET_BY_NAME_OR(node_id, name, default_value) | 
| Like PWM_DT_SPEC_GET_BY_NAME(), with a fallback to a default value.  More... | |
| #define | PWM_DT_SPEC_INST_GET_BY_NAME_OR(inst, name, default_value) PWM_DT_SPEC_GET_BY_NAME_OR(DT_DRV_INST(inst), name, default_value) | 
| Like PWM_DT_SPEC_INST_GET_BY_NAME(), with a fallback to a default value.  More... | |
| #define | PWM_DT_SPEC_GET_BY_IDX(node_id, idx) | 
| Static initializer for a struct pwm_dt_spec.  More... | |
| #define | PWM_DT_SPEC_INST_GET_BY_IDX(inst, idx) PWM_DT_SPEC_GET_BY_IDX(DT_DRV_INST(inst), idx) | 
| Static initializer for a struct pwm_dt_spec from a DT_DRV_COMPAT instance.  More... | |
| #define | PWM_DT_SPEC_GET_BY_IDX_OR(node_id, idx, default_value) | 
| Like PWM_DT_SPEC_GET_BY_IDX(), with a fallback to a default value.  More... | |
| #define | PWM_DT_SPEC_INST_GET_BY_IDX_OR(inst, idx, default_value) PWM_DT_SPEC_GET_BY_IDX_OR(DT_DRV_INST(inst), idx, default_value) | 
| Like PWM_DT_SPEC_INST_GET_BY_IDX(), with a fallback to a default value.  More... | |
| #define | PWM_DT_SPEC_GET(node_id) PWM_DT_SPEC_GET_BY_IDX(node_id, 0) | 
Equivalent to PWM_DT_SPEC_GET_BY_IDX(node_id, 0).  More... | |
| #define | PWM_DT_SPEC_INST_GET(inst) PWM_DT_SPEC_GET(DT_DRV_INST(inst)) | 
Equivalent to PWM_DT_SPEC_INST_GET_BY_IDX(inst, 0).  More... | |
| #define | PWM_DT_SPEC_GET_OR(node_id, default_value) PWM_DT_SPEC_GET_BY_IDX_OR(node_id, 0, default_value) | 
Equivalent to PWM_DT_SPEC_GET_BY_IDX_OR(node_id, 0, default_value).  More... | |
| #define | PWM_DT_SPEC_INST_GET_OR(inst, default_value) PWM_DT_SPEC_GET_OR(DT_DRV_INST(inst), default_value) | 
Equivalent to PWM_DT_SPEC_INST_GET_BY_IDX_OR(inst, 0, default_value).  More... | |
PWM capture configuration flags  | |
| #define | PWM_CAPTURE_TYPE_PERIOD (1U << PWM_CAPTURE_TYPE_SHIFT) | 
| #define | PWM_CAPTURE_TYPE_PULSE (2U << PWM_CAPTURE_TYPE_SHIFT) | 
| #define | PWM_CAPTURE_TYPE_BOTH | 
| #define | PWM_CAPTURE_MODE_SINGLE (0U << PWM_CAPTURE_MODE_SHIFT) | 
| #define | PWM_CAPTURE_MODE_CONTINUOUS (1U << PWM_CAPTURE_MODE_SHIFT) | 
Typedefs | |
| typedef uint16_t | pwm_flags_t | 
| Provides a type to hold PWM configuration flags.  More... | |
| typedef void(* | pwm_capture_callback_handler_t) (const struct device *dev, uint32_t channel, uint32_t period_cycles, uint32_t pulse_cycles, int status, void *user_data) | 
| PWM capture callback handler function signature.  More... | |
Functions | |
| 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.  More... | |
| int | pwm_get_cycles_per_sec (const struct device *dev, uint32_t channel, uint64_t *cycles) | 
| Get the clock rate (cycles per second) for a single PWM output.  More... | |
| static int | pwm_set (const struct device *dev, uint32_t channel, uint32_t period, uint32_t pulse, pwm_flags_t flags) | 
| Set the period and pulse width in nanoseconds for a single PWM output.  More... | |
| static int | pwm_set_dt (const struct pwm_dt_spec *spec, uint32_t period, uint32_t pulse) | 
| Set the period and pulse width in nanoseconds from a struct pwm_dt_spec (with custom period).  More... | |
| static int | pwm_set_pulse_dt (const struct pwm_dt_spec *spec, uint32_t pulse) | 
| Set the period and pulse width in nanoseconds from a struct pwm_dt_spec.  More... | |
| static int | pwm_cycles_to_usec (const struct device *dev, uint32_t channel, uint32_t cycles, uint64_t *usec) | 
| Convert from PWM cycles to microseconds.  More... | |
| static int | pwm_cycles_to_nsec (const struct device *dev, uint32_t channel, uint32_t cycles, uint64_t *nsec) | 
| Convert from PWM cycles to nanoseconds.  More... | |
| static int | pwm_configure_capture (const struct device *dev, uint32_t channel, pwm_flags_t flags, pwm_capture_callback_handler_t cb, void *user_data) | 
| Configure PWM period/pulse width capture for a single PWM input.  More... | |
| int | pwm_enable_capture (const struct device *dev, uint32_t channel) | 
| Enable PWM period/pulse width capture for a single PWM input.  More... | |
| int | pwm_disable_capture (const struct device *dev, uint32_t channel) | 
| Disable PWM period/pulse width capture for a single PWM input.  More... | |
| int | pwm_capture_cycles (const struct device *dev, uint32_t channel, pwm_flags_t flags, uint32_t *period, uint32_t *pulse, k_timeout_t timeout) | 
| Capture a single PWM period/pulse width in clock cycles for a single PWM input.  More... | |
| static int | pwm_capture_usec (const struct device *dev, uint32_t channel, pwm_flags_t flags, uint64_t *period, uint64_t *pulse, k_timeout_t timeout) | 
| Capture a single PWM period/pulse width in microseconds for a single PWM input.  More... | |
| static int | pwm_capture_nsec (const struct device *dev, uint32_t channel, pwm_flags_t flags, uint64_t *period, uint64_t *pulse, k_timeout_t timeout) | 
| Capture a single PWM period/pulse width in nanoseconds for a single PWM input.  More... | |
Public PWM Driver APIs.