Skip to content

Commit 5f07a1f

Browse files
committed
v0.3: fixed some compilation issues for ESP8266
1 parent 925269f commit 5f07a1f

File tree

5 files changed

+19
-17
lines changed

5 files changed

+19
-17
lines changed

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "Arduino Wrapper for Wire librarry (for SAM, ESP8266...
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = 0.2
41+
PROJECT_NUMBER = 0.3
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

Release Notes.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ Feel free to share your thoughts @ xgarmanboziax@gmail.com about:
1313
------------
1414

1515
** Actual:
16+
v0.3 09 Jul 2017:
17+
- surrounded c libs with extern C
18+
- added I2C_OK undef when WireWrapper is included for ESP8266 (ESP8266 core use an equal I2C_OK def too)
19+
- No call to Wire.end on ESP8266 (no function for that)
20+
1621
v0.2 31 Jan 2017:
1722
fixes for issue #1 (https://github.com/SMFSW/WireWrapper/issues/1)
1823
- refactored I2C_SPEED enum names for coherence with I2C specifications

WireWrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!\file WireWrapper.c
22
** \author SMFSW
3-
** \version 0.2
3+
** \version 0.3
44
** \copyright MIT SMFSW (2017)
55
** \brief arduino master i2c in plain c code
66
**/

WireWrapper.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*!\file WireWrapper.h
22
** \author SMFSW
3-
** \version 0.2
3+
** \version 0.3
44
** \copyright MIT SMFSW (2017)
55
** \brief arduino i2c in plain c declarations
66
**/
77
/****************************************************************/
88
#ifndef __WIREWRAPPER_H__
9-
#define __WIREWRAPPER_H__ "v0.2"
9+
#define __WIREWRAPPER_H__ "v0.3"
1010
/****************************************************************/
1111

1212
#if defined(DOXY)
@@ -24,14 +24,13 @@
2424
#include <WProgram.h>
2525
#endif
2626

27-
#include <inttypes.h>
27+
extern "C" {
2828
#include <stdbool.h>
29+
#include <inttypes.h>
30+
}
2931

3032
#include <Wire.h>
3133

32-
#ifdef __cplusplus
33-
extern "C"{
34-
#endif
3534

3635
#define DEF_CI2C_NB_RETRIES 3 //!< Default cI2C transaction retries
3736
#define DEF_CI2C_TIMEOUT 100 //!< Default cI2C timeout
@@ -58,6 +57,9 @@ typedef enum __attribute__((__packed__)) enI2C_SPEED {
5857
I2C_HS = 3400 //!< I2C High Speed (3.4MHz)
5958
} I2C_SPEED;
6059

60+
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ESP8266_ESP01)
61+
#undef I2C_OK //!\note I2C_OK already defined on ESP8266 (same value), undef before I2C_STATUS enum declaration
62+
#endif
6163

6264
/*! \enum enI2C_STATUS
6365
* \brief I2C slave status
@@ -184,7 +186,7 @@ extern void I2C_init(uint16_t speed);
184186
*/
185187
inline void __attribute__((__always_inline__)) I2C_uninit()
186188
{
187-
#if !defined(__TINY__)
189+
#if !defined(__TINY__) && !defined(ARDUINO_ARCH_ESP8266) && !defined(ARDUINO_ESP8266_ESP01)
188190
Wire.end();
189191
#endif
190192
}
@@ -260,9 +262,4 @@ inline I2C_STATUS __attribute__((__always_inline__)) I2C_read_next(I2C_SLAVE * s
260262
return I2C_read(slave, slave->reg_addr, data, bytes);
261263
}
262264

263-
264-
#ifdef __cplusplus
265-
}
266-
#endif
267-
268265
#endif

library.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name=WireWrapper
2-
version=0.2
3-
author=SMFSW
4-
maintainer=SMFSW
2+
version=0.3
3+
author=SMFSW <xgarmanboziax@gmail.com>
4+
maintainer=SMFSW <xgarmanboziax@gmail.com>
55
sentence=Arduino Wrapper for Wire librarry (for SAM, ESP8266...)
66
paragraph=A wrapper for Wire library meant to be put in place of cI2C library on SAM, ESP8266... targets
77
category=Communication

0 commit comments

Comments
 (0)