Header file for the ultrasonic sensor driver. More...
Go to the source code of this file.
Macros | |
#define | ULTRASONIC_PULSE_TO_CM(x) (x / 29. / 2.) |
#define | ULTRASONIC_PULSE_TO_IN(x) (x / 74. / 2.) |
#define | ULTRASONIC_TIMEOUT 26100 |
Timeout in cycles. | |
#define | ULTRASONIC_TRIG_PULSE_US 10 |
Trigger pulse width in us. | |
Functions | |
uint64_t | ultrasonic_get_cm (uint trig_pin, uint echo_pin) |
Get the distance to an object in centimetres. More... | |
uint64_t | ultrasonic_get_in (uint trig_pin, uint echo_pin) |
Get the distance to an object in inches. More... | |
void | ultrasonic_init_pins (uint trig_pin, uint echo_pin) |
Initalises the pins for the ultrasonic sensor. More... | |
Header file for the ultrasonic sensor driver.
uint64_t ultrasonic_get_cm | ( | uint | trig_pin, |
uint | echo_pin | ||
) |
Get the distance to an object in centimetres.
[in] | trig_pin | Trigger pin for the ultrasonic sensor. |
[in] | echo_pin | Echo pin for the ultrasonic sensor. |
References ULTRASONIC_PULSE_TO_CM.
uint64_t ultrasonic_get_in | ( | uint | trig_pin, |
uint | echo_pin | ||
) |
Get the distance to an object in inches.
[in] | trig_pin | Trigger pin for the ultrasonic sensor. |
[in] | echo_pin | Echo pin for the ultrasonic sensor. |
References ULTRASONIC_PULSE_TO_IN.
void ultrasonic_init_pins | ( | uint | trig_pin, |
uint | echo_pin | ||
) |
Initalises the pins for the ultrasonic sensor.
[in] | trig_pin | Trigger pin for the ultrasonic sensor. |
[in] | echo_pin | Echo pin for the ultrasonic sensor. |