Driver code for the ultrasonic sensor. More...
#include <stdbool.h>
#include <stdint.h>
#include <sys/cdefs.h>
#include "pico/time.h"
#include "pico/types.h"
#include "hardware/gpio.h"
#include "ultrasonic/ultrasonic.h"
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... | |
Driver code for the ultrasonic sensor.
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. |