The friendly Operating System for the Internet of Things
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 
49 #include "phydat.h"
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
73 enum {
75  SAUL_ACT_ANY = 0x40,
77  SAUL_ACT_SERVO = 0x43,
78  SAUL_ACT_MOTOR = 0x44,
79  SAUL_ACT_SWITCH = 0x45,
80  SAUL_ACT_DIMMER = 0x46,
81  SAUL_SENSE_ANY = 0x80,
82  SAUL_SENSE_BTN = 0x81,
83  SAUL_SENSE_TEMP = 0x82,
84  SAUL_SENSE_HUM = 0x83,
87  SAUL_SENSE_MAG = 0x86,
88  SAUL_SENSE_GYRO = 0x87,
92  SAUL_SENSE_UV = 0x8b,
94  /* extend this list as needed... */
95 };
96 
114 typedef int(*saul_read_t)(void *dev, phydat_t *res);
115 
134 typedef int(*saul_write_t)(void *dev, phydat_t *data);
135 
139 typedef struct {
142  uint8_t type;
143 } saul_driver_t;
144 
148 int saul_notsup(void *dev, phydat_t *dat);
149 
158 const char *saul_class_to_str(uint8_t class_id);
159 
160 #ifdef __cplusplus
161 }
162 #endif
163 
164 #endif /* SAUL_H */
165 
int saul_notsup(void *dev, phydat_t *dat)
Default not supported function.
sensor: raw analog value
Definition: saul.h:91
actuator: simple on/off switch
Definition: saul.h:79
Generic data container for physical data interface.
actuator: dimmable switch
Definition: saul.h:80
sensor: (light) color
Definition: saul.h:89
sensor: temperature
Definition: saul.h:83
sensor: pressure
Definition: saul.h:90
Definition of the RIOT actuator/sensor interface.
Definition: saul.h:139
sensor: magnetometer
Definition: saul.h:87
const char * saul_class_to_str(uint8_t class_id)
Helper function converts a class ID to a string.
sensor: light
Definition: saul.h:85
actuator: motor
Definition: saul.h:78
Generic data structure for expressing physical values.
Definition: phydat.h:135
saul_write_t write
write function pointer
Definition: saul.h:141
sensor: gyroscope
Definition: saul.h:88
any device - wildcard
Definition: saul.h:93
int(* saul_read_t)(void *dev, phydat_t *res)
Read a value (a set of values) from a device.
Definition: saul.h:114
sensor: simple button
Definition: saul.h:82
sensor: humidity
Definition: saul.h:84
actuator: RGB LED
Definition: saul.h:76
any actuator - wildcard
Definition: saul.h:75
actuator: servo motor
Definition: saul.h:77
sensor: UV index
Definition: saul.h:92
uint8_t type
device class the device belongs to
Definition: saul.h:142
any sensor - wildcard
Definition: saul.h:81
int(* saul_write_t)(void *dev, phydat_t *data)
Write a value (a set of values) to a device.
Definition: saul.h:134
sensor: accelerometer
Definition: saul.h:86
device class undefined
Definition: saul.h:74
saul_read_t read
read function pointer
Definition: saul.h:140