ChibiOS/HAL  6.1.0
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. More...
 
#define PWM_OUTPUT_DISABLED   0x00U
 Output not driven, callback only. More...
 
#define PWM_OUTPUT_ACTIVE_HIGH   0x01U
 Positive PWM logic, active is logic level one. More...
 
#define PWM_OUTPUT_ACTIVE_LOW   0x02U
 Inverse PWM logic, active is logic level zero. More...
 
PWM duty cycle conversion
#define PWM_FRACTION_TO_WIDTH(pwmp, denominator, numerator)
 Converts from fraction to pulse width. More...
 
#define PWM_DEGREES_TO_WIDTH(pwmp, degrees)   PWM_FRACTION_TO_WIDTH(pwmp, 36000, degrees)
 Converts from degrees to pulse width. More...
 
#define PWM_PERCENTAGE_TO_WIDTH(pwmp, percentage)   PWM_FRACTION_TO_WIDTH(pwmp, 10000, percentage)
 Converts from percentage to pulse width. More...
 
Macro Functions
#define pwmChangePeriodI(pwmp, value)
 Changes the period the PWM peripheral. More...
 
#define pwmEnableChannelI(pwmp, channel, width)
 Enables a PWM channel. More...
 
#define pwmDisableChannelI(pwmp, channel)
 Disables a PWM channel. More...
 
#define pwmIsChannelEnabledI(pwmp, channel)   (((pwmp)->enabled & ((pwmchnmsk_t)1U << (pwmchnmsk_t)(channel))) != 0U)
 Returns a PWM channel status. More...
 
#define pwmEnablePeriodicNotificationI(pwmp)   pwm_lld_enable_periodic_notification(pwmp)
 Enables the periodic activation edge notification. More...
 
#define pwmDisablePeriodicNotificationI(pwmp)   pwm_lld_disable_periodic_notification(pwmp)
 Disables the periodic activation edge notification. More...
 
#define pwmEnableChannelNotificationI(pwmp, channel)   pwm_lld_enable_channel_notification(pwmp, channel)
 Enables a channel de-activation edge notification. More...
 
#define pwmDisableChannelNotificationI(pwmp, channel)   pwm_lld_disable_channel_notification(pwmp, channel)
 Disables a channel de-activation edge notification. More...
 

Typedefs

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

Enumerations

Functions

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

Detailed Description

PWM Driver macros and structures.

Definition in file hal_pwm.h.