JM9 XRCU Board 0.1.2
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
40 HardwareTimer *volatile ic_timer;
41
45 volatile uint8_t ic_channel;
46
52 bool send_trig ();
53
57 void update ();
58
62 void ic_callback ();
63
69 uint32_t get_ic_echo_pin ();
70
74 friend void uts_tic_tim8_overflow_callback ();
75
79 friend void uts_tic_tim9_overflow_callback ();
80
81 public:
87 Uts_tic (const uint8_t init_port);
88
92 ~Uts_tic ();
93
102 bool begin ();
103
110 void end ();
111
117 uint16_t read_dist_mm ();
118};
119
125extern Uts_tic uts_tics[4];
126
132extern Uts_tic &uts_tic1;
133
139extern Uts_tic &uts_tic2;
140
146extern Uts_tic &uts_tic3;
147
153extern Uts_tic &uts_tic4;
154
155#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:188
friend void uts_tic_tim9_overflow_callback()
Friend for timer 9 OVerFlow callback.
Definition Uts_tic.cpp:282
Uts_tic(const uint8_t init_port)
Creates a new Uts_tic object.
Definition Uts_tic.cpp:84
friend void uts_tic_tim8_overflow_callback()
Friend for timer 8 OVerFlow callback.
Definition Uts_tic.cpp:258
~Uts_tic()
Destroys this object.
Definition Uts_tic.cpp:92
bool begin()
Activates this ultrasonic sensor.
Definition Uts_tic.cpp:96
void end()
Deactivates this ultrasonic sensor.
Definition Uts_tic.cpp:161