device/class/pwm.h header reference
[Devices support library module]

The source code of this header can be browsed online.

Description [link] 

This device class API allows configuration of multiple PWM channels provided by a single device.

The channel mapping exposed by the driver can be specified in the device resources. When no mapping resources is specified, the API channel indices follows the hardware channel order.

DEV_STATIC_RES_UINT_PARAM("remap", LUT_8_4_DEF(1, 2, 0))

See also DRIVER_CLASS_PWM.

Members [link] 

Types [link] 

Functions [link] 

Constant [link] 

Macros [link] 

Members detail [link] 

#define DEV_PWM_CONFIG(n) [link] 

This macro is declared in device/class/pwm.h source file, line 115.

See also dev_pwm_config_t.

#define DRIVER_PWM_METHODS(prefix) [link] 

This macro is declared in device/class/pwm.h source file, line 149.

See also struct driver_pwm_s.

#define __DEVICE_PWM_H__ [link] 

This macro is declared in device/class/pwm.h source file, line 42.

struct dev_pwm_config_s [link] 

This struct is declared in device/class/pwm.h source file, line 89.

FieldDescription
uint32_t chan_mask;
uint_fast8_t param_mask;
struct dev_freq_s freq;
struct dev_freq_ratio_s duty;
enum dev_pwm_polarity_e pol;

typedef error_t (dev_pwm_config_t)(const struct device_pwm_s *pdev, struct dev_pwm_rq_s *rq) [link] 

This typedef is declared in device/class/pwm.h source file, line 143.

This typedef configures some PWM channels. Channels are selected by the dev_pwm_rq_s::chan_mask field.

The dev_pwm_rq_s::param_mask field selects the parameters that are updated. A single call to this typedef, can set the configuration of multiple channels atomically if this is supported by the the hardware.

Depending on the hardware design, some parameters may be shared between channels. This is usually the case for the frequency parameters. The -ENOTSUP error is reported when such a parameter is not changed for all channels at the same time.

A channel output has no transitions when the duty cycle is either 0 or 1. The duty cycle of channels is set to 0 when the driver is initialized.

The device_start function must be called in order to start operation. All channels are started simultaneously when the device is started.

The PWM output signal will change as soon as possible. This may occur after the return of the function.

This declaration involves expansion of the DEV_PWM_CONFIG macro.

enum dev_pwm_mask_e [link] 

This enum is declared in device/class/pwm.h source file, line 74.

IdentifierDescription
DEV_PWM_MASK_NONE
DEV_PWM_MASK_FREQ
DEV_PWM_MASK_DUTY
DEV_PWM_MASK_POL

const char dev_pwm_polarity_e[] [link] 

This constant is declared in ENUM_DESCRIPTOR function like macro expansion, line 1 in device/class/pwm.h source file, line 61.

PWM polarity.

Alternate declarations with same identifier: [1], [2].

enum dev_pwm_polarity_e [link] 

This enum is declared in device/class/pwm.h source file, line 64.

Alternate declarations with same identifier: [1], [2].

IdentifierDescription
DEV_PWM_POL_HIGH
DEV_PWM_POL_LOW

struct dev_pwm_rq_s [link] 

This struct is declared in device/class/pwm.h source file, line 107.

FieldDescription
uint32_t cfg_count;
const struct dev_pwm_config_s * cfg;

struct device_pwm_s [link] 

This struct is declared in DRIVER_CLASS_TYPES function like macro expansion, line 18 in device/class/pwm.h source file, line 147.

This struct is the device accessor object type for the pwm device class. This accessor must be initialized by calling the device_get_accessor function.

See also DRIVER_CLASS_PWM, struct device_accessor_s and Device accessor.

FieldDescription
union <anonymous> {
struct device_accessor_s base;
struct <anonymous> {
struct device_s * dev;
struct driver_pwm_s * api;
uint_fast8_t number;
};
};

struct device_accessor_s * device_pwm_s_base(struct device_pwm_s *x) [link] 

This function is declared in DRIVER_CLASS_TYPES function like macro expansion, line 39 in device/class/pwm.h source file, line 147.

This function casts a pwm device accessor to a generic device accessor

struct device_pwm_s * device_pwm_s_cast(struct device_accessor_s *x) [link] 

This function is declared in DRIVER_CLASS_TYPES function like macro expansion, line 32 in device/class/pwm.h source file, line 147.

This function casts a generic device accessor to a pwm device accessor

struct driver_pwm_s [link] 

This struct is declared in DRIVER_CLASS_TYPES function like macro expansion, line 5 in device/class/pwm.h source file, line 147.

This struct is the driver API descriptor for the pwm device class.

See also DRIVER_CLASS_PWM and struct driver_class_s.

Valid XHTML 1.0 StrictGenerated by diaxen on Thu Aug 4 15:44:05 2022 using MkDoc