Loading...
Searching...
No Matches

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

Detailed Description

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

Go to the source code of this file.

Data Structures

struct  srf02_t
 Device descriptor for SRF02 sensors. More...
 

Macros

#define SRF02_DEFAULT_ADDR   (0xe0) /* 224 decimal */
 Default I2C address of SRF02 sensors.
 
#define SRF02_RANGE_DELAY   (70000U)
 The datasheet tells us, that ranging takes 70ms.
 

Enumerations

enum  srf02_mode_t {
  SRF02_MODE_REAL_INCH = 0x50 , SRF02_MODE_REAL_CM = 0x51 , SRF02_MODE_REAL_MS = 0x52 , SRF02_MODE_FAKE_INCH = 0x56 ,
  SRF02_MODE_FAKE_CM = 0x57 , SRF02_MODE_FAKE_MS = 0x58
}
 Possible measurement modes of the SRF02 sensor. More...
 

Functions

int srf02_init (srf02_t *dev, i2c_t i2c, uint8_t addr)
 Initialize the SRF02 ultrasonic sensor.
 
int srf02_trigger (const srf02_t *dev, srf02_mode_t mode)
 Trigger a new measurement.
 
uint16_t srf02_read (const srf02_t *dev)
 Read the results of the last ranging operation.
 
uint16_t srf02_get_distance (const srf02_t *dev, srf02_mode_t mode)
 Get the distance measured from the SRF02 ultrasonic sensor.
 
int srf02_set_addr (srf02_t *dev, uint8_t new_addr)
 Program the given device with a new bus address.