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,
95  /* extend this list as needed... */
96 };
97 
115 typedef int(*saul_read_t)(void *dev, phydat_t *res);
116 
135 typedef int(*saul_write_t)(void *dev, phydat_t *data);
136 
140 typedef struct {
143  uint8_t type;
144 } saul_driver_t;
145 
149 int saul_notsup(void *dev, phydat_t *dat);
150 
159 const char *saul_class_to_str(uint8_t class_id);
160 
161 #ifdef __cplusplus
162 }
163 #endif
164 
165 #endif /* SAUL_H */
166 
int saul_notsup(void *dev, phydat_t *dat)
Default not supported function.
sensor: accelerometer
Definition: saul.h:87
sensor: raw analog value
Definition: saul.h:92
sensor: magnetometer
Definition: saul.h:88
Generic data container for physical data interface.
any device - wildcard
Definition: saul.h:94
sensor: light
Definition: saul.h:86
any sensor - wildcard
Definition: saul.h:82
Definition of the RIOT actuator/sensor interface.
Definition: saul.h:140
actuator: motor
Definition: saul.h:79
const char * saul_class_to_str(uint8_t class_id)
Helper function converts a class ID to a string.
sensor: temperature
Definition: saul.h:84
sensor: gyroscope
Definition: saul.h:89
actuator: dimmable switch
Definition: saul.h:81
sensor: UV index
Definition: saul.h:93
sensor: humidity
Definition: saul.h:85
Generic data structure for expressing physical values.
Definition: phydat.h:135
saul_write_t write
write function pointer
Definition: saul.h:142
sensor: (light) color
Definition: saul.h:90
device class undefined
Definition: saul.h:75
any actuator - wildcard
Definition: saul.h:76
actuator: simple on/off switch
Definition: saul.h:80
sensor: simple button
Definition: saul.h:83
int(* saul_read_t)(void *dev, phydat_t *res)
Read a value (a set of values) from a device.
Definition: saul.h:115
actuator: servo motor
Definition: saul.h:78
sensor: pressure
Definition: saul.h:91
uint8_t type
device class the device belongs to
Definition: saul.h:143
int(* saul_write_t)(void *dev, phydat_t *data)
Write a value (a set of values) to a device.
Definition: saul.h:135
actuator: RGB LED
Definition: saul.h:77
saul_read_t read
read function pointer
Definition: saul.h:141