[riot-notifications] [RIOT-OS/RIOT] RFC: Change of sensor and actuator API & auto initialization (#11826)

Semjon Kerner notifications at github.com
Sun Jul 14 13:54:29 CEST 2019


I don't agree with your argumentation. Of course it is not my intention to obfuscate driver usage by not initializing sensors. But this is not at all what I said.
Riot is not a copy-paste, arduino-like OS (not my intention to insult ardunio :D).
Init functions are always documented and the usage of those is straight forward, so we are not making anything overly complicated for programmers by not initializing. Moreover we are giving them the freedom to do it if and when needed.
IMHO anyone who fails to use an init function, who is also not able to fix the issue within the time you'd need to find a missing semicolon is **_NOT_** our target audience.

I don't really get why you gave this excursion, since it'd only support your point in case it was the standard for OSs to initialize drivers and thus everyone is used to this behaviour. I don't what to get all rhetoric, but even considering standards for OS driven sensor initialisation seems weird to me.

> So then lets fix these APIs ;-)

You know yourself how hard this is and sometimes not even wanted. I think, if you are really convinced of this idea you should not push in this direction right away, or it will give you a hard time discussing the basics.

> 1. Someone compiles with USEMODULE=saul_default make
> 2. Some other shell command relying on auto-init (e.g. the weather shell command) is added

Anyone interested in using auto_init for their sensors should not be interested in managing the sensor themselves. If this is a concern then there should be a note in the documentation (probably both in auto_init calling modules and in the drivers that support auto_init for a module).

> 3. Another thread is also using the driver. It would need to block until the other thread has completed the initialization, or other ways of synchronizing the driver need to be found.

Making sure a driver is properly initialized before usage is always appreciated, but again IMHO not necessarily the responsibility of the OS.
Even if this is a wanted feature it might as well be a part of the driver (e.g. status flags/mutex guarding function calls). This seems overly complicated as well, but most sensors are not expected to be threadsafe anyway.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/issues/11826#issuecomment-511196456
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190714/fd2f1e53/attachment.html>


More information about the notifications mailing list