# Zephyr: IS_ENABLED

11:06:37 qianfan | Hi, I have a question: what's the difference between 'category: optional' and      x abelur
| 'category: required' in yaml file?                                                 x acidx
11:11:02  martib | qianfan: required means that the property must be present in a device tree node in x aescolar
| the .dts for the definition to be valid                                            x agallo
11:11:09  martib | optional means the node might not have the property                                x agross
11:14:05 qianfan | martib: Thanks and can optional property has a default value if doesn't presend?   x amitk
11:14:37 qianfan | if doesn't present?                                                                x anangl
11:14:42  martib | qianfan: my guess is that would probably depend on the property                    x andk
11:17:44 qianfan | martib: current dts doesn't create a marco if the property doesn't present. eg: if x andrey-konovalov
| a node(xxx) is a 'boolean' type, if it is present there has a marco '#define       x andrzej_m_p
| CONFIG_XXX True'. But if it doesn't exist, I need write some #ifdef to check if    x andyross
| the marco was defined                                                              x apboie
11:18:45  martib | qianfan: the two ways to check if a boolean config flag is set is with "#ifdef     x aurel32
| CONFIG_XXX" or "if (IS_ENABLED(CONFIG_XXX))"                                       x bumblebury
11:18:55 qianfan | martib: so I want the dts can generate a marco has a default value even if it      x carlesc
| doesn't present. so I don't need write #ifdef to check if it is present            x csd
11:19:18  martib | qianfan: if you don't want to use an ifdef, try the IS_ENABLED variant             x d3z
11:19:47  martib | run "git grep IS_ENABLED" in the zephyr sources for examples                       x dbkinder
11:20:58 qianfan | martib: Thanks and I have a look first                                             x dengke
11:21:39  martib | sure thing                                                                         x djinni       ++`

• 广告
• 抄袭
• 版权
• 政治
• 色情
• 无意义
• 其他

120