include/nuttx/timers/pwm.h: add dcpol attribute to pwm_chan_s

This attribute can set the default polarity of a disabled channel.
This commit is contained in:
Pressl, Štěpán 2024-04-05 16:54:28 +02:00 committed by Alan Carvalho de Assis
parent 17e1d43f6d
commit 21de46a4d1

View File

@ -118,13 +118,26 @@
/* These are helper definitions for setting PWM channel output polarity to
* logical low or high level. The pulsed output should start with this
* logical value and should return to it when the output is disabled.
* logical value.
* The output polarity of the PWM's disabled channel does not depend on this
* value, refer to DCPOL instead.
*/
#define PWM_CPOL_NDEF 0 /* Not defined, default value by arch driver should be used */
#define PWM_CPOL_LOW 1 /* Logical zero */
#define PWM_CPOL_HIGH 2 /* Logical one */
/* PWM disabled channel polarity ********************************************/
/* The output of the PWM disabled channel may depend on the platform
* dependant peripheral. These helper definitions can be used for setting
* the disabled channel's output state.
*/
#define PWM_DCPOL_NDEF 0 /* Not defined, the default output state is arch dependant */
#define PWM_DCPOL_LOW 1 /* Logical zero */
#define PWM_DCPOL_HIGH 2 /* Logical one */
/****************************************************************************
* Public Types
****************************************************************************/
@ -146,6 +159,7 @@ struct pwm_chan_s
ub16_t dead_time_b;
#endif
uint8_t cpol;
uint8_t dcpol;
int8_t channel;
};
#endif
@ -174,6 +188,7 @@ struct pwm_info_s
* generate an indefinite number of pulses */
# endif
uint8_t cpol; /* Channel polarity */
uint8_t dcpol; /* Disabled channel polarity */
#endif /* CONFIG_PWM_MULTICHAN */
FAR void *arg; /* User provided argument to be used in the