[riot-notifications] [RIOT-OS/RIOT] sys/saul: add saul_reg_find_type_and_name (#15791)

Bas Stottelaar notifications at github.com
Mon Jan 18 22:38:48 CET 2021


### Contribution description
This PR adds `saul_reg_find_type_and_name(type, name)`.

The existing `saul_reg_find_type(type)` and `saul_reg_find_name(name)` will only return the first registration found. Given that there can be multiple sensors/actuators of the same type and sensors/actuators register with the same name, the existing methods are not useful to find (for instance) a specific sensor or actuator.

The user could write its own method to find a registration, since `saul_reg` is exported as a global, but I think having this method as well won't hurt.

### Testing procedure
Unit tests have been provided.

### Issues/PRs references
None

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/15791

-- Commit Summary --

  * sys/saul_reg: add saul_reg_find_type_and_name
  * unittests: extend tests for saul_reg

-- File Changes --

    M sys/include/saul_reg.h (19)
    M sys/saul_reg/saul_reg.c (13)
    M tests/unittests/tests-saul_reg/tests-saul_reg.c (40)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/15791.patch
https://github.com/RIOT-OS/RIOT/pull/15791.diff

-- 
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/pull/15791
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210118/3e154e63/attachment.htm>


More information about the notifications mailing list