Skip to content

Commit f728bb5

Browse files
quytranpzzKhiemNguyenT
authored andcommitted
hal: renesas: rx: Update lvd config value retrieved from dts
Since the bindings of rx lvd was changed the value type, update the config to get value from dts Signed-off-by: Quy Tran <[email protected]>
1 parent 0cdd997 commit f728bb5

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

zephyr/rx/rdp_cfg/r_config/r_lvd_rx_config.h

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ Includes <System Includes> , "Project Includes"
3131
#define BSP_PROP_HAS_STATUS_OKAY_OR(node_id, prop, default_value) \
3232
(COND_CODE_1(DT_NODE_HAS_STATUS(node_id, okay), (DT_PROP(node_id, prop)), (default_value)))
3333

34+
#define BSP_PROP_HAS_STATUS_OKAY_ENUM(node_id, prop, default_value) \
35+
(COND_CODE_1(DT_NODE_HAS_STATUS(node_id, okay), \
36+
(DT_ENUM_IDX(node_id, prop)), (default_value)))
37+
3438
/***********************************************************************************************************************
3539
Macro definitions
3640
***********************************************************************************************************************/
@@ -50,8 +54,10 @@ Macro definitions
5054
/* Specifies the target to be monitored for each channel. */
5155
/* 0: VCC (default value) */
5256
/* 1: CMPA2 pin */
53-
#define LVD_CFG_VDET_TARGET_CHANNEL_1 BSP_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(lvd0), vdet_target, 0)
54-
#define LVD_CFG_VDET_TARGET_CHANNEL_2 BSP_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(lvd1), vdet_target, 0)
57+
#define LVD_CFG_VDET_TARGET_CHANNEL_1 \
58+
BSP_PROP_HAS_STATUS_OKAY_ENUM(DT_NODELABEL(lvd0), vdet_target, 0)
59+
#define LVD_CFG_VDET_TARGET_CHANNEL_2 \
60+
BSP_PROP_HAS_STATUS_OKAY_ENUM(DT_NODELABEL(lvd1), vdet_target, 0)
5561

5662
/* Specifies the voltage detection level for each channel. Set an integer value */
5763
/* which expresses the number up to two decimal places. */
@@ -62,8 +68,10 @@ Macro definitions
6268
/* To set the voltage detection level to 4.29 V, specify '429'. */
6369
/* To set the voltage detection level to default value, specify '0xFFFF' . */
6470

65-
#define LVD_CFG_VOLTAGE_LEVEL_CHANNEL_1 BSP_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(lvd0), voltage_level, 0)
66-
#define LVD_CFG_VOLTAGE_LEVEL_CHANNEL_2 BSP_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(lvd1), voltage_level, 0)
71+
#define LVD_CFG_VOLTAGE_LEVEL_CHANNEL_1 \
72+
BSP_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(lvd0), voltage_level, 0)
73+
#define LVD_CFG_VOLTAGE_LEVEL_CHANNEL_2 \
74+
BSP_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(lvd1), voltage_level, 0)
6775

6876
/* Specifies enable/disable of the digital filter for each channel. */
6977
/* 0: Digital filter is disabled. (default value) */
@@ -93,8 +101,8 @@ Macro definitions
93101
/* reset is selected with this definition, the operation of the reset is not */
94102
/* dependent on the voltage detection condition. */
95103

96-
#define LVD_CFG_ACTION_CHANNEL_1 BSP_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(lvd0), lvd_action, 0)
97-
#define LVD_CFG_ACTION_CHANNEL_2 BSP_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(lvd1), lvd_action, 0)
104+
#define LVD_CFG_ACTION_CHANNEL_1 BSP_PROP_HAS_STATUS_OKAY_ENUM(DT_NODELABEL(lvd0), lvd_action, 0)
105+
#define LVD_CFG_ACTION_CHANNEL_2 BSP_PROP_HAS_STATUS_OKAY_ENUM(DT_NODELABEL(lvd1), lvd_action, 0)
98106

99107
/* Specifies the interrupt priority level for each channel, with maskable interrupt */
100108
/* selected as processing. */
@@ -114,8 +122,11 @@ Macro definitions
114122
/* 1: Negation occurs when a certain period elapses after the LVD reset assertion. */
115123
/* Note: "a certain period" here means a wait time after a voltage monitoring */
116124
/* reset. Refer to the User's Manual: Hardware for details. */
117-
#define LVD_CFG_STABILIZATION_CHANNEL_1 BSP_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(lvd0), lvd_stabilization, 0)
118-
#define LVD_CFG_STABILIZATION_CHANNEL_2 BSP_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(lvd1), lvd_stabilization, 0)
125+
#define LVD_CFG_STABILIZATION_CHANNEL_1 \
126+
BSP_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(lvd0), lvd_stabilization, 0)
127+
#define LVD_CFG_STABILIZATION_CHANNEL_2 \
128+
BSP_PROP_HAS_STATUS_OKAY_OR(DT_NODELABEL(lvd1), lvd_stabilization, 0)
129+
119130
/* Enable Nested Interrupt */
120131
/* 0 : Disable nested interrupt. */
121132
/* 1 : Enable nested interrupt. */

0 commit comments

Comments
 (0)