Driver for the SRF08 ultrasonic range sensor.  
More...
Driver for the SRF08 ultrasonic range sensor. 
The connection between the MCU and the SRF08 is based on the i2c-interface. 
 | 
| file   | srf08.h | 
|   | Driver definitions for the SRF02 ultrasonic ranger. 
  | 
|   | 
| file   | srf08_params.h | 
|   | Default configuration for srf08 devices. 
  | 
|   | 
◆ SRF08_GAIN_REG
      
        
          | #define SRF08_GAIN_REG   0x1 | 
        
      
 
Max. 
gain register (write) 
Definition at line 41 of file srf08.h.
 
 
◆ srf08_mode_t
Possible measurement modes for the SRF08 sensor. 
| Enumerator | 
|---|
| SRF08_MODE_INCH  | result in inches  
 | 
| SRF08_MODE_CM  | result in centimeters  
 | 
| SRF08_MODE_MICRO_SEC  | result in centimeters  
 | 
| SRF08_ANN_MODE_INCH  | synchronous measurement in inch  
 | 
| SRF08_ANN_MODE_CM  | synchronous measurement in cm  
 | 
| SRF08_ANN_MODE_MICRO_SEC  | synchronous measurement in us  
 | 
Definition at line 82 of file srf08.h.
 
 
◆ srf08_get_distances()
      
        
          | int srf08_get_distances  | 
          ( | 
          const srf08_t *  | 
          dev,  | 
        
        
           | 
           | 
          uint16_t *  | 
          range_array,  | 
        
        
           | 
           | 
          int  | 
          num_echos,  | 
        
        
           | 
           | 
          srf08_mode_t  | 
          ranging_mode  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Get all distances measured from the SRF08 ultrasonic sensor. 
The results of a ranging can be returned in inches, centimeters or microseconds. The SRF08 can detect up to 17 targets.
- Parameters
 - 
  
    | [in] | dev | device descriptor of an SRF08 sensor  | 
    | [in] | range_array | a pointer to a buffer holding the ranging results.  | 
    | [in] | num_echos | number of stored measurements (echos)  | 
    | [in] | ranging_mode | there are three real ranging modes, which return the result in inches, centimeters or microseconds. Another set of three fake ranging modes do the same but without transmitting the burst. | 
  
   
- Returns
 - number of measured echos on success 
 
- 
-1 on ranging mode errors 
 
- 
-2 if num_echos exceeds the max. number of possible measurements 
 
- 
-3 if i2c read high byte failed 
 
- 
-4 if i2c read low byte failed 
 
 
 
◆ srf08_init()
Initialize the SRF08 ultrasonic sensor. 
- Parameters
 - 
  
    | [in] | dev | device descriptor of an SRF08 sensor  | 
    | [in] | params | initialization parameters | 
  
   
- Returns
 - 0 on successful initialization 
 
- 
-3 on max. range error 
 
- 
-4 on max. gain error 
 
 
 
◆ srf08_set_max_gain()
      
        
          | int srf08_set_max_gain  | 
          ( | 
          const srf08_t *  | 
          dev,  | 
        
        
           | 
           | 
          uint8_t  | 
          max_gain  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Set the maximum of the analog stages. 
@ note This value is just a limitation of the maximum amplification and not the actual. While measuring, this value starts at its minimum and increases approx. each 75 us until the maximum value is reached.
- Parameters
 - 
  
    | [in] | dev | device descriptor of an SRF08 sensor  | 
    | [in] | max_gain | the maximal gain value. | 
  
   
- Returns
 - 1 on success 
 
- 
-1 on undefined device given 
 
 
 
◆ srf08_set_max_range()
      
        
          | int srf08_set_max_range  | 
          ( | 
          const srf08_t *  | 
          dev,  | 
        
        
           | 
           | 
          uint8_t  | 
          max_range  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Set the maximum range of the SRF08. 
- Parameters
 - 
  
    | [in] | dev | device descriptor of an SRF08 sensor  | 
    | [in] | max_range | the adjusted maximal range is: max_range = (max_range x 43mm) + 43mm. The hardware limit is 6m. | 
  
   
- Returns
 - 1 on success 
 
- 
-1 on undefined device given