From: Andrey Chilikin Date: Mon, 5 Oct 2015 18:58:06 +0000 (+0100) Subject: Added for Arduino Wire compatibility X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=c3cbe33a4f6a87cc73b311678746e22c75326916;p=corbenik%2Fbdfe.git Added for Arduino Wire compatibility --- diff --git a/wi2c.cpp b/wi2c.cpp new file mode 100644 index 0000000..1db24f1 --- /dev/null +++ b/wi2c.cpp @@ -0,0 +1,18 @@ +#include + +#include "wi2c.h" + +int i2c_start(uint8_t address) +{ + Wire.beginTransmission(address); +} + +int i2c_write(uint8_t data) +{ + Wire.write(data); +} + +int i2c_stop(void) +{ + Wire.endTransmission(); +} diff --git a/wi2c.h b/wi2c.h new file mode 100644 index 0000000..aff17bd --- /dev/null +++ b/wi2c.h @@ -0,0 +1,16 @@ +#ifndef WIRE_TO_I2C_HEADER +#define WIRE_TO_I2C_HEADER + +#ifdef __cplusplus +extern "C" { +#endif + +int i2c_start(uint8_t address); +int i2c_write(uint8_t data); +int i2c_stop(void); + +#ifdef __cplusplus +} +#endif + +#endif