![]() |
ChibiOS/RT Architecture - Reference Manual - Guides |
Generic PWM Driver. More...
|
Generic PWM Driver.
This module implements a generic PWM driver. The driver implements a state machine internally:
Modules | |
| PWM Low Level Driver | |
PWM Driver low level driver template. | |
Typedefs | |
| typedef void(* | pwmcallback_t )(void) |
| PWM notification callback type. | |
Enumerations | |
| enum | pwmstate_t { PWM_UNINIT = 0, PWM_STOP = 1, PWM_READY = 2 } |
Driver state machine possible states. More... | |
| enum | pwmmode_t { PWM_OUTPUT_DISABLED = 0, PWM_OUTPUT_ACTIVE_HIGH = 1, PWM_OUTPUT_ACTIVE_LOW = 2 } |
PWM logic mode. More... | |
Functions | |
| void | pwmInit (void) |
| PWM Driver initialization. | |
| void | pwmObjectInit (PWMDriver *pwmp) |
Initializes the standard part of a PWMDriver structure. | |
| void | pwmStart (PWMDriver *pwmp, const PWMConfig *config) |
| Configures and activates the PWM peripheral. | |
| void | pwmStop (PWMDriver *pwmp) |
| Deactivates 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. | |
| typedef void(* pwmcallback_t)(void) |
| enum pwmstate_t |
| enum pwmmode_t |
| void pwmInit | ( | void | ) |
PWM Driver initialization.
Definition at line 58 of file pwm.c.
References pwm_lld_init().
Referenced by halInit().

| void pwmObjectInit | ( | PWMDriver * | pwmp | ) |
Initializes the standard part of a PWMDriver structure.
| [in] | pwmp | pointer to a PWMDriver object |
Definition at line 68 of file pwm.c.
References PWMDriver::pd_config, and PWMDriver::pd_state.
Configures and activates the PWM peripheral.
Definition at line 80 of file pwm.c.
References chDbgAssert, chDbgCheck, chSysLock, chSysUnlock, PWMDriver::pd_config, PWMDriver::pd_state, pwm_lld_start(), PWM_READY, and PWM_STOP.

| void pwmStop | ( | PWMDriver * | pwmp | ) |
Deactivates the PWM peripheral.
| [in] | pwmp | pointer to a PWMDriver object |
Definition at line 99 of file pwm.c.
References chDbgAssert, chDbgCheck, chSysLock, chSysUnlock, PWMDriver::pd_state, pwm_lld_stop(), PWM_READY, and PWM_STOP.

| void pwmEnableChannel | ( | PWMDriver * | pwmp, | |
| pwmchannel_t | channel, | |||
| pwmcnt_t | width | |||
| ) |
Enables a PWM channel.
| [in] | pwmp | pointer to a PWMDriver object |
| [in] | channel | PWM channel identifier |
| [in] | width | PWM pulse width as clock pulses number |
Definition at line 119 of file pwm.c.
References chDbgAssert, chDbgCheck, chSysLock, chSysUnlock, PWMDriver::pd_state, PWM_CHANNELS, pwm_lld_enable_channel(), and PWM_READY.

| void pwmDisableChannel | ( | PWMDriver * | pwmp, | |
| pwmchannel_t | channel | |||
| ) |
Disables a PWM channel.
The channel is disabled and its output line returned to the idle state.
| [in] | pwmp | pointer to a PWMDriver object |
| [in] | channel | PWM channel identifier |
Definition at line 141 of file pwm.c.
References chDbgAssert, chDbgCheck, chSysLock, chSysUnlock, PWMDriver::pd_state, PWM_CHANNELS, pwm_lld_disable_channel(), and PWM_READY.

1.7.1