Loading...
Searching...
No Matches
saul_reg.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Freie Universität Berlin
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
9#pragma once
10
25
26#include <stdint.h>
27
28#include "saul.h"
29#include "phydat.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
38typedef struct saul_reg {
39 struct saul_reg *next;
40 void *dev;
41 const char *name;
44
48typedef struct {
49 const char *name;
51
55extern saul_reg_t *saul_reg;
56
70
80
90
99saul_reg_t *saul_reg_find_name(const char *name);
100
110saul_reg_t *saul_reg_find_type_and_name(uint8_t type, const char *name);
111
124
136int saul_reg_write(saul_reg_t *dev, const phydat_t *data);
137
138#ifdef __cplusplus
139}
140#endif
141
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:154
Definition of the RIOT actuator/sensor interface.
Definition saul.h:283
Additional data to collect for each entry.
Definition saul_reg.h:48
const char * name
string identifier for a device
Definition saul_reg.h:49
SAUL registry entry.
Definition saul_reg.h:38
saul_driver_t const * driver
the devices read callback
Definition saul_reg.h:42
const char * name
string identifier for the device
Definition saul_reg.h:41
void * dev
pointer to the device descriptor
Definition saul_reg.h:40
struct saul_reg * next
pointer to the next device
Definition saul_reg.h:39