Re: Determining type of device

Felipe Neves

Hi Johannes, as far I know, the device structure is formed by generic pointers in all its fields, in a first look this stills a good approach to keep the flexibility and while keeps the device API uniform, on other hand it is not a type-safe, so you cannot determine which type of device using only the device structure.

Please let me know if this info was useful.


2017-11-29 13:51 GMT-02:00 Johannes Hutter <johannes@...>:

Hello everyone,

is there a zephyr-way in determining which type a device is, after getting a reference to it through device_get_binding?

Since a gpio device has the same signature as a flash for example it's not obvious for me how to make sure that the right device pointer is passed in a higer-level application.

Thanks in advance,


Johannes Hutter ¦ Embedded Software Developer
Mail: johannes@...

Workaround GmbH (ProGlove)
Friedenstr. 4 | 81671 München

Managing Director: Thomas Kirchner
HRB: 216605 | AG München
USt.-IdNr.: DE298859320

Zephyr-users mailing list

Felipe S. Neves 
Embedded software & systems engineer
Skype: fneves1989
+55 11 96610 – 0855 

Join to automatically receive all group messages.