Loading...
Searching...
No Matches
saul_reg.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 Freie Universität Berlin
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
22
23#include <stdint.h>
24
25#include "saul.h"
26#include "phydat.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
35typedef struct saul_reg {
36 struct saul_reg *next;
37 void *dev;
38 const char *name;
41
45typedef struct {
46 const char *name;
48
52extern saul_reg_t *saul_reg;
53
67
77
87
96saul_reg_t *saul_reg_find_name(const char *name);
97
107saul_reg_t *saul_reg_find_type_and_name(uint8_t type, const char *name);
108
121
133int saul_reg_write(saul_reg_t *dev, const phydat_t *data);
134
135#ifdef __cplusplus
136}
137#endif
138
saul_reg_t * saul_reg_find_nth(int pos)
Find a device by its position in the registry.
saul_reg_t * saul_reg_find_type_and_name(uint8_t type, const char *name)
Find the first device by its type and name in the registry.
int saul_reg_write(saul_reg_t *dev, const phydat_t *data)
Write data to the given device.
saul_reg_t * saul_reg_find_type(uint8_t type)
Find the first device by its type in the registry.
int saul_reg_add(saul_reg_t *dev)
Register a device with the SAUL registry.
saul_reg_t * saul_reg_find_name(const char *name)
Find the first device by its name in the registry.
int saul_reg_read(saul_reg_t *dev, phydat_t *res)
Read data from the given device.
struct saul_reg saul_reg_t
SAUL registry entry.
Generic data container for physical data interface.
Generic data structure for expressing physical values.
Definition phydat.h:148
Definition of the RIOT actuator/sensor interface.
Definition saul.h:286
Additional data to collect for each entry.
Definition saul_reg.h:45
const char * name
string identifier for a device
Definition saul_reg.h:46
SAUL registry entry.
Definition saul_reg.h:35
saul_driver_t const * driver
the devices read callback
Definition saul_reg.h:39
const char * name
string identifier for the device
Definition saul_reg.h:38
void * dev
pointer to the device descriptor
Definition saul_reg.h:37
struct saul_reg * next
pointer to the next device
Definition saul_reg.h:36