soc: nordic_nrf: add NRF_DT_GPIOS_TO_PSEL_OR
Helper macro for getting the PSEL value from optional devicetree properties. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
b1e0bacb5e
commit
50b267f1d6
1 changed files with 12 additions and 0 deletions
|
@ -130,6 +130,18 @@
|
||||||
(DT_GPIO_PIN(node_id, prop) + \
|
(DT_GPIO_PIN(node_id, prop) + \
|
||||||
(DT_PROP_BY_PHANDLE(node_id, prop, port) << 5))
|
(DT_PROP_BY_PHANDLE(node_id, prop, port) << 5))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the node has the property, expands to
|
||||||
|
* NRF_DT_GPIOS_TO_PSEL(node_id, prop). The default_value argument is
|
||||||
|
* not expanded in this case.
|
||||||
|
*
|
||||||
|
* Otherwise, expands to default_value.
|
||||||
|
*/
|
||||||
|
#define NRF_DT_GPIOS_TO_PSEL_OR(node_id, prop, default_value) \
|
||||||
|
COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
|
||||||
|
(NRF_DT_GPIOS_TO_PSEL(node_id, prop)), \
|
||||||
|
(default_value))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error out the build if 'prop' is set on node 'node_id' and
|
* Error out the build if 'prop' is set on node 'node_id' and
|
||||||
* DT_GPIO_CTLR(node_id, prop) is not an SoC GPIO controller,
|
* DT_GPIO_CTLR(node_id, prop) is not an SoC GPIO controller,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue