All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches

Device driver for the srf04 ultra sonic range finder. More...

Detailed Description

Device driver for the srf04 ultra sonic range finder.

Author
Semjon Kerner semjo.nosp@m.n.ke.nosp@m.rner@.nosp@m.fu-b.nosp@m.erlin.nosp@m..de

Definition in file srf04.h.

#include <stdint.h>
#include <stdio.h>
#include "periph/gpio.h"
#include "xtimer.h"
+ Include dependency graph for srf04.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  srf04_params_t
 GPIO pins for srf04 device. More...
 
struct  srf04_t
 Device descriptor for srf04 sensor. More...
 

Enumerations

enum  { SRF04_OK = 0 , SRF04_ERR_INVALID = -1 , SRF04_ERR_MEASURING = -2 , SRF04_ERR_GPIO = -3 }
 Status and error return codes. More...
 

Functions

int srf04_init (srf04_t *dev, const srf04_params_t *params)
 Initialize gpio and interrupt.
 
void srf04_trigger (const srf04_t *dev)
 Triggers measurement.
 
int srf04_read (const srf04_t *dev)
 Returns time of flight in ms.
 
int srf04_get_distance (const srf04_t *dev)
 Convenience function triggers a measurement and returns distance.