JM9 XRCU Board 0.1.0
Libraries API Reference
Loading...
Searching...
No Matches
Uts_tic.h
Go to the documentation of this file.
1
8
9#ifndef UTS_TIC_H
10#define UTS_TIC_H
11
12#include <Arduino.h>
13#include <HardwareTimer.h>
14
15#include <Uts_gpio.h>
16
25class Uts_tic : public Uts_gpio {
26 private:
30 volatile unsigned long echo_rise_ticks;
31
35 volatile unsigned long echo_fall_ticks;
36
42 bool send_trig ();
43
47 void update ();
48
52 friend void uts_tic1_ic_callback ();
53
57 friend void uts_tic2_ic_callback ();
58
62 friend void uts_tic3_ic_callback ();
63
67 friend void uts_tic4_ic_callback ();
68
72 friend void uts_tic_tim8_overflow_callback ();
73
77 friend void uts_tic_tim9_overflow_callback ();
78
79 public:
85 Uts_tic (const uint8_t init_port);
86
90 ~Uts_tic ();
91
100 bool begin ();
101
108 void end ();
109
115 uint16_t read_dist_mm ();
116};
117
123extern Uts_tic uts_tics[4];
124
130extern Uts_tic &uts_tic1;
131
137extern Uts_tic &uts_tic2;
138
144extern Uts_tic &uts_tic3;
145
151extern Uts_tic &uts_tic4;
152
153#endif // #ifndef UTS_TIC_H
Uts_gpio(const uint8_t init_port)
Creates a new Uts_gpio object.
Definition Uts_gpio.cpp:12
Ultrasonic Sensor Driver (TRIG-ECHO Input-Capture) for XRCU.
Definition Uts_tic.h:25
uint16_t read_dist_mm()
Reads the distance between this ultrasonic sensor and the obstacle in front of it.
Definition Uts_tic.cpp:179
friend void uts_tic_tim9_overflow_callback()
Friend for timer 9 OVerFlow callback.
Definition Uts_tic.cpp:236
Uts_tic(const uint8_t init_port)
Creates a new Uts_tic object.
Definition Uts_tic.cpp:127
friend void uts_tic1_ic_callback()
Friend for uts_tic1 Input-Capture callback.
Definition Uts_tic.cpp:41
friend void uts_tic_tim8_overflow_callback()
Friend for timer 8 OVerFlow callback.
Definition Uts_tic.cpp:214
~Uts_tic()
Destroys this object.
Definition Uts_tic.cpp:135
bool begin()
Activates this ultrasonic sensor.
Definition Uts_tic.cpp:139
friend void uts_tic4_ic_callback()
Friend for uts_tic4 Input-Capture callback.
Definition Uts_tic.cpp:65
void end()
Deactivates this ultrasonic sensor.
Definition Uts_tic.cpp:162
friend void uts_tic2_ic_callback()
Friend for uts_tic2 Input-Capture callback.
Definition Uts_tic.cpp:49
friend void uts_tic3_ic_callback()
Friend for uts_tic3 Input-Capture callback.
Definition Uts_tic.cpp:57