Replies: 2 comments
-
It feels there is unnecessary complexity put to the user that could be handled more generically by the non-dt interfaces when the full configuration information is provided in dt. For example, the Can we get a macro that will generically give us something to go into I'm probably not clear as I'm so frustrated by the usage model that I cannot organize my thoughts. :-( |
Beta Was this translation helpful? Give feedback.
-
@rjmaris, Yeah, it's a If you already know the number of ADC channels, then declaring
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
First of all: I know that accessing by dt_spec is more versatile because the dev struct is contained in a dt_spec structure.
Since
samples/drivers/adc
offers handling of both 'methods' to create application code, I have a quite good opportunity to compare the two approaches. The newer example (adc_sequence
, device focused) looks more readable than the older example (adc_dt
). The beginning of the former code,perfectly well 'maps' to the Get a struct device from a devicetree node section of the HOWTOs.
Contrary, the function accesses in the latter code (function_dt) are simpler, because on dt_spec level.
However, the initial lines of the code makes me (and others) ask whether it's complexity is part of the game or not:
(Of course, the complexity here also lies in the checker whether a zephyr_user section with appropriate content is present in an overlay)
I suppose that the use of DT_SPEC_AND_COMMA helper macro is outdated. Just for this reason it would be helpful if the HOWTOs also address the approach of declaring a dt_spec struct.
If Howto information is available elsewhere, a link to it would be helpful.
Beta Was this translation helpful? Give feedback.
All reactions