INF2004-Project v0.1
 
Loading...
Searching...
No Matches
ultrasonic.h
Go to the documentation of this file.
1
12#ifndef ULTRASONIC_H // Include guard.
13#define ULTRASONIC_H
14
15// Definitions
16// -----------------------------------------------------------------------------
17//
18
26#define ULTRASONIC_TIMEOUT 26100
28#define ULTRASONIC_TRIG_PULSE_US 10 // End of ultrasonic_constants group.
31
43#define ULTRASONIC_PULSE_TO_CM(x) (x / 29. / 2.)
44
50#define ULTRASONIC_PULSE_TO_IN(x) (x / 74. / 2.)
51 // End of ultrasonic_macros group.
53
54// Function prototypes
55// -----------------------------------------------------------------------------
56//
57
58void ultrasonic_init_pins(uint trig_pin, uint echo_pin);
59uint64_t ultrasonic_get_cm(uint trig_pin, uint echo_pin);
60uint64_t ultrasonic_get_in(uint trig_pin, uint echo_pin);
61
62#endif // ULTRASONIC_H
63
64// End of file driver/ultrasonic/ultrasonic.h.
uint64_t ultrasonic_get_in(uint trig_pin, uint echo_pin)
Get the distance to an object in inches.
Definition: ultrasonic.c:83
void ultrasonic_init_pins(uint trig_pin, uint echo_pin)
Initalises the pins for the ultrasonic sensor.
Definition: ultrasonic.c:49
uint64_t ultrasonic_get_cm(uint trig_pin, uint echo_pin)
Get the distance to an object in centimetres.
Definition: ultrasonic.c:69