Revision 1461
updated all the library code to have sensible _init behavior.
Almost all of the library components have a global variable which gets set after init and the functions inside will fail with an error code if init has not been called. Also, the init functions themselves check this variable and will bail out without doing any damage if that init has already been called
rangefinder.h | ||
---|---|---|
37 | 37 |
#ifndef _RANGEFINDER_H_ |
38 | 38 |
#define _RANGEFINDER_H_ |
39 | 39 |
|
40 |
#include <dragonfly_lib.h> |
|
41 |
|
|
40 | 42 |
/** |
41 | 43 |
* @addtogroup rangefinder |
42 | 44 |
* @{ |
... | ... | |
58 | 60 |
#define MAX_IR_ADC8 133 |
59 | 61 |
|
60 | 62 |
/** @brief Initialize the rangefinders **/ |
61 |
void range_init(void);
|
|
63 |
int range_init(void);
|
|
62 | 64 |
/** @brief Read the distance from a rangefinder **/ |
63 | 65 |
int range_read_distance(int range_id); |
64 | 66 |
/** @brief Convert logarithmic-scale distance readings to a linear scale **/ |
Also available in: Unified diff