ChibiOS 21.11.4
hal_pwm.h File Reference

PWM Driver macros and structures. More...

#include "hal_pwm_lld.h"

Go to the source code of this file.

Macros

PWM output mode macros
#define PWM_OUTPUT_MASK   0x0FU
 Standard output modes mask.
#define PWM_OUTPUT_DISABLED   0x00U
 Output not driven, callback only.
#define PWM_OUTPUT_ACTIVE_HIGH   0x01U
 Positive PWM logic, active is logic level one.
#define PWM_OUTPUT_ACTIVE_LOW   0x02U
 Inverse PWM logic, active is logic level zero.
PWM duty cycle conversion
#define PWM_FRACTION_TO_WIDTH(pwmp, denominator, numerator)
 Converts from fraction to pulse width.
#define PWM_DEGREES_TO_WIDTH(pwmp, degrees)
 Converts from degrees to pulse width.
#define PWM_PERCENTAGE_TO_WIDTH(pwmp, percentage)
 Converts from percentage to pulse width.
Macro Functions
#define pwmChangePeriodI(pwmp, value)
 Changes the period the PWM peripheral.
#define pwmEnableChannelI(pwmp, channel, width)
 Enables a PWM channel.
#define pwmDisableChannelI(pwmp, channel)
 Disables a PWM channel.
#define pwmIsChannelEnabledI(pwmp, channel)
 Returns a PWM channel status.
#define pwmEnablePeriodicNotificationI(pwmp)
 Enables the periodic activation edge notification.
#define pwmDisablePeriodicNotificationI(pwmp)
 Disables the periodic activation edge notification.
#define pwmEnableChannelNotificationI(pwmp, channel)
 Enables a channel de-activation edge notification.
#define pwmDisableChannelNotificationI(pwmp, channel)
 Disables a channel de-activation edge notification.

Typedefs

typedef struct PWMDriver PWMDriver
 Type of a structure representing a PWM driver.
typedef void(* pwmcallback_t) (PWMDriver *pwmp)
 Type of a PWM notification callback.

Enumerations

enum  pwmstate_t { PWM_UNINIT = 0 , PWM_STOP = 1 , PWM_READY = 2 }
 Driver state machine possible states. More...

Functions

void pwmInit (void)
 PWM Driver initialization.
void pwmObjectInit (PWMDriver *pwmp)
 Initializes the standard part of a PWMDriver structure.
msg_t pwmStart (PWMDriver *pwmp, const PWMConfig *config)
 Configures and activates the PWM peripheral.
void pwmStop (PWMDriver *pwmp)
 Deactivates the PWM peripheral.
void pwmChangePeriod (PWMDriver *pwmp, pwmcnt_t period)
 Changes the period the PWM peripheral.
void pwmEnableChannel (PWMDriver *pwmp, pwmchannel_t channel, pwmcnt_t width)
 Enables a PWM channel.
void pwmDisableChannel (PWMDriver *pwmp, pwmchannel_t channel)
 Disables a PWM channel and its notification.
void pwmEnablePeriodicNotification (PWMDriver *pwmp)
 Enables the periodic activation edge notification.
void pwmDisablePeriodicNotification (PWMDriver *pwmp)
 Disables the periodic activation edge notification.
void pwmEnableChannelNotification (PWMDriver *pwmp, pwmchannel_t channel)
 Enables a channel de-activation edge notification.
void pwmDisableChannelNotification (PWMDriver *pwmp, pwmchannel_t channel)
 Disables a channel de-activation edge notification.

Detailed Description

PWM Driver macros and structures.

Definition in file hal_pwm.h.