Introducing SAUL, the [S]ensor [A]ctuator [U]ber [L]ayer#3538
Introducing SAUL, the [S]ensor [A]ctuator [U]ber [L]ayer#3538kaspar030 merged 14 commits intoRIOT-OS:masterfrom
Conversation
|
You might want to overthink that name ;-) |
|
possibly... Any better ideas? |
|
(U)ASAPI [(unified) actuator sensor API]? |
sys/include/phydat.h
Outdated
There was a problem hiding this comment.
Why no typedef for that? phydat_unit_t e.g.
There was a problem hiding this comment.
As an ex-chemist I see a worrying lack of UNIT_MOL ;-P
There was a problem hiding this comment.
(or as a more practical approach UNIT_PERCENT, UNIT_PERMIL, and UNIT_PPM)
There was a problem hiding this comment.
As stated in the comment, extend the list when you need anything...
|
Thought about the name, how about |
|
Nice work! I think we should try to get away with a static (compile-time)registry., though. Similar to how we did it for shell commands. |
👍 - and once again I'm not in favor of introducing more function pointers. I find them super annoying for debugging. |
|
Actually I am against the static approach, as this does not allow for hot-plugging - and that is a feature that I see as quite interesting and more-then-nice-to-have for the future! |
fab7700 to
6a140d2
Compare
|
Renamed the interface, now i's all good man :-) Also I separated the actual interface ( @kaspar030, care to take a look? |
6a140d2 to
df5c6ef
Compare
|
rebased |
There was a problem hiding this comment.
what is the difference to saul_reg_t::name?
There was a problem hiding this comment.
no same name (both point to the same text most likely), saul_reg_t is located in RAM for holding a saul reg entry, saul_reg_info_t is used for defining additional information about a device, e.g. used by auto-init
There was a problem hiding this comment.
At some point we probably may decide to either get rid of this type and use a string directly or to let saul_reg_t point to this, dependent if there will be more information (fields) that is added to sauL_reg_info_t
|
Reviewed the latest commits fixing my minor remarks. Please squash. |
- isl29020 - l3g4200d - lps331ap - lsm303dlhc
f18ebb5 to
28e800d
Compare
|
squashed |
|
Travis is happy - @kaspar030: do you ack? |
|
Yep. go! |
Introducing SAUL, the [S]ensor [A]ctuator [U]ber [L]ayer
|
Congrats! |
|
Is this suitable to replace the awful LED-Macros some tests depend on? Instead of relying on LED_RED and other stuff to be defined (even if there aren't any red ones ;) use the 1st, 2nd, etc. actuator of type led? |
|
For LEDs I think there's no way around macros, because there are often inevitable for debugging where any overhead is not tolerable. I wouldn't object renaming to something like |
There was a problem hiding this comment.
s/express/expressed/
Sorry for being that late, I waited with reading the docs until now that SAUL is merged.
|
good catches -> fixed in #4369 |
Let me introduce to you RASI - the all new generic [R]IOT [A]ctuator [S]ensor [I]nterface.EDIT Let me introduce to you SAUL - the all new generic [S]ensor [A]ctuator [U]ber [L]ayer.
I had a nice idea for making all sensors and actuator in a system available via a unified API, and here are the results.
The concepts are very similar to (grnc) netdev and netif - every actuator and sensor is accessible through the same API (read and write for now) with one single data structure used of parameter passing ->
phydat_t. All devices register at a central location and can then be listed, queried, searched and accessed. By specifying unique classes of devices, one could search for: "give me all sensors, that read pressure values" or similar.This data structure
phydat_tis made for carrying up to 3 dimensions of physical values, e.g. values read by sensor or set values for actuators. It takes only ~8 byte and contains additional to the data the physical unit and a scaling factor.Also I included the sensors for auto-initialization, exactly in the same way we do it for network interfaces: In the board or in the application you just define a set of parameters for a device, and auto-init takes care of the rest.
Testing this PR is best done on the
iot-lab_M3, as I included all 4 sensors and 3 LED (actuators) into this PR. A little comparison:Code size of the default example before:
and after:
We save ~900 byte of flash and lose ~100byte of RAM. The saved flash is mainly due to one unified shell command (instead of one for each sensor before). The lost RAM is spend on the RASI registry, in this setup there are 8 devices in it (5 sensor entries, 3 LEDs) and one entry is 12 byte...
EDIT
The amount of touched files looks worse than it is - this PR is based on #3535 and #3420.Removed all dependencies