[riot-notifications] [RIOT-OS/RIOT] Proposal: eSAUL - Extended Sensor Actuator Uber Layer (#14121)

chrysn notifications at github.com
Tue May 26 13:43:51 CEST 2020

> Why not do it like we did with `sock_async` and make it so that the
> event front-end (`event`, `msg`, `msgbus`, ...) can be picked by the
> user?

That's similar to how xtimer works, right? In xtimer there's a lot of
convenience functions (_set_flag, _set_wakeup, _set_msg) whereas in
sock_async there's only _set_cb -- probably just an "API surface vs.
low-threshold usage" thing.

Unlike in those cases, I think we want to allow multiple listeners here.
By the sock_async pattern, that would give an API like

typedef struct saul_subsriber {
    saul_cb_t cb;
    void *data;
    struct saul_subscriber *next;
} saul_subscriber_t;
void saul_subscribe(
    saul_reg_t *sensor,
    saul_cb_t cb,
    void *data,
    saul_subscriber_t *subscriber

where `cb` and `data` would be stored right into subscriber, and that gets chained into the sensor's subscriber pointer. It'd be up to the caller to keep the subscriber_t around until deregistration.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200526/694a7bdc/attachment.htm>

More information about the notifications mailing list