JM9 XRCU Board 0.1.2
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
31class Uts_gpio : public Uts_togglable {
32 private:
36 const uint8_t port;
37
41 const uint32_t trig_pin;
42
46 const uint32_t echo_pin;
47
51 Uts_tic *uts_tic_ptr;
52
58 bool scan_for_uts_tic ();
59
65 inline bool send_trig () { return send_trig(true); }
66
70 void update ();
71
75 static volatile unsigned long prev_echo_micros;
76
80 static const uint32_t MIN_UTS_QUERY_SEPARATION_MICROS;
81
82 protected:
89 bool send_trig (bool wait_min_separation);
90
96 inline uint8_t get_port () { return port; }
97
103 inline uint32_t get_trig_pin () { return trig_pin; }
104
110 inline uint32_t get_echo_pin () { return echo_pin; }
111
120 bool actual_begin ();
121
129 void actual_end ();
130
131 public:
137 Uts_gpio (const uint8_t init_port);
138
147 virtual bool begin ();
148
155 virtual void end ();
156
162 virtual uint16_t read_dist_mm ();
163};
164
165#include <Uts_tic.h>
166
167#endif // #ifndef UTS_GPIO_H
virtual bool begin()
Activates this ultrasonic sensor.
Definition Uts_gpio.cpp:60
bool actual_begin()
Activates this ultrasonic sensor.
Definition Uts_gpio.cpp:44
uint32_t get_echo_pin()
Gets the echo pin connected to this ultrasonic sensor.
Definition Uts_gpio.h:110
virtual void end()
Deactivates this ultrasonic sensor.
Definition Uts_gpio.cpp:69
uint8_t get_port()
Gets the port connected to this ultrasonic sensor.
Definition Uts_gpio.h:96
virtual uint16_t read_dist_mm()
Reads the distance between this ultrasonic sensor and the obstacle in front of it.
Definition Uts_gpio.cpp:99
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:103
void actual_end()
Deactivates this ultrasonic sensor.
Definition Uts_gpio.cpp:55
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