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
24#ifndef SAUL_REG_H
25#define SAUL_REG_H
26
27#include <stdint.h>
28
29#include "saul.h"
30#include "phydat.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
39typedef struct saul_reg {
40 struct saul_reg *next;
41 void *dev;
42 const char *name;
45
49typedef struct {
50 const char *name;
52
56extern saul_reg_t *saul_reg;
57
71
81
91
101
111saul_reg_t *saul_reg_find_type_and_name(uint8_t type, const char *name);
112
125
137int saul_reg_write(saul_reg_t *dev, const phydat_t *data);
138
139#ifdef __cplusplus
140}
141#endif
142
143#endif /* SAUL_REG_H */
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.
Functionality for converting from Phydat to SenML.
Generic data structure for expressing physical values.
Definition phydat.h:155
Definition of the RIOT actuator/sensor interface.
Definition saul.h:284
Additional data to collect for each entry.
Definition saul_reg.h:49
const char * name
string identifier for a device
Definition saul_reg.h:50
SAUL registry entry.
Definition saul_reg.h:39
saul_driver_t const * driver
the devices read callback
Definition saul_reg.h:43
const char * name
string identifier for the device
Definition saul_reg.h:42
void * dev
pointer to the device descriptor
Definition saul_reg.h:41
struct saul_reg * next
pointer to the next device
Definition saul_reg.h:40