JM9 XRCU Board 0.1.2
Libraries API Reference
Loading...
Searching...
No Matches
Uts_i2c.h
Go to the documentation of this file.
1
8
9#ifndef UTS_I2C_H
10#define UTS_I2C_H
11
12#include <Arduino.h>
13#include <Wire.h>
14
15#include <Uts_togglable.h>
16
24class Uts_i2c : public Uts_togglable {
25 private:
29 uint8_t i2c_address;
30
34 static const uint8_t DEFAULT_I2C_ADDRESS;
35
39 static const uint32_t I2C_FREQ;
40
44 const uint8_t port;
45
49 volatile unsigned long prev_trig_micros;
50
51 // // the previous time an echo is received (unit is microseconds)
52 // volatile unsigned long prev_echo_micros;
53
57 friend void JM9_uts_i2c_callback ();
58
64 bool send_trig ();
65
71 bool available ();
72
78 bool update ();
79
80 public:
86 Uts_i2c (const uint8_t init_port);
87
96 bool begin ();
97
107 bool begin (const uint8_t init_i2c_address);
108
115 void end ();
116};
117
118#endif // #ifndef UTS_I2C_H
void end()
Deactivates this ultrasonic sensor.
Definition Uts_i2c.cpp:58
bool begin()
Activates this ultrasonic sensor.
Definition Uts_i2c.cpp:30
friend void JM9_uts_i2c_callback()
Friend for low-frequency regular callback.
Definition Uts_i2c.cpp:128
Uts_i2c(const uint8_t init_port)
Creates a new Uts_i2c object.
Definition Uts_i2c.cpp:19
Uts_togglable()
Constructor for a togglable ultrasonic sensor driver.
Definition Uts_togglable.cpp:8