From c3cbe33a4f6a87cc73b311678746e22c75326916 Mon Sep 17 00:00:00 2001 From: Andrey Chilikin Date: Mon, 5 Oct 2015 19:58:06 +0100 Subject: [PATCH] Added for Arduino Wire compatibility --- wi2c.cpp | 18 ++++++++++++++++++ wi2c.h | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 wi2c.cpp create mode 100644 wi2c.h 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 -- 2.39.5