The friendly Operating System for the Internet of Things

Driver definitions for the SRF02 ultrasonic ranger. More...

Detailed Description

The connection between the SRF08 and the MCU is based on the i2c interface.

Author
Zakaria Kasmi zkasm.nosp@m.i@in.nosp@m.f.fu-.nosp@m.berl.nosp@m.in.de
Peter Kietzmann peter.nosp@m..kie.nosp@m.tzman.nosp@m.n@ha.nosp@m.w-ham.nosp@m.burg.nosp@m..de

Definition in file srf08.h.

#include <stdint.h>
#include "periph/i2c.h"
+ Include dependency graph for srf08.h:

Go to the source code of this file.

Data Structures

struct  srf08_t
 Device descriptor for SRF08 sensors. More...
 

Macros

#define SRF08_DEFAULT_ADDR   112
 The sensors default I2C address.
 
#define SRF08_COMMAND_REG   0x0
 The sensors command register (write)
 
#define SRF08_GAIN_REG   0x1
 Max. More...
 
#define SRF08_RANGE_REG   0x2
 The sensors range register (write)
 
#define SRF08_RANGE_HIGH_BYTE   0x2
 The upper measurement byte (read)
 
#define SRF08_RANGE_LOW_BYTE   0x3
 The lower measurement byte (read)
 
#define SRF08_MAX_REGISTER_NUMBER   35
 Number of highest register.
 
#define SRF08_MAX_ECHO_NUMBER   17
 Maximum number of echos from more distant objects.
 
#define SRF08_MAX_RANGE_6M   0x8C
 Maximum range the sensor can measure (6m)
 
#define SRF08_MAX_GAIN   0x25
 Maximum gain of the sensor (1025)
 

Enumerations

enum  srf08_mode_t {
  SRF08_MODE_INCH = 0x50, SRF08_MODE_CM = 0x51, SRF08_MODE_MICRO_SEC = 0x52, SRF08_ANN_MODE_INCH = 0x53,
  SRF08_ANN_MODE_CM = 0x54, SRF08_ANN_MODE_MICRO_SEC = 0x55
}
 Possible measurement modes for the SRF08 sensor. More...
 

Functions

int srf08_init (srf08_t *dev, i2c_t i2c, uint8_t addr, i2c_speed_t speed)
 Initialize the SRF08 ultrasonic sensor. More...
 
int srf08_set_max_range (srf08_t *dev, uint8_t max_range)
 Set the maximum range of the SRF08. More...
 
int srf08_set_max_gain (srf08_t *dev, uint8_t max_gain)
 Set the maximum of the analog stages. More...
 
int srf08_get_distances (srf08_t *dev, uint16_t *range_array, int num_echos, srf08_mode_t ranging_mode)
 Get all distances measured from the SRF08 ultrasonic sensor. More...