JM9 XRCU Board 0.1.0
Libraries API Reference
Loading...
Searching...
No Matches
Uts_gpio.h
Go to the documentation of this file.
1
8
9#ifndef UTS_GPIO_H
10#define UTS_GPIO_H
11
12#include <Arduino.h>
13
14#include <Uts_togglable.h>
15
16class Uts_tic;
17
26class Uts_gpio : public Uts_togglable {
27 private:
31 const uint8_t port;
32
36 const uint32_t trig_pin;
37
41 const uint32_t echo_pin;
42
46 Uts_tic *uts_tic_ptr;
47
53 inline bool send_trig () { return send_trig(true); }
54
58 void update ();
59
63 static volatile unsigned long prev_echo_micros;
64
68 static const uint32_t MIN_UTS_QUERY_SEPARATION_MICROS;
69
70 protected:
77 bool send_trig (bool wait_min_separation);
78
84 inline uint8_t get_port () { return port; }
85
91 inline uint32_t get_trig_pin () { return trig_pin; }
92
98 inline uint32_t get_echo_pin () { return echo_pin; }
99
108 bool actual_begin ();
109
117 void actual_end ();
118
119 public:
125 Uts_gpio (const uint8_t init_port);
126
135 virtual bool begin ();
136
143 virtual void end ();
144
150 virtual uint16_t read_dist_mm ();
151};
152
153#include <Uts_tic.h>
154
155#endif // #ifndef UTS_GPIO_H
virtual bool begin()
Activates this ultrasonic sensor.
Definition Uts_gpio.cpp:55
bool actual_begin()
Activates this ultrasonic sensor.
Definition Uts_gpio.cpp:39
uint32_t get_echo_pin()
Gets the echo pin connected to this ultrasonic sensor.
Definition Uts_gpio.h:98
virtual void end()
Deactivates this ultrasonic sensor.
Definition Uts_gpio.cpp:63
uint8_t get_port()
Gets the port connected to this ultrasonic sensor.
Definition Uts_gpio.h:84
virtual uint16_t read_dist_mm()
Reads the distance between this ultrasonic sensor and the obstacle in front of it.
Definition Uts_gpio.cpp:93
Uts_gpio(const uint8_t init_port)
Creates a new Uts_gpio object.
Definition Uts_gpio.cpp:12
uint32_t get_trig_pin()
Gets the trigger pin connected to this ultrasonic sensor.
Definition Uts_gpio.h:91
void actual_end()
Deactivates this ultrasonic sensor.
Definition Uts_gpio.cpp:50
Ultrasonic Sensor Driver (TRIG-ECHO Input-Capture) for XRCU.
Definition Uts_tic.h:25
Uts_togglable()
Constructor for a togglable ultrasonic sensor driver.
Definition Uts_togglable.cpp:8