diff --git a/drivers/include/srf04.h b/drivers/include/srf04.h index 3856b34f0f..6e985e9851 100644 --- a/drivers/include/srf04.h +++ b/drivers/include/srf04.h @@ -54,7 +54,7 @@ typedef struct { */ typedef struct { srf04_params_t p; /**< GPIO Ports of device */ - int distance; /**< raw time of flight distance */ + int32_t distance; /**< raw time of flight distance */ uint32_t time; /**< timestamp of trigger or echo */ } srf04_t; diff --git a/drivers/srf04/srf04.c b/drivers/srf04/srf04.c index ae8f36615d..560e1e647e 100644 --- a/drivers/srf04/srf04.c +++ b/drivers/srf04/srf04.c @@ -83,11 +83,13 @@ int srf04_read(const srf04_t* dev) int srf04_get_distance(const srf04_t* dev) { - /* trigger new reading */ + /* Trigger new reading */ srf04_trigger(dev); - /* give the sensor the required time for sampling */ + + /* Give the sensor the required time for sampling */ xtimer_usleep(SRF04_SAMPLE_PERIOD); - /* get the result */ + + /* Get the result */ if (dev->distance >= SRF04_OK) { return ((dev->distance * 100) / SRF04_DISTANCE); }