drivers: pwm: add support for inverted PWM signals
Add support for requesting an inverted PWM pulse (active-low) when setting up the period and pulse width of a PWM pin. This is useful when driving external, active-low circuitry (e.g. an LED) with a PWM signal. All in-tree PWM drivers is updated to match the new API signature, but no driver support for inverted PWM signals is added yet. All in-tree PWM consumers are updated to pass a flags value of 0 (0 meaning default, which is normal PWM polarity). Fixes #21384. Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
parent
def1f0e2d5
commit
db611e6781
24 changed files with 152 additions and 38 deletions
27
include/dt-bindings/pwm/pwm.h
Normal file
27
include/dt-bindings/pwm/pwm.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Vestas Wind Systems A/S
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_PWM_PWM_H_
|
||||
#define ZEPHYR_INCLUDE_DT_BINDINGS_PWM_PWM_H_
|
||||
|
||||
/**
|
||||
* @name PWM polarity flags
|
||||
* The `PWM_POLARITY_*` flags are used with pwm_pin_set_cycles(),
|
||||
* pwm_pin_set_usec(), or pwm_pin_set_nsec() to specify the polarity
|
||||
* of a PWM pin.
|
||||
* @{
|
||||
*/
|
||||
/** PWM pin normal polarity (active-high pulse). */
|
||||
#define PWM_POLARITY_NORMAL (0 << 0)
|
||||
|
||||
/** PWM pin inverted polarity (active-low pulse). */
|
||||
#define PWM_POLARITY_INVERTED (1 << 0)
|
||||
|
||||
/** @cond INTERNAL_HIDDEN */
|
||||
#define PWM_POLARITY_MASK 0x1
|
||||
/** @endcond */
|
||||
/** @} */
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_PWM_PWM_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue