Global sensor/actuator registry for SAUL devices.  
More...
Global sensor/actuator registry for SAUL devices. 
- See also
- [S]ensor [A]ctuator [U]ber [L]ayer 
|  | 
| file | saul_reg.h | 
|  | SAUL registry interface definition. 
 | 
|  | 
|  | 
| typedef struct saul_reg | saul_reg_t | 
|  | SAUL registry entry. 
 | 
|  | 
|  | 
| saul_reg_t * | saul_reg | 
|  | Export the SAUL registry as global variable. 
 | 
|  | 
◆ saul_reg_add()
Register a device with the SAUL registry. 
- Note
- Make sure the registry entry the devpointer is pointing to resides in some persistent memory location and not on some position on the stack where it will be overwritten...
- Parameters
- 
  
    | [in] | dev | pointer to a pre-populated registry entry |  
 
- Returns
- 0 on success 
- 
-ENODEV on invalid entry given 
 
 
◆ saul_reg_find_name()
      
        
          | saul_reg_t * saul_reg_find_name | ( | const char * | name | ) |  | 
      
 
Find the first device by its name in the registry. 
- Parameters
- 
  
    | [in] | name | the name to look for |  
 
- Returns
- pointer to the first device matching the given name 
- 
NULL if no device with that name could be found 
 
 
◆ saul_reg_find_nth()
Find a device by its position in the registry. 
- Parameters
- 
  
    | [in] | pos | position to look up |  
 
- Returns
- pointer to the device at position specified by pos
- 
NULL if no device is registered at that position 
 
 
◆ saul_reg_find_type()
Find the first device by its type in the registry. 
- Parameters
- 
  
    | [in] | type | the device type to look for |  
 
- Returns
- pointer to the first device matching the given type 
- 
NULL if no device of that type could be found 
 
 
◆ saul_reg_find_type_and_name()
      
        
          | 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. 
- Parameters
- 
  
    | [in] | type | the device type to look for |  | [in] | name | the name to look for |  
 
- Returns
- pointer to the first device matching the given type and name 
- 
NULL if no device with that type and name could be found 
 
 
◆ saul_reg_read()
Read data from the given device. 
- Parameters
- 
  
    | [in] | dev | device to read from |  | [out] | res | location to store the results in |  
 
- Returns
- the number of data elements read to res[1-3]
- 
-ENODEV if given device is invalid 
- 
-ENOTSUP if read operation is not supported by the device 
- 
-ECANCELED on device errors 
 
 
◆ saul_reg_write()
Write data to the given device. 
- Parameters
- 
  
    | [in] | dev | device to write to |  | [in] | data | data to write to the device |  
 
- Returns
- the number of data elements processed by the device 
- 
-ENODEV if given device is invalid 
- 
-ENOTSUP if read operation is not supported by the device 
- 
-ECANCELED on device errors