Definition of the generic [S]ensor [A]ctuator [U]ber [L]ayer. More...

Detailed Description

Definition of the generic [S]ensor [A]ctuator [U]ber [L]ayer.

Author
Hauke Petersen hauke.nosp@m..pet.nosp@m.ersen.nosp@m.@fu-.nosp@m.berli.nosp@m.n.de

Definition in file saul.h.

#include <stdint.h>
#include <errno.h>
#include "phydat.h"
+ Include dependency graph for saul.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  saul_driver_t
 Definition of the RIOT actuator/sensor interface. More...
 

Typedefs

typedef int(* saul_read_t) (const void *dev, phydat_t *res)
 Read a value (a set of values) from a device. More...
 
typedef int(* saul_write_t) (const void *dev, phydat_t *data)
 Write a value (a set of values) to a device. More...
 

Functions

void saul_init_devs (void)
 Initialize all available SAUL drivers. More...
 
int saul_notsup (const void *dev, phydat_t *dat)
 Default not supported function.
 
const char * saul_class_to_str (const uint8_t class_id)
 Helper function converts a class ID to a string. More...
 

Definition of device classes

This list contains a collections of available device classes.

Each device must be part of one, but can be part of multiple of these classes. When belonging to more than one class, a device must however expose one driver for each class it belongs to, and it has to register each driver with a separate entry at the SAUL registry.

Classes are identified by 8-bit unsigned integers.

For searching and filtering purposes, the device classes are further split into top-level categories: sensors and actuators. For identification, the two most significant bits of a class specify the device category (SAUL category ID) and the six least significant bits identify the class within its category (SAUL intra-category ID): Therefore, all actuator classes start with 0b01xxxxxx, all sensor classes start with 0b10xxxxxx.

This list is not exhaustive, extend to your needs!

enum  { SAUL_CAT_UNDEF = 0x00, SAUL_CAT_ACT = 0x40, SAUL_CAT_SENSE = 0x80 }
 Definition of SAUL categories. More...
 
enum  {
  SAUL_ACT_ID_ANY, SAUL_ACT_ID_LED_RGB, SAUL_ACT_ID_SERVO, SAUL_ACT_ID_MOTOR,
  SAUL_ACT_ID_SWITCH, SAUL_ACT_ID_DIMMER, SAUL_ACT_NUMOF
}
 Definition of actuator intra-category IDs. More...
 
enum  {
  SAUL_SENSE_ID_ANY, SAUL_SENSE_ID_BTN, SAUL_SENSE_ID_TEMP, SAUL_SENSE_ID_HUM,
  SAUL_SENSE_ID_LIGHT, SAUL_SENSE_ID_ACCEL, SAUL_SENSE_ID_MAG, SAUL_SENSE_ID_GYRO,
  SAUL_SENSE_ID_COLOR, SAUL_SENSE_ID_PRESS, SAUL_SENSE_ID_ANALOG, SAUL_SENSE_ID_UV,
  SAUL_SENSE_ID_OBJTEMP, SAUL_SENSE_ID_COUNT, SAUL_SENSE_ID_DISTANCE, SAUL_SENSE_ID_CO2,
  SAUL_SENSE_ID_TVOC, SAUL_SENSE_ID_GAS, SAUL_SENSE_ID_OCCUP, SAUL_SENSE_ID_PROXIMITY,
  SAUL_SENSE_ID_RSSI, SAUL_SENSE_ID_CHARGE, SAUL_SENSE_ID_CURRENT, SAUL_SENSE_ID_PM,
  SAUL_SENSE_ID_CAPACITANCE, SAUL_SENSE_ID_VOLTAGE, SAUL_SENSE_ID_PH, SAUL_SENSE_ID_POWER,
  SAUL_SENSE_ID_SIZE, SAUL_SENSE_NUMOF
}
 Definition of sensor intra-category IDs. More...
 
enum  {
  SAUL_ACT_ANY = SAUL_CAT_ACT | SAUL_ACT_ID_ANY, SAUL_ACT_LED_RGB = SAUL_CAT_ACT | SAUL_ACT_ID_LED_RGB, SAUL_ACT_SERVO = SAUL_CAT_ACT | SAUL_ACT_ID_SERVO, SAUL_ACT_MOTOR = SAUL_CAT_ACT | SAUL_ACT_ID_MOTOR,
  SAUL_ACT_SWITCH = SAUL_CAT_ACT | SAUL_ACT_ID_SWITCH, SAUL_ACT_DIMMER = SAUL_CAT_ACT | SAUL_ACT_ID_DIMMER, SAUL_SENSE_ANY = SAUL_CAT_SENSE | SAUL_SENSE_ID_ANY, SAUL_SENSE_BTN = SAUL_CAT_SENSE | SAUL_SENSE_ID_BTN,
  SAUL_SENSE_TEMP = SAUL_CAT_SENSE | SAUL_SENSE_ID_TEMP, SAUL_SENSE_HUM = SAUL_CAT_SENSE | SAUL_SENSE_ID_HUM, SAUL_SENSE_LIGHT = SAUL_CAT_SENSE | SAUL_SENSE_ID_LIGHT, SAUL_SENSE_ACCEL = SAUL_CAT_SENSE | SAUL_SENSE_ID_ACCEL,
  SAUL_SENSE_MAG = SAUL_CAT_SENSE | SAUL_SENSE_ID_MAG, SAUL_SENSE_GYRO = SAUL_CAT_SENSE | SAUL_SENSE_ID_GYRO, SAUL_SENSE_COLOR = SAUL_CAT_SENSE | SAUL_SENSE_ID_COLOR, SAUL_SENSE_PRESS = SAUL_CAT_SENSE | SAUL_SENSE_ID_PRESS,
  SAUL_SENSE_ANALOG = SAUL_CAT_SENSE | SAUL_SENSE_ID_ANALOG, SAUL_SENSE_UV = SAUL_CAT_SENSE | SAUL_SENSE_ID_UV, SAUL_SENSE_OBJTEMP = SAUL_CAT_SENSE | SAUL_SENSE_ID_OBJTEMP, SAUL_SENSE_COUNT = SAUL_CAT_SENSE | SAUL_SENSE_ID_COUNT,
  SAUL_SENSE_DISTANCE = SAUL_CAT_SENSE | SAUL_SENSE_ID_DISTANCE, SAUL_SENSE_CO2 = SAUL_CAT_SENSE | SAUL_SENSE_ID_CO2, SAUL_SENSE_TVOC = SAUL_CAT_SENSE | SAUL_SENSE_ID_TVOC, SAUL_SENSE_GAS = SAUL_CAT_SENSE | SAUL_SENSE_ID_GAS,
  SAUL_SENSE_OCCUP = SAUL_CAT_SENSE | SAUL_SENSE_ID_OCCUP, SAUL_SENSE_PROXIMITY = SAUL_CAT_SENSE | SAUL_SENSE_ID_PROXIMITY, SAUL_SENSE_RSSI = SAUL_CAT_SENSE | SAUL_SENSE_ID_RSSI, SAUL_SENSE_CHARGE = SAUL_CAT_SENSE | SAUL_SENSE_ID_CHARGE,
  SAUL_SENSE_CURRENT = SAUL_CAT_SENSE | SAUL_SENSE_ID_CURRENT, SAUL_SENSE_PM = SAUL_CAT_SENSE | SAUL_SENSE_ID_PM, SAUL_SENSE_CAPACITANCE = SAUL_CAT_SENSE | SAUL_SENSE_ID_CAPACITANCE, SAUL_SENSE_VOLTAGE = SAUL_CAT_SENSE | SAUL_SENSE_ID_VOLTAGE,
  SAUL_SENSE_PH = SAUL_CAT_SENSE | SAUL_SENSE_ID_PH, SAUL_SENSE_POWER = SAUL_CAT_SENSE | SAUL_SENSE_ID_POWER, SAUL_SENSE_SIZE = SAUL_CAT_SENSE | SAUL_SENSE_ID_SIZE, SAUL_CLASS_ANY = 0xff
}
 Definition of SAUL actuator and sensor classes. More...
 
enum  { SAUL_CAT_MASK = 0xc0, SAUL_ID_MASK = 0x3f }
 Bitmask to retrieve the class ID and intra-category ID from a SAUL class. More...