かんたくんのやつです。
Fork of HCSR04 by
Diff: hcsr04.h
- Revision:
- 4:33938a97d904
- Parent:
- 3:e6795cb9439c
- Child:
- 6:4be4fcd0c171
--- a/hcsr04.h Sat Mar 30 18:43:21 2013 +0000 +++ b/hcsr04.h Sat Mar 30 18:46:01 2013 +0000 @@ -41,15 +41,19 @@ /** Return the distance from obstacle in cm * @param distance in cms and returns -1, in case of failure */ - unsigned int get_dist_cm(void); + /** Return the pulse duration equal to sonic waves travelling to obstacle and back to receiver. + * @param pulse duration in microseconds. + */ unsigned int get_pulse_us(void); + /** Generates the trigger pulse of 10us on the trigger PIN. + */ void start(void ); void isr_rise(void); void isr_fall(void); void fall (void (*fptr)(void)); void rise (void (*fptr)(void)); - + private: @@ -58,7 +62,7 @@ DigitalOut trigger; InterruptIn echo; unsigned int pulsedur; - unsigned int distance; + unsigned int distance; }; #endif \ No newline at end of file