mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
SRF08 driver, ranging function supports various modes.
This commit is contained in:
parent
af48f588c9
commit
11b34f0f0b
@ -18,7 +18,7 @@
|
||||
* @author Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
|
||||
* @version $Revision: 3857 $
|
||||
*
|
||||
* @note $Id: srf08-ultrasonic-sensor.h 3854 2013-09-03 14:06:23 kasmi $
|
||||
* @note $Id: srf08-ultrasonic-sensor.h 3854 2013-09-03 16:26:13 kasmi $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -62,15 +62,20 @@ bool srf08_init(uint8_t i2c_interface, uint32_t baud_rate);
|
||||
* range-finder.
|
||||
* The ranging results are given over the RS232-Interface.
|
||||
*
|
||||
* @param[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.
|
||||
*
|
||||
*/
|
||||
void srf08_start_ranging(void);
|
||||
void srf08_start_ranging(uint8_t ranging_mode);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the maximum range of the SRF08.
|
||||
*
|
||||
* @param[in] max_range the adjusted maximal range is:
|
||||
* max_range = (max_rangex43mm) + 43mm.
|
||||
* @param[in] max_range the adjusted maximal range is:
|
||||
* max_range = (max_rangex43mm) + 43mm.
|
||||
*
|
||||
*/
|
||||
void srf08_set_range(uint8_t max_range);
|
||||
@ -104,11 +109,11 @@ uint8_t srf08_get_gain(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief 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
|
||||
* targets. This function prints the distance values over
|
||||
* the rs232 interface
|
||||
* @brief 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 targets.
|
||||
* This function prints the distance values over the rs232
|
||||
* interface
|
||||
*
|
||||
* @param[in] range_array a pointer to a buffer holding the ranging results.
|
||||
* @param[in] ranging_mode there are three real ranging modes, which return
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 2013 Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
|
||||
*
|
||||
* This source code is licensed under the LGPLv2 license,
|
||||
* This source code is licensed under the LGPLv2 license,
|
||||
* See the file LICENSE for more details.
|
||||
*/
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
* @author Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
|
||||
* @version $Revision: 3854 $
|
||||
*
|
||||
* @note $Id: srf08-ultrasonic-sensor.c 3857 2013-09-02 16:45:49 kasmi $
|
||||
* @note $Id: srf08-ultrasonic-sensor.c 3857 2013-09-03 17:55:49 kasmi $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -151,7 +151,7 @@ int32_t srf08_get_distances(uint32_t *range_array, uint8_t ranging_mode)
|
||||
return echo_number;
|
||||
}
|
||||
|
||||
void srf08_start_ranging(void)
|
||||
void srf08_start_ranging(uint8_t ranging_mode)
|
||||
{
|
||||
uint32_t range_array[SRF08_MAX_ECHO_NUMBER];
|
||||
uint8_t i;
|
||||
@ -165,7 +165,7 @@ void srf08_start_ranging(void)
|
||||
|
||||
while (1) {
|
||||
puts("--------------------------------------------");
|
||||
echo_number = srf08_get_distances(range_array, SRF08_REAL_RANGING_MODE_CM);
|
||||
echo_number = srf08_get_distances(range_array, ranging_mode);
|
||||
|
||||
if (echo_number > 0) {
|
||||
for (i = 0; i < echo_number; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user