PebbleOS v4.47.0-1362-gd278268fe
Loading...
Searching...
No Matches
PWM controller drivers

Interface for PWM controller drivers. More...

Data Structures

struct  pbl_pwm_controller_ops
 PWM controller driver operations. More...
 
struct  pbl_pwm_controller
 A PWM controller. More...
 

Macros

#define PBL_PWM_CONTROLLER_STATE_DEFINE(sym, _num_channels)
 Define the class state of PWM controller sym, for the driver's define macro.
 
#define PBL_PWM_CONTROLLER_INIT(sym, _name, _init, _parent, _ops)
 Initializer for the struct pbl_pwm_controller of controller sym.
 

Variables

const struct pbl_device_class pbl_pwm_class
 Class of the PWM controllers.
 

Detailed Description

Interface for PWM controller drivers.

A driver embeds a struct pbl_pwm_controller in its instance, sets it up with PBL_PWM_CONTROLLER_STATE_DEFINE() and PBL_PWM_CONTROLLER_INIT(), and implements the struct pbl_pwm_controller_ops the class calls.


Data Structure Documentation

◆ pbl_pwm_controller

struct pbl_pwm_controller

A PWM controller.

Data Fields
struct pbl_device dev Device.
uint8_t num_channels Number of channels.
const struct pbl_pwm_controller_ops * ops Driver operations.
struct pbl_pwm_state * states Last applied state of each channel.

Macro Definition Documentation

◆ PBL_PWM_CONTROLLER_INIT

#define PBL_PWM_CONTROLLER_INIT (   sym,
  _name,
  _init,
  _parent,
  _ops 
)
Value:
{ \
.dev = PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, &pbl_pwm_class), \
.ops = (_ops), \
.states = sym##_pwm_states, \
.num_channels = sizeof(sym##_pwm_states) / sizeof(sym##_pwm_states[0]), \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:153
const struct pbl_device_class pbl_pwm_class
Class of the PWM controllers.

Initializer for the struct pbl_pwm_controller of controller sym.

Parameters
symSymbol of the controller instance, with its state defined by PBL_PWM_CONTROLLER_STATE_DEFINE().
_nameName.
_initDevice init function, or NULL.
_parentParent device, or NULL.
_opsDriver operations.

◆ PBL_PWM_CONTROLLER_STATE_DEFINE

#define PBL_PWM_CONTROLLER_STATE_DEFINE (   sym,
  _num_channels 
)
Value:
static struct pbl_pwm_state sym##_pwm_states[_num_channels]
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
Output state.
Definition pwm.h:62

Define the class state of PWM controller sym, for the driver's define macro.

Parameters
symSymbol of the controller instance.
_num_channelsNumber of channels.

Variable Documentation

◆ pbl_pwm_class

const struct pbl_device_class pbl_pwm_class
extern

Class of the PWM controllers.