saul.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 
44 #ifndef SAUL_H
45 #define SAUL_H
46 
47 #include <stdint.h>
48 #include <errno.h>
49 
50 #include "phydat.h"
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
74 enum {
76  SAUL_ACT_ANY = 0x40,
78  SAUL_ACT_SERVO = 0x43,
79  SAUL_ACT_MOTOR = 0x44,
80  SAUL_ACT_SWITCH = 0x45,
81  SAUL_ACT_DIMMER = 0x46,
82  SAUL_SENSE_ANY = 0x80,
83  SAUL_SENSE_BTN = 0x81,
84  SAUL_SENSE_TEMP = 0x82,
85  SAUL_SENSE_HUM = 0x83,
88  SAUL_SENSE_MAG = 0x86,
89  SAUL_SENSE_GYRO = 0x87,
93  SAUL_SENSE_UV = 0x8b,
97  SAUL_SENSE_CO2 = 0x8f,
99  /* extend this list as needed... */
100 };
101 
119 typedef int(*saul_read_t)(const void *dev, phydat_t *res);
120 
139 typedef int(*saul_write_t)(const void *dev, phydat_t *data);
140 
144 typedef struct {
147  uint8_t type;
148 } saul_driver_t;
149 
153 int saul_notsup(const void *dev, phydat_t *dat);
154 
163 const char *saul_class_to_str(const uint8_t class_id);
164 
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 #endif /* SAUL_H */
170 
sensor: UV index
Definition: saul.h:93
sensor: humidity
Definition: saul.h:85
sensor: CO2 Gas
Definition: saul.h:97
int(* saul_write_t)(const void *dev, phydat_t *data)
Write a value (a set of values) to a device.
Definition: saul.h:139
int(* saul_read_t)(const void *dev, phydat_t *res)
Read a value (a set of values) from a device.
Definition: saul.h:119
Generic data container for physical data interface.
sensor: gyroscope
Definition: saul.h:89
device class undefined
Definition: saul.h:75
sensor: pulse counter
Definition: saul.h:95
any actuator - wildcard
Definition: saul.h:76
actuator: servo motor
Definition: saul.h:78
const char * saul_class_to_str(const uint8_t class_id)
Helper function converts a class ID to a string.
actuator: dimmable switch
Definition: saul.h:81
Definition of the RIOT actuator/sensor interface.
Definition: saul.h:144
sensor: accelerometer
Definition: saul.h:87
sensor: pressure
Definition: saul.h:91
sensor: simple button
Definition: saul.h:83
sensor: distance
Definition: saul.h:96
actuator: RGB LED
Definition: saul.h:77
actuator: simple on/off switch
Definition: saul.h:80
sensor: (light) color
Definition: saul.h:90
sensor: light
Definition: saul.h:86
Generic data structure for expressing physical values.
Definition: phydat.h:134
saul_write_t write
write function pointer
Definition: saul.h:146
int saul_notsup(const void *dev, phydat_t *dat)
Default not supported function.
sensor: magnetometer
Definition: saul.h:88
sensor: object temperature
Definition: saul.h:94
sensor: temperature
Definition: saul.h:84
sensor: raw analog value
Definition: saul.h:92
uint8_t type
device class the device belongs to
Definition: saul.h:147
actuator: motor
Definition: saul.h:79
any sensor - wildcard
Definition: saul.h:82
any device - wildcard
Definition: saul.h:98
saul_read_t read
read function pointer
Definition: saul.h:145