felias-fogg / SoftI2CMaster

Software I2C Arduino library
GNU General Public License v3.0
368 stars 100 forks source link

Remove dependency on Arduino.h #41

Closed ToxicFrog closed 3 years ago

ToxicFrog commented 5 years ago

It looks like this is only needed for the bool type; I was able to get it working fine with just avr-gcc, no Arduino libraries, by removing the #include and replacing it with:

typedef uint8_t bool;
#define false ((bool)0)
#define true ((bool)~false)
felias-fogg commented 3 years ago

For plain avr-gcc, you could use Peter Fleury's original assembler program. Moreover, bool is actually a C++ type. The recommended Arduino type is boolean, which is a bit confusing. So I am not sure why Arduino.h is needed for this. Probably, because it itself includes some standard C++ typedefs. In any case, I could probably could get rid of this include ... maybe sometimes in the future.