Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
I2cMaster.h
1 /* Arduino I2cMaster Library
2  * Copyright (C) 2010 by William Greiman
3  *
4  * This file is part of the Arduino I2cMaster Library
5  *
6  * This Library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This Library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with the Arduino I2cMaster Library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 #ifndef I2C_MASTER_H
21 #define I2C_MASTER_H
22 
26 #include "WiringFrameworkDependencies.h"
27 
29 uint8_t const I2C_DELAY_USEC = 2;
30 
32 uint8_t const I2C_READ = 1;
33 
35 uint8_t const I2C_WRITE = 0;
36 
42 {
43 public:
48  virtual uint8_t read(uint8_t last) = 0;
53  virtual bool restart(uint8_t addressRW) = 0;
58  virtual bool start(uint8_t addressRW) = 0;
60  virtual void stop(void) = 0;
64  virtual bool write(uint8_t data) = 0;
65 };
66 //------------------------------------------------------------------------------
72 {
73 public:
74  SoftI2cMaster(uint8_t sdaPin, uint8_t sclPin);
75  uint8_t read(uint8_t last);
76  bool restart(uint8_t addressRW);
77  bool start(uint8_t addressRW);
78  void stop(void);
79  bool write(uint8_t b);
80 private:
81  // SoftI2cMaster() : sdaPin_(0), sclPin_(0) {}
82  uint8_t sdaPin_;
83  uint8_t sclPin_;
84 };
85 
86 #endif // I2C_MASTER_H
virtual bool start(uint8_t addressRW)=0
virtual void stop(void)=0
Base class for SoftI2cMaster and TwiMaster.
Definition: I2cMaster.h:41
virtual bool restart(uint8_t addressRW)=0
virtual bool write(uint8_t data)=0
virtual uint8_t read(uint8_t last)=0
Software I2C master class.
Definition: I2cMaster.h:71