Loom 4 v4.5
Arduino library for Internet of Things Rapid Prototyping in environmental sensing
Loading...
Searching...
No Matches
I2CDevice.h
1#pragma once
2
3#include "Module.h"
4#include "Logger.h"
5
6class I2CDevice : public Module{
7 public:
8
9 /* Construct a new I2C device */
10 I2CDevice(const char* modName) : Module(modName) {};
11
12 /* Checks if the given I2C device is currently connected*/
13 bool checkDeviceConnection() {
14 FUNCTION_START;
15 if(module_address != -1){
16 Wire.beginTransmission(module_address);
17 if(Wire.endTransmission() == 0){
18 FUNCTION_END;
19 return true;
20 }
21 else{
22 needsReinit = true;
23 FUNCTION_END;
24 return false;
25 }
26 }
27 FUNCTION_END;
28 return false;
29 };
30
31 bool needsReinit = false; // Whether or not the device needs to be reinitialized
32};
Definition: I2CDevice.h:6
Definition: Module.h:30